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

osaurus-ai/osaurus

Measured 14 November 2026, 09:39 UTC, at code version 9002bf7

CAI score 36out of 100 Weak
CriticalWeakAdequateStrongExemplary
Down 3 since the last survey

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

A very large codebase: 831,801 lines of product code in 14 projects, tests not counted · Estimated rebuild effort: about 7.0 person-years · Weakest lens: Event-Driven, 10

Findings by how serious they are

415 critical 6404 serious 194 minor

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

This survey was produced by

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

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

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

54of 54 dimensions measured by tools.
6966of 7013 findings point to an exact file and line, so you can open each one in the code. The other 47 concern the repository as a whole, such as missing documentation.
54dimensions across 8 lenses, read from 831,801 lines of product code in 14 projects.
Chapters

Executive summary

osaurus-ai/osaurus falls short of our standard for production because it has message handlers that wait for another service. It scores 36 out of 100 and is rated Weak, and 408 of its 415 critical findings are security problems.

Event-Driven, at 10, is the weakest lens and counts most in the score. The best first step is stopping the event handlers from waiting on other services, worth about 22 points. Raising Event-Driven to 70 would lift the score to about 56.

356 passwords or keys are open to anyone who can read the repository. Forty-eight pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Replacing each exposed password or key and pinning each tool to an exact version would close both risks. Updating the vulnerable packages would fix the two packages with a known security hole, and limiting each secret to its own step would deal with the two secrets exposed to more of the pipeline than needed. The three tests that check nothing need to check the result they produce.

The product code is 831,801 lines, about €1,000,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.
Event-Driven 10 · counts for 45%Code Health 52 · counts for 25%Security and Compliance 54 · counts for 14%Production Readiness 58 · counts for 8%Performance 60 · counts for 4%Maturity 85 · counts for 2%Domain Modelling 91 · counts for 1%Architecture 92 · counts for 1%

If Event-Driven rose from 10 to 70, the lowest score rated Strong, the score would rise from 36 to about 56.

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

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

  • Cyclomatic Complexity · ConfigEvents.build (cyclomatic 188) Packages/OsaurusCore/Configuration/Declarative/ConfigEvents.swift
  • Cyclomatic Complexity · AgentToolLoop.runHoldingResidency (cyclomatic 172) Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift
  • Cyclomatic Complexity · WorkflowValidator.validateNode (cyclomatic 161) Packages/OsaurusCore/Models/Workflow/WorkflowValidator.swift
  • Cyclomatic Complexity · SubagentSession.runPreparedHost (cyclomatic 124) Packages/OsaurusCore/Subagent/SubagentSession.swift
  • Cyclomatic Complexity · WorkflowDraftOp.parse (cyclomatic 62) Packages/OsaurusCore/Models/Workflow/WorkflowDraft.swift
  • Cyclomatic Complexity · SyncManageFeed.perform (cyclomatic 58) Packages/OsaurusCore/Services/Sync/SyncManageFeed.swift
  • Cyclomatic Complexity · DesignWorkingStore.validate (cyclomatic 54) Packages/OsaurusCore/DevelopmentDesign/DesignWorkingStore.swift
  • Cyclomatic Complexity · WorkflowFailure.classify (cyclomatic 54) Packages/OsaurusCore/Services/Workflow/WorkflowFailure.swift
  • Cyclomatic Complexity · WorkflowStepRisk.badges (cyclomatic 54) Packages/OsaurusCore/Services/Workflow/WorkflowTrust.swift
  • Cyclomatic Complexity · MediaNodeExecutor.settings (cyclomatic 52) Packages/OsaurusCore/Services/Workflow/MediaNodeExecutor.swift
  • Cyclomatic Complexity · CatalogLibraryFixture.activityContent (cyclomatic 51) Packages/OsaurusCore/DevelopmentDesign/CatalogComponents.swift
  • Cyclomatic Complexity · CatalogLibraryFixture.baseContent (cyclomatic 50) Packages/OsaurusCore/DevelopmentDesign/CatalogComponents.swift
  • Cyclomatic Complexity · ChatImportApplier.apply (cyclomatic 49) Packages/OsaurusCore/Services/ChatImport/ChatImportApplier.swift
  • Cyclomatic Complexity · OpenAPISummary.parse (cyclomatic 49) Packages/OsaurusCore/Tools/Workflow/WorkflowDiscoverTool.swift
  • Cyclomatic Complexity · WorkflowDraftPatcher.apply (cyclomatic 47) Packages/OsaurusCore/Models/Workflow/WorkflowDraft.swift
  • Cyclomatic Complexity · WorkspaceAuditRow.title (cyclomatic 43) Packages/OsaurusCore/Views/Workspaces/WorkspaceAuditView.swift
  • Cyclomatic Complexity · WorkflowValidator.mediaIssues (cyclomatic 42) Packages/OsaurusCore/Models/Workflow/WorkflowValidator.swift
  • Cyclomatic Complexity · DiscoveryCenter.take (cyclomatic 42) Packages/OsaurusCore/Services/Onboarding/DiscoveryCenter.swift
  • Cyclomatic Complexity · WorkflowCondition.evaluate (cyclomatic 41) Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift
  • Cyclomatic Complexity · JSONSchemaValidator.check (cyclomatic 40) Packages/OsaurusCore/Models/Workflow/JSONSchemaValidator.swift
  • Cyclomatic Complexity · ShellCommandRiskScanner.parse (cyclomatic 39) Packages/OsaurusCore/Tools/ShellCommandRiskScanner.swift
  • Cyclomatic Complexity · OsaurusConfigTool.applyDocument (cyclomatic 38) Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool.swift
  • Cyclomatic Complexity · SyncHostRunner.process (cyclomatic 38) Packages/OsaurusCore/Services/Sync/SyncHostRunner.swift
  • Cyclomatic Complexity · AssignedNativeMenuItems.body (cyclomatic 38) Packages/OsaurusCore/Models/Theme/InspectionAdapters/AssignedMenuPresentation.swift
  • Cyclomatic Complexity · CatalogAssignmentMenu.allows (cyclomatic 37) Packages/OsaurusCore/Models/Theme/DesignLibrary/CatalogPreviewInspection.swift
  • Cyclomatic Complexity · CatalogLibraryFixture.chatContent (cyclomatic 36) Packages/OsaurusCore/DevelopmentDesign/CatalogComponents.swift
  • Cyclomatic Complexity · ShellCommandRiskScanner.downloadSources (cyclomatic 34) Packages/OsaurusCore/Tools/ShellCommandRiskScanner.swift
  • Cyclomatic Complexity · WorkflowNodeEditor.form (cyclomatic 34) Packages/OsaurusCore/Views/Workflow/Architect/WorkflowNodeEditor.swift
  • Cyclomatic Complexity · RetainedToolResultStore.read (cyclomatic 33) Packages/OsaurusCore/Storage/RetainedToolResultStore.swift
  • Cyclomatic Complexity · FloatingInputCard.normalBody (cyclomatic 33) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift
  • Cyclomatic Complexity · EventEditorSheet.build (cyclomatic 33) Packages/OsaurusCore/Views/Event/EventEditorSheet.swift
  • Cyclomatic Complexity · LanguageCatalogSource.item (cyclomatic 33) Packages/OsaurusCore/Views/Model/Catalog/LanguageCatalogSource.swift
  • Cyclomatic Complexity · WorkflowFlowCanvas.draw (cyclomatic 33) Packages/OsaurusCore/Views/Workflow/FlowViewer/WorkflowFlowCanvas.swift
  • Cyclomatic Complexity · DiscoveryCatalog.status (cyclomatic 32) Packages/OsaurusCore/Services/Onboarding/DiscoveryCatalog.swift
  • Cyclomatic Complexity · NativeToolCallRowView.applyAssignedLayout (cyclomatic 32) Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift
  • Cyclomatic Complexity · WorkflowValidator.validate (cyclomatic 31) Packages/OsaurusCore/Models/Workflow/WorkflowValidator.swift
  • Cyclomatic Complexity · DiscoveryCenter.step (cyclomatic 31) Packages/OsaurusCore/Services/Onboarding/DiscoveryCenter.swift
  • Cyclomatic Complexity · CatalogElementAssignments.extendMappings (cyclomatic 31) Packages/OsaurusCore/Models/Theme/DesignLibrary/CatalogElementAssignments.swift
  • Cyclomatic Complexity · XMLFeedReader.parser (cyclomatic 31) Packages/OsaurusCore/Services/Event/Feed/FeedParser.swift
  • Cyclomatic Complexity · EvalRunner.runArchitectCase (cyclomatic 29) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerWorkflow.swift
  • Cyclomatic Complexity · ChatImportVerifier.verify (cyclomatic 29) Packages/OsaurusCore/Services/ChatImport/ChatImportVerifier.swift
  • Cyclomatic Complexity · WorkflowEvalHarness.structureChecks (cyclomatic 29) Packages/OsaurusCore/Services/Workflow/WorkflowEvalHarness.swift
  • Cyclomatic Complexity · RunWorkflowTool.execute (cyclomatic 29) Packages/OsaurusCore/Tools/Workflow/WorkflowTools.swift
  • Cyclomatic Complexity · WorkflowTestTool.runExamples (cyclomatic 28) Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift
  • Cyclomatic Complexity · AssignedPickerHostingView.applyRecipe::visit (cyclomatic 28) Packages/OsaurusCore/Models/Theme/InspectionAdapters/AssignedNativePicker.swift
  • Cyclomatic Complexity · ChatImportMCPBuilder.item (cyclomatic 27) Packages/OsaurusCore/Services/ChatImport/ChatImportFastPaths.swift
  • Cyclomatic Complexity · SyncConversationMapper.fitTurnObject (cyclomatic 27) Packages/OsaurusCore/Services/Sync/SyncConversationMapper.swift
  • Cyclomatic Complexity · SyncConversationStore.saveTurns (cyclomatic 27) Packages/OsaurusCore/Services/Sync/SyncConversationStore.swift
  • Cyclomatic Complexity · HTTPNodeExecutor.paginated (cyclomatic 27) Packages/OsaurusCore/Services/Workflow/HTTPNodeExecutor.swift
  • Cyclomatic Complexity · WorkflowRunView.nodeRow (cyclomatic 27) Packages/OsaurusCore/Views/Workflow/WorkflowRunView.swift
  • Cyclomatic Complexity · LocalModelsCatalogPage.body (cyclomatic 27) Packages/OsaurusCore/Views/Model/Catalog/LocalModelsCatalogPage.swift
  • Cyclomatic Complexity · DesignMessageChecks.run (cyclomatic 26) Packages/OsaurusCore/DevelopmentDesign/DesignMessageChecks.swift
  • Cyclomatic Complexity · ConfigEvents.export (cyclomatic 26) Packages/OsaurusCore/Configuration/Declarative/ConfigEvents.swift
  • Cyclomatic Complexity · OsaurusImportTool.execute (cyclomatic 26) Packages/OsaurusCore/Configuration/Declarative/OsaurusImportTool.swift
  • Cyclomatic Complexity · WorkflowDraftOp.parseConnection (cyclomatic 26) Packages/OsaurusCore/Models/Workflow/WorkflowDraft.swift
  • Cyclomatic Complexity · AgentDraftTool.queueImport (cyclomatic 26) Packages/OsaurusCore/Tools/Agent/AgentDraftTool.swift
  • Cyclomatic Complexity · ChatSession.compactBeforeToolContinuation (cyclomatic 26) Packages/OsaurusCore/Views/Chat/ChatView.swift
  • Cyclomatic Complexity · LanguageModelCatalog.makeLists (cyclomatic 26) Packages/OsaurusCore/Views/Model/Catalog/LanguageCatalogSource.swift
  • Cyclomatic Complexity · ConfigApplier.patch (cyclomatic 25) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift
  • Cyclomatic Complexity · ConfigDiff.merge (cyclomatic 25) Packages/OsaurusCore/Configuration/Declarative/ConfigDiff.swift
  • Cyclomatic Complexity · OsaurusConfigDocument.translatingLegacyEvents (cyclomatic 25) Packages/OsaurusCore/Configuration/Declarative/ConfigEvents.swift
  • Cyclomatic Complexity · WorkflowRunner.runMap (cyclomatic 25) Packages/OsaurusCore/Services/Workflow/WorkflowRunner.swift
  • Cyclomatic Complexity · HTTPHandler.workspaceKeyMayReach (cyclomatic 24) Packages/OsaurusCore/Networking/HTTPHandler.swift
  • Cyclomatic Complexity · ChatSessionData.sameListRow (cyclomatic 24) Packages/OsaurusCore/Models/Chat/ChatSessionData.swift
  • Cyclomatic Complexity · WebhookHandshakeResponder.respond (cyclomatic 24) Packages/OsaurusCore/Services/Event/WebhookProviderProfile.swift
  • Cyclomatic Complexity · OnboardingFirstRun.perform (cyclomatic 24) Packages/OsaurusCore/Services/Onboarding/OnboardingFirstRun.swift
  • Cyclomatic Complexity · OnboardingFirstRun.explore (cyclomatic 24) Packages/OsaurusCore/Services/Onboarding/OnboardingFirstRun.swift
  • Cyclomatic Complexity · MediaNodeExecutor.runLocal (cyclomatic 24) Packages/OsaurusCore/Services/Workflow/MediaNodeExecutor.swift
  • Cyclomatic Complexity · WorkflowTestTool.execute (cyclomatic 24) Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift
  • Cyclomatic Complexity · SessionRow.navigatorRow (cyclomatic 24) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift
  • Cyclomatic Complexity · WorkflowRunView.details (cyclomatic 24) Packages/OsaurusCore/Views/Workflow/WorkflowRunView.swift
  • Cyclomatic Complexity · CatalogPreviewInspection.label (cyclomatic 24) Packages/OsaurusCore/Models/Theme/DesignLibrary/CatalogPreviewInspection.swift
  • Cyclomatic Complexity · LoginWithOsaurusRequest.parse (cyclomatic 24) Packages/OsaurusCore/Services/Auth/LoginWithOsaurus/LoginWithOsaurusRequest.swift
  • Cyclomatic Complexity · CatalogLibraryFixture.body (cyclomatic 23) Packages/OsaurusCore/DevelopmentDesign/CatalogComponents.swift
  • Cyclomatic Complexity · ModelRuntime.makeMLXChatMessages (cyclomatic 23) Packages/OsaurusCore/Services/ModelRuntime.swift
  • Cyclomatic Complexity · ToolApprovalPresentation.guarantees (cyclomatic 23) Packages/OsaurusCore/Models/Tool/ToolApprovalPresentation.swift
  • Cyclomatic Complexity · WorkflowNode.effectiveOutputSchema (cyclomatic 23) Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift
  • Cyclomatic Complexity · OwnerApprovalService.request (cyclomatic 23) Packages/OsaurusCore/Services/Attention/OwnerApprovalService.swift
  • Cyclomatic Complexity · ChatImportRepoWalker.collect (cyclomatic 23) Packages/OsaurusCore/Services/ChatImport/ChatImportSourceResolver.swift
  • Cyclomatic Complexity · MediaModelCandidate.constraintsSummary (cyclomatic 23) Packages/OsaurusCore/Services/Workflow/MediaModelResolver.swift
  • Cyclomatic Complexity · WorkflowRunsTool.nodeDetail (cyclomatic 23) Packages/OsaurusCore/Tools/Workflow/WorkflowRunsTool.swift
  • Cyclomatic Complexity · NativeThinkingView.applyAssignedLayout (cyclomatic 23) Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift
  • Cyclomatic Complexity · TerminalDisplayView.applyTheme (cyclomatic 23) Packages/OsaurusCore/Views/Chat/TerminalDisplayView.swift
  • Cyclomatic Complexity · SettingsFieldRow.body (cyclomatic 23) Packages/OsaurusCore/Views/DesignSystem/SettingsFields.swift
  • Cyclomatic Complexity · WorkflowNodeEditor.fromFields (cyclomatic 23) Packages/OsaurusCore/Views/Workflow/Architect/WorkflowNodeEditor.swift
  • Cyclomatic Complexity · InspectorMessageExamples.make (cyclomatic 22) Packages/OsaurusCore/DevelopmentDesign/InspectorMessageConfigurations.swift
  • Cyclomatic Complexity · Template.merge (cyclomatic 22) Packages/OsaurusCore/Models/Template/Template+Agent.swift
  • Cyclomatic Complexity · AssignedBaseToggleStyle.makeBody (cyclomatic 22) Packages/OsaurusCore/Models/Theme/BaseComponentAssignments.swift
  • Cyclomatic Complexity · BindingRenderer.parse (cyclomatic 22) Packages/OsaurusCore/Models/Workflow/BindingRenderer.swift
  • Cyclomatic Complexity · ContextCompactionService.compactionCutIndex (cyclomatic 22) Packages/OsaurusCore/Services/Chat/ContextCompactionService.swift
  • Cyclomatic Complexity · ChannelDialogRelay.interpret (cyclomatic 22) Packages/OsaurusCore/Services/Event/ChannelDialogRelay.swift
  • Cyclomatic Complexity · SetupChecker.check (cyclomatic 22) Packages/OsaurusCore/Services/Template/SetupChecker.swift
  • Cyclomatic Complexity · MediaNodeExecutor.describe (cyclomatic 22) Packages/OsaurusCore/Services/Workflow/MediaNodeExecutor.swift
  • Cyclomatic Complexity · ReplyNodeExecutor.run (cyclomatic 22) Packages/OsaurusCore/Services/Workflow/ReplyNodeExecutor.swift
  • Cyclomatic Complexity · ToolNodeExecutor.run (cyclomatic 22) Packages/OsaurusCore/Services/Workflow/ToolNodeExecutor.swift
  • Cyclomatic Complexity · WorkflowEvalHarness.runArchitect (cyclomatic 22) Packages/OsaurusCore/Services/Workflow/WorkflowEvalHarness.swift
  • Cyclomatic Complexity · WorkflowEvalHarness.scoreArchitect (cyclomatic 22) Packages/OsaurusCore/Services/Workflow/WorkflowEvalHarness.swift
  • Cyclomatic Complexity · WorkflowTestTool.summary (cyclomatic 22) Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift
  • Cyclomatic Complexity · SettingsTextField.body (cyclomatic 22) Packages/OsaurusCore/Views/DesignSystem/SettingsFields.swift
  • Cyclomatic Complexity · WorkflowMediaGalleryModel.settingsLines (cyclomatic 22) Packages/OsaurusCore/Views/Workflow/WorkflowMediaGallery.swift

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

Fixed since the last survey: 1680 findings

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

  • Cyclomatic Complexity · AgentToolLoop.run (cyclomatic 155) Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift
  • Cyclomatic Complexity · SubagentSession.runPrepared (cyclomatic 124) Packages/OsaurusCore/Subagent/SubagentSession.swift
  • Cyclomatic Complexity · pi-harness-runner.runCase (cyclomatic 59) scripts/evals/pi-harness-runner.mjs
  • Cyclomatic Complexity · OsaurusConfigTool.handleApply (cyclomatic 40) Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool.swift
  • Cyclomatic Complexity · FloatingInputCard.body (cyclomatic 40) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift
  • Cyclomatic Complexity · HTTPHandler.handlePairEndpoint (cyclomatic 27) Packages/OsaurusCore/Networking/HTTPHandler.swift
  • Cyclomatic Complexity · PluginCard.body (cyclomatic 27) Packages/OsaurusCore/Views/Plugin/PluginsView.swift
  • Cyclomatic Complexity · apply-ko.main (cyclomatic 27) scripts/i18n/apply-ko.py
  • Cyclomatic Complexity · run-local-family-multiturn-tool-cache-proof.cache_evidence_checks (cyclomatic 27) scripts/live-proof/run-local-family-multiturn-tool-cache-proof.py
  • Cyclomatic Complexity · run-post1266-family-cache-tool-matrix.cache_counters (cyclomatic 27) scripts/live-proof/run-post1266-family-cache-tool-matrix.py
  • Cyclomatic Complexity · HTTPHandler.handleModelOptionsEndpoint (cyclomatic 26) Packages/OsaurusCore/Networking/HTTPHandler.swift
  • Cyclomatic Complexity · ChatHistoryDatabase.contentHash (cyclomatic 25) Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift
  • Cyclomatic Complexity · ModelRuntime.mapOpenAIChatToMLX (cyclomatic 23) Packages/OsaurusCore/Services/ModelRuntime.swift
  • Cyclomatic Complexity · WatcherManager.processCurrentState (cyclomatic 21) Packages/OsaurusCore/Managers/WatcherManager.swift
  • Cyclomatic Complexity · HTTPHandler.handleModelPickerEndpoint (cyclomatic 21) Packages/OsaurusCore/Networking/HTTPHandler.swift
  • Cyclomatic Complexity · PluginDetailView.heroHeader (cyclomatic 21) Packages/OsaurusCore/Views/Plugin/PluginsView.swift
  • Cyclomatic Complexity · ToolPermissionView.body (cyclomatic 21) Packages/OsaurusCore/Views/Plugin/ToolPermissionView.swift
  • Cyclomatic Complexity · ProviderCardView.body (cyclomatic 21) Packages/OsaurusCore/Views/Settings/RemoteProvidersView.swift
  • Cyclomatic Complexity · ConfigApplier.applyWatchers (cyclomatic 20) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift
  • Cyclomatic Complexity · FileChangeJournal.importLegacyIfNeeded (cyclomatic 20) Packages/OsaurusCore/Services/FileHistory/FileChangeJournal.swift
  • Cyclomatic Complexity · SkillRow.body (cyclomatic 20) Packages/OsaurusCore/Views/Skill/SkillsView.swift
  • Cyclomatic Complexity · plan-installed-vision.metadata (cyclomatic 20) scripts/evals/plan-installed-vision.py
  • Cyclomatic Complexity · ContextBreakdownPopover.color (cyclomatic 19) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift
  • Cyclomatic Complexity · FloatingCreditsChip.body (cyclomatic 19) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift
  • Cyclomatic Complexity · lint-zh-style.main (cyclomatic 19) scripts/i18n/lint-zh-style.py
  • Cyclomatic Complexity · run-local-family-chat-tool-proof.run (cyclomatic 19) scripts/live-proof/run-local-family-chat-tool-proof.py
  • Cyclomatic Complexity · ChatHistoryWriter.persist (cyclomatic 18) Packages/OsaurusCore/Storage/ChatHistoryWriter.swift
  • Cyclomatic Complexity · ConfigApplier.applySchedules (cyclomatic 18) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift
  • Cyclomatic Complexity · WorkspaceSyncService.receive (cyclomatic 18) Packages/OsaurusCore/Services/Router/WorkspaceSyncService.swift
  • Cyclomatic Complexity · AgentCard.body (cyclomatic 18) Packages/OsaurusCore/Views/Agent/AgentsView.swift
  • Cyclomatic Complexity · AgentSidebarRow.body (cyclomatic 17) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift
  • Cyclomatic Complexity · SettingsEmptyState.body (cyclomatic 17) Packages/OsaurusCore/Views/Common/SettingsEmptyState.swift
  • Cyclomatic Complexity · SystemPermissionRow.body (cyclomatic 17) Packages/OsaurusCore/Views/Settings/PermissionsView.swift
  • Cyclomatic Complexity · plan-installed-vision.main (cyclomatic 17) scripts/evals/plan-installed-vision.py
  • Cyclomatic Complexity · SandboxExecTool.execute (cyclomatic 16) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift
  • Cyclomatic Complexity · ConfigPlanner.validatePruneAgentReferences (cyclomatic 16) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift
  • Cyclomatic Complexity · AgentChannelDispatchRouter.resolve (cyclomatic 16) Packages/OsaurusCore/Services/AgentChannel/AgentChannelDispatchRouter.swift
  • Cyclomatic Complexity · DiscordConnectionService.diagnostics (cyclomatic 16) Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift
  • Cyclomatic Complexity · NativeArtifactCardView.minimumHeightWithFooterChrome (cyclomatic 16) Packages/OsaurusCore/Views/Chat/NativeArtifactCardView.swift
  • Cyclomatic Complexity · CreditsView.webSearchCard (cyclomatic 16) Packages/OsaurusCore/Views/Credits/CreditsView.swift
  • Cyclomatic Complexity · ModelDownloadView.body (cyclomatic 16) Packages/OsaurusCore/Views/Model/ModelDownloadView.swift
  • Cyclomatic Complexity · ModelDownloadView.makeGridLists::applySort (cyclomatic 16) Packages/OsaurusCore/Views/Model/ModelDownloadView.swift
  • Cyclomatic Complexity · PluginDetailView.body (cyclomatic 16) Packages/OsaurusCore/Views/Plugin/PluginsView.swift
  • Cyclomatic Complexity · AgentChannelConnectionCenterView.applyNativeBadges (cyclomatic 16) Packages/OsaurusCore/Views/Settings/AgentChannelConnectionCenterView.swift
  • Cyclomatic Complexity · VADModeSettingsTab.testAreaCard (cyclomatic 16) Packages/OsaurusCore/Views/Voice/VADModeSettingsTab.swift
  • Cyclomatic Complexity · AgentTemplateCard.body (cyclomatic 16) Packages/OsaurusCore/Views/Agent/Templates/AgentTemplateCard.swift
  • Cognitive Complexity · AgentToolLoop.run (cognitive 411) Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift
  • Cognitive Complexity · SubagentSession.runPrepared (cognitive 292) Packages/OsaurusCore/Subagent/SubagentSession.swift
  • Cognitive Complexity · pi-harness-runner.runCase (cognitive 73) scripts/evals/pi-harness-runner.mjs
  • Cognitive Complexity · apply-ko.main (cognitive 65) scripts/i18n/apply-ko.py
  • Cognitive Complexity · FloatingInputCard.body (cognitive 48) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift
  • Cognitive Complexity · OsaurusConfigTool.handleApply (cognitive 46) Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool.swift
  • Cognitive Complexity · ModelDownloadView.makeGridLists (cognitive 45) Packages/OsaurusCore/Views/Model/ModelDownloadView.swift
  • Cognitive Complexity · ConfigApplier.applyWatchers (cognitive 43) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift
  • Cognitive Complexity · FileChangeJournal.importLegacyIfNeeded (cognitive 41) Packages/OsaurusCore/Services/FileHistory/FileChangeJournal.swift
  • Cognitive Complexity · WatcherManager.processCurrentState (cognitive 36) Packages/OsaurusCore/Managers/WatcherManager.swift
  • Cognitive Complexity · ConfigApplier.applySchedules (cognitive 36) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift
  • Cognitive Complexity · SkillRow.body (cognitive 32) Packages/OsaurusCore/Views/Skill/SkillsView.swift
  • Cognitive Complexity · check-swift-catalog-keys.referenced_keys (cognitive 32) scripts/i18n/check-swift-catalog-keys.py
  • Cognitive Complexity · HTTPHandler.handleModelOptionsEndpoint (cognitive 31) Packages/OsaurusCore/Networking/HTTPHandler.swift
  • Cognitive Complexity · ConfigPlanner.planSchedules (cognitive 31) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift
  • Cognitive Complexity · TokenizerBridge.normalizeChatTemplateSchemaValue (cognitive 31) Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.swift
  • Cognitive Complexity · PluginCard.body (cognitive 30) Packages/OsaurusCore/Views/Plugin/PluginsView.swift
  • Cognitive Complexity · ToolPermissionView.body (cognitive 30) Packages/OsaurusCore/Views/Plugin/ToolPermissionView.swift
  • Cognitive Complexity · plan-installed-vision.metadata (cognitive 30) scripts/evals/plan-installed-vision.py
  • Cognitive Complexity · ModelRuntime.mapOpenAIChatToMLX (cognitive 29) Packages/OsaurusCore/Services/ModelRuntime.swift
  • Cognitive Complexity · PluginDetailView.heroHeader (cognitive 28) Packages/OsaurusCore/Views/Plugin/PluginsView.swift
  • Cognitive Complexity · lint-zh-style.main (cognitive 28) scripts/i18n/lint-zh-style.py
  • Cognitive Complexity · HTTPHandler.handlePairEndpoint (cognitive 27) Packages/OsaurusCore/Networking/HTTPHandler.swift
  • Cognitive Complexity · ConfigPlanner.validatePruneAgentReferences (cognitive 27) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift
  • Cognitive Complexity · ConfigPlanner.planWatchers (cognitive 27) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift
  • Cognitive Complexity · run-post1266-family-cache-tool-matrix.cache_counters (cognitive 27) scripts/live-proof/run-post1266-family-cache-tool-matrix.py
  • Cognitive Complexity · vision-bundle-evidence.inspect (cognitive 26) scripts/diagnostics/vision-bundle-evidence.py
  • Cognitive Complexity · plan-installed-vision.main (cognitive 26) scripts/evals/plan-installed-vision.py
  • Cognitive Complexity · PluginCard.cardMenu (cognitive 25) Packages/OsaurusCore/Views/Plugin/PluginsView.swift
  • Cognitive Complexity · HuggingFaceService.fetchTree (cognitive 24) Packages/OsaurusCore/Services/HuggingFaceService.swift
  • Cognitive Complexity · ChatHistoryDatabase.contentHash (cognitive 24) Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift
  • Cognitive Complexity · JSONValue.normalizedChatTemplateSchemaValue (cognitive 24) Packages/OsaurusCore/Models/API/OpenAIAPI.swift
  • Cognitive Complexity · PluginConfigView.statusField (cognitive 24) Packages/OsaurusCore/Views/Plugin/PluginConfigView.swift
  • Cognitive Complexity · SystemPermissionRow.body (cognitive 24) Packages/OsaurusCore/Views/Settings/PermissionsView.swift
  • Cognitive Complexity · AgentChannelDispatchRouter.resolve (cognitive 23) Packages/OsaurusCore/Services/AgentChannel/AgentChannelDispatchRouter.swift
  • Cognitive Complexity · ProviderCardView.body (cognitive 23) Packages/OsaurusCore/Views/Settings/RemoteProvidersView.swift
  • Cognitive Complexity · BackgroundTaskManager.markCompleted (cognitive 22) Packages/OsaurusCore/Managers/BackgroundTaskManager.swift
  • Cognitive Complexity · StorageMigrationCoordinator.convergeBlobs (cognitive 22) Packages/OsaurusCore/Storage/StorageMigrationCoordinator.swift
  • Cognitive Complexity · FloatingCreditsChip.body (cognitive 22) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift
  • Cognitive Complexity · SettingsEmptyState.body (cognitive 22) Packages/OsaurusCore/Views/Common/SettingsEmptyState.swift
  • Cognitive Complexity · leaderboard.locale_value_map (cognitive 22) scripts/i18n/leaderboard.py
  • Cognitive Complexity · PluginConfigView.loadConfig (cognitive 21) Packages/OsaurusCore/Views/Plugin/PluginConfigView.swift
  • Cognitive Complexity · run-local-family-multiturn-tool-cache-proof.cache_evidence_checks (cognitive 21) scripts/live-proof/run-local-family-multiturn-tool-cache-proof.py
  • Cognitive Complexity · SandboxExecTool.execute (cognitive 20) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift
  • Cognitive Complexity · AgentSidebarRow.body (cognitive 20) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift
  • Cognitive Complexity · leaderboard.pr_translated_keys (cognitive 20) scripts/i18n/leaderboard.py
  • Cognitive Complexity · HTTPHandler.handleModelPickerEndpoint (cognitive 19) Packages/OsaurusCore/Networking/HTTPHandler.swift
  • Cognitive Complexity · AgentCard.body (cognitive 19) Packages/OsaurusCore/Views/Agent/AgentsView.swift
  • Cognitive Complexity · ContextBreakdownPopover.color (cognitive 19) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift
  • Cognitive Complexity · ImageGenerationPanelView.advancedParams (cognitive 19) Packages/OsaurusCore/Views/Model/ImageGenerationPanelView.swift
  • Cognitive Complexity · applescript_capability_scoreboard.build_scoreboard (cognitive 19) scripts/evals/applescript_capability_scoreboard.py
  • Cognitive Complexity · check-swift-catalog-keys.split_interp (cognitive 19) scripts/i18n/check-swift-catalog-keys.py
  • Cognitive Complexity · export-untranslated.main (cognitive 19) scripts/i18n/export-untranslated.py
  • Cognitive Complexity · ChatHistoryDatabase.loadFileChangeSets (cognitive 18) Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift
Rebuild cost: about €1,000,000 · Estimate
Cost to rebuild€340,000 to €1,700,000, for 5,662 to 17,963 hours of work, about 7.0 person-years for 4 to 14 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 36. 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.
SizeVery large: 831,801 lines of product code
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

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

Top priorities

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

1
Replace the synchronous wait with `async`/`await` so the handler never blocks on a peer/resource.
Raises the score by about 22 points · Medium effort · Handler temporal coupling
2
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 `?`).
Raises the score by about 2 points · Medium effort · Nullable reference types
3
Resolve the 1 Assertions commented out finding(s) in Test Quality — start with osaurusUITests.swift.
Raises the score by about 0.9 points · Low effort · Test Quality

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 €1,000,000 to build again, about 7.0 person-years of work. Its weakest lens is Event-Driven, at 10 (Critical). Event-Driven is about whether the parts of the system can rely on the messages they send each other. Because the weakest lens counts most in the score, work on Event-Driven also moves the score most.
Based on: the rebuild estimate · the Event-Driven grade · how much each lens counts
What to do: Start with the Event-Driven actions in Top priorities.
If you do one thing first · First action
Replace the synchronous wait with `async`/`await` so the handler never blocks on a peer/resource. Of all the actions in this report, it raises the score most for the work it takes: about 22 points for medium effort. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 5.9 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 5% to 12% on every change. The history of the code shows how much it changes: about 884,874 lines over the last 90 days, which is about 3,588,656 lines a year. At that pace, the extra work comes to an estimated 462 to 2772.1 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture — module dependency graph

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

arch OsaurusCLI OsaurusCLI OsaurusCLICore OsaurusCLICore OsaurusCLI->OsaurusCLICore OsaurusRepository OsaurusRepository OsaurusCLICore->OsaurusRepository OsaurusCore OsaurusCore OsaurusNetworking OsaurusNetworking OsaurusCore->OsaurusNetworking OsaurusObjCSupport OsaurusObjCSupport OsaurusCore->OsaurusObjCSupport OsaurusCore->OsaurusRepository OsaurusSQLCipher OsaurusSQLCipher OsaurusCore->OsaurusSQLCipher OsaurusEvalsCLI OsaurusEvalsCLI OsaurusEvalsKit OsaurusEvalsKit OsaurusEvalsCLI->OsaurusEvalsKit OsaurusEvalsKit->OsaurusCore OsaurusRepository->OsaurusNetworking OsaurusStatsPack OsaurusStatsPack OsaurusStatsPack->OsaurusCore github.com/osaurus-ai/osaurus/helpers/osaurus-wa osaurus-wa osaurus osaurus osaurus->OsaurusCore osaurus-js-host osaurus-js-host osaurus-plugin-host osaurus-plugin-host

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.

21 modules, with 18 dependencies between them. One loop runs through 4 of the modules, marked above the diagonal.

Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
uses →1 Packages.OsaurusCore.Resources.Harness2 Packages~OsaurusCLI~OsaurusCLI3 docs.internal.evidence.2026-08-30-inference-activity-ownership4 docs.runtime.fetch-compaction-2026-11-065 github.com/osaurus-ai/osaurus/helpers/osaurus-wa6 scripts.ci7 scripts.claude-marketplace8 scripts.design-handoff9 scripts.diagnostics10 scripts.evals11 scripts.i18n12 scripts.live-proof13 scripts.release14 scripts.release.release_lane15 Packages~OsaurusNetworking16 repository17 Packages~Vendor~OsaurusSync~OsaurusSync18 Packages~OsaurusCLI~OsaurusCLICore19 Packages~OsaurusPlugins~StatsPack~OsaurusStatsPack20 Packages~OsaurusEvals~OsaurusEvalsKit21 Packages~OsaurusEvals~OsaurusEvalsCLI
1 Packages.OsaurusCore.Resources.Harness
2 Packages~OsaurusCLI~OsaurusCLI
3 docs.internal.evidence.2026-08-30-inference-activity-ownership
4 docs.runtime.fetch-compaction-2026-11-06
5 github.com/osaurus-ai/osaurus/helpers/osaurus-wa
6 scripts.ci
7 scripts.claude-marketplace
8 scripts.design-handoff
9 scripts.diagnostics
10 scripts.evals
11 scripts.i18n
12 scripts.live-proof
13 scripts.release
14 scripts.release.release_lane
15 Packages~OsaurusNetworking51
16 repository23043218
17 Packages~Vendor~OsaurusSync~OsaurusSync6923
18 Packages~OsaurusCLI~OsaurusCLICore1571
19 Packages~OsaurusPlugins~StatsPack~OsaurusStatsPack331
20 Packages~OsaurusEvals~OsaurusEvalsKit392595
21 Packages~OsaurusEvals~OsaurusEvalsCLI191419
Uses a module listed above itPart of a loopThe module itself
1 Packages.OsaurusCore.Resources.Harness2 Packages~OsaurusCLI~OsaurusCLI3 docs.internal.evidence.2026-08-30-inference-activity-ownership4 docs.runtime.fetch-compaction-2026-11-065 github.com/osaurus-ai/osaurus/helpers/osaurus-wa6 scripts.ci7 scripts.claude-marketplace8 scripts.design-handoff9 scripts.diagnostics10 scripts.evals11 scripts.i18n12 scripts.live-proof13 scripts.release14 scripts.release.release_lane15 Packages~OsaurusNetworking16 repository17 Packages~Vendor~OsaurusSync~OsaurusSync18 Packages~OsaurusCLI~OsaurusCLICore19 Packages~OsaurusPlugins~StatsPack~OsaurusStatsPack20 Packages~OsaurusEvals~OsaurusEvalsKit21 Packages~OsaurusEvals~OsaurusEvalsCLIPackages.OsaurusCore.Resources.Harness1Packages~OsaurusCLI~OsaurusCLI2docs.internal.evidence.2026-08-30-inference-activity-ownership3docs.runtime.fetch-compaction-2026-11-064github.com/osaurus-ai/osaurus/helpers/osaurus-wa5scripts.ci6scripts.claude-marketplace7scripts.design-handoff8scripts.diagnostics9scripts.evals10scripts.i18n11scripts.live-proof12scripts.release13scripts.release.release_lane14Packages~OsaurusNetworking15repository16Packages~Vendor~OsaurusSync~OsaurusSync17Packages~OsaurusCLI~OsaurusCLICore18Packages~OsaurusPlugins~StatsPack~OsaurusStatsPack19Packages~OsaurusEvals~OsaurusEvalsKit20Packages~OsaurusEvals~OsaurusEvalsCLI21512304321869231571331392595191419

At a glance — Code Health · 52% · Adequate · gated by D2, X5 ·

At a glance — Architecture · 92% · Exemplary ·

At a glance — Maturity · 85% · Strong ·

At a glance — Readiness · 58% · Adequate · gated by P3 ·

At a glance — Security · 54% · Adequate · gated by D28, D36 ·

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

At a glance — Event-Driven · 10% · Critical · gated by ED1 ·

At a glance — Performance · 60% · Adequate ·

Security & Compliance — OWASP Top-10 mapping

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

OWASP categoryFindingsSeverity
A07:2025 — Authentication Failures357High / Critical
A05:2025 — Injection50High / Critical
A03:2025 — Software Supply Chain Failures15High / Critical
A02:2025 — Security Misconfiguration1Medium

Roadmap

Top priorities: Replace the synchronous wait with `async`/`await` so the handler never blocks on a peer/resource; 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 `?`); 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.

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

Do thisHelpsEffortDimension
Replace the synchronous wait with `async`/`await` so the handler never blocks on a peer/resource.+21.5 ptsMediumHandler temporal coupling
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 `?`).+1.9 ptsMediumNullable reference types
Resolve the 1 Assertions commented out finding(s) in Test Quality — start with osaurusUITests.swift.+0.9 ptsLowTest Quality
Resolve the 1 No assertions (empty test) finding(s) in Test Quality — start with ModelRuntimePrefixTests.swift.+0.9 ptsLowTest Quality
Resolve the 1 Test project verifies nothing finding(s) in Test Quality — start with osaurusUITests.swift.+0.9 ptsLowTest Quality
Resolve the 1 REDACTED finding(s) in Vulnerability-disclosure Policy — start with REDACTED.+0.8 ptsLowVulnerability-disclosure Policy
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.+1.3 ptsMediumAsync & latency hygiene
Swallowed exception (caught, then discarded)+1.1 ptsMediumException handling

File quality

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

FileScoreBandWorst signal
REDACTED2.0SlopSecrets (history): REDACTED: REDACTED
REDACTED3.5SlopDependency Vulnerabilities: High CVE: REDACTED
REDACTED4.1MixedDependency Vulnerabilities: High CVE: REDACTED
REDACTED4.4MixedSecrets (history): REDACTED: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.5MixedStatic Analysis (SAST): High: REDACTED
Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift4.8MixedCyclomatic Complexity: NativeCellHeightEstimator.estimatedHeight (cyclomatic 73)
Packages/OsaurusCore/Views/Chat/NativeBlockViews.swift4.8MixedCyclomatic Complexity: NativeMarkdownTableView.updateCells (cyclomatic 20)
App/osaurusUITests/osaurusUITests.swift4.8MixedTest Quality: Assertions commented out: testExample
Packages/OsaurusCore/AppDelegate.swift5.5MixedCyclomatic Complexity: AppDelegate.applicationDidFinishLaunching (cyclomatic 61)
Packages/OsaurusCore/Services/ModelRuntime/MLXBatchAdapter.swift5.5MixedCyclomatic Complexity: MLXBatchAdapter.additionalContext (cyclomatic 60)
Packages/OsaurusRepository/BoundedArchiveExtractor.swift5.5MixedCyclomatic Complexity: BoundedArchiveExtractor.inspect (cyclomatic 53)
Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift5.5MixedCyclomatic Complexity: PluginHostContext.completeStream (cyclomatic 42)
Packages/OsaurusCore/Views/Chat/SelectableTextView.swift5.5MixedCyclomatic Complexity: SelectableTextView.applyThemeStyling (cyclomatic 25)
Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift5.5MixedCyclomatic Complexity: IMessageConnectionService.diagnostics (cyclomatic 21)
Packages/OsaurusCore/Models/Chat/ResponseWriters.swift5.5MixedCyclomatic Complexity: OpenResponsesSSEWriter.writeProviderEvent (cyclomatic 20)
Packages/OsaurusCore/Managers/SkillManager.swift5.5MixedCognitive Complexity: SkillManager.loadReferenceContents (cognitive 18)
Packages/OsaurusCore/Managers/SpeechService.swift5.5MixedCyclomatic Complexity: SpeechService.startStreamingTranscription (cyclomatic 26)
Packages/OsaurusCore/Services/AgentBridge/LocalAgentBridge.swift5.5MixedCyclomatic Complexity: LocalAgentBridge.scheduleNextRun (cyclomatic 25)

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

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

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

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

Could not be resolved — 21

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

Methodology & how to trust this report

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

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

What we checked — 54 dimensions across the health lenses
D1D2D3D4D5D6D7D10D12D13D14D15D16D17D19D20D21D26D27D28D29D30D31D34D35D36D37D43D44AX10AX3AX4AX8AX9DM4DM5DM6ED1M1M2M3M4P1P10P2P3P4P6PF3X14X26X28X3X5

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

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

Tools & methods

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

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

Every finding is locatable in findings.md. Run 01a1d96c-f8b7-7fb5-a6bb-a0cda20cbf96.

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.

  • D4 Code Duplication — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 1376 duplicated block group(s) on this row were found in the languages this pass could tokenize, and they do NOT cover all of this repository's production source: .c (260,585 lines, 24% of production source) went unread, because no language model this pass could load exposed a clone-unit token stream for those file kinds. Duplication in that source is UNMEASURED — its absence from the count above is a gap in this analyzer's language coverage, not a finding that the code is free of duplication.
  • D8 Code Coverage — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: the Swift half could not be measured — the Swift suite in Packages/OsaurusCLI 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.
  • D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.swift) and this repository declares a SwiftPM test suite (7 packages), 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.
  • D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
  • D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
  • D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
  • D24 Comment Value — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
  • D26 Project Cohesion — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Project size and spread are measured over build units whose source a code model reads. This repository's .c source is a material share of its production lines and was read by none, so the score is a verdict about the units that were read. Not a finding that the unread source is cohesive — it is unmeasured.
  • D27 Navigability — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Tracing effort is measured over resolved call sites, and all 819 sampled here came from .swift files. This repository's .c source is a material share of its production lines and contributed none, so the score above is a verdict about the part that was read. Not a finding that the unread half navigates well — it is unmeasured.
  • D32 Data Compliance (PII/GDPR) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Bench.swift`, `Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsDev.swift`, `Packages/OsaurusCLI/Sources/OsaurusCLICore/Services/InstallationDiagnostics.swift`, `Packages/OsaurusCore/AppDelegate.swift`, `Packages/OsaurusCore/AppleApps/Calendar/CalendarService.swift`, … (+277 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.
  • AX1 Captive dependencies — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in Packages/OsaurusCore/Services/Sandbox/SandboxBridgeTokenStore.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.
  • AX6 Interface segregation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • AXB2 Runtime readiness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `npm run` found no package.json in the folder where our sandbox ran it. This is a limit of our sandbox, not of your repository. (rule: no-root-manifest). The renderer reported: the dev server (`npm run start`) exited before it served a page. Likely cause (our sandbox): `npm run` found no package.json in the folder where our sandbox ran it. This is a limit of our sandbox, not of your repository. Last output: "npm error code ENOENT / npm error syscall open / npm error path <repo>/package.json / npm error errno -2 / npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '<repo>/package.json' / npm error enoent This is related to npm not being able to find a file. / npm error enoent / npm error A complete log of this run can be found in: <path>" No runtime evidence was gathered.
  • AXR1 Runtime accessibility — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DevServer (start). the dev server (`npm run start`) exited before it served a page. Likely cause (our sandbox): `npm run` found no package.json in the folder where our sandbox ran it. This is a limit of our sandbox, not of your repository. Last output: "npm error code ENOENT / npm error syscall open / npm error path <repo>/package.json / npm error errno -2 / npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '<repo>/package.json' / npm error enoent This is related to npm not being able to find a file. / npm error enoent / npm error A complete log of this run can be found in: <path>" No runtime evidence was gathered.
  • C1 Data Protection — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
  • C2 Access Controls — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
  • C3 Audit Trail — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
  • C4 Data Retention — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 'SQLite3' is imported (Packages/OsaurusCore/Services/SafeDiskCachePurge.swift:2), 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 'SQLite3' is imported (Packages/OsaurusCore/Services/SafeDiskCachePurge.swift:2), 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.
  • GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Go, Python, Swift, c, objectivec is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Go, Python, Swift, c, objectivec is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • S1 Web-Security Posture — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
  • X1 Async correctness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X10 Duplicated predicate — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 59 further occurrence(s) are not listed individually; the score already reflects all 99.
  • X12 Unreachable branch — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X14 Bypassable address classification — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
  • X2 Cancellation propagation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X26 Unsynchronised callback handoff — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
  • X28 Index access outside its own emptiness guard — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
  • X3 Exception handling — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
  • X3 Exception handling — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 68 further occurrence(s) are not listed individually; the score already reflects all 108.
  • X4 Structured logging — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Python, PHP, Dart, Ruby, Scala and Rust source only, and no C# was loaded, and this repository's JavaScript/TypeScript, Python and PHP make no call through a named logger, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X7 Silent fallback defaults — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 22 further occurrence(s) are not listed individually; the score already reflects all 62.

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

Limitations & what we did not check

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

Per-dimension blind spots

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

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • 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.
  • 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.
  • D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
  • D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
  • D21 Naming Consistency: Naming consistency compares each name with the convention its structural peers follow in this repository: it cannot tell whether a consistently used name is a good one, and languages other than C# and TypeScript are not measured.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
  • 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.
  • D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (REDACTED, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • 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.
  • DM6 Domain ↔ infrastructure boundary: Infrastructure reached through a hand-rolled wrapper, a domain-named facade, reflection, or a string-keyed service locator resolves to a non-infra type and isn't seen; the body scan is symbol resolution over syntax, not full dataflow. A clean result means "no resolved infra reference in a domain body", not a proof of purity.
  • M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
  • 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.0 / 10Weak✓ Tool-verified

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

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

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

884 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was HTTPHandler.channelRead at 272. A further 76 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 WorkflowDiff.plainLines::fieldName at 42 — they are counted neither in the figure above nor in this dimension's score. 26 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: Packages/OsaurusCore/Models/Configuration/ManagementTab.swift (ManagementTab.icon at 40), Packages/OsaurusCore/Services/FeatureTelemetry.swift (FeatureTelemetry.settingsTabToken at 40), Packages/OsaurusCore/Views/Management/ManagementView.swift (ManagementView.contentView at 40), Packages/OsaurusCore/Views/DesignSystem/SettingsKitGallery.swift (SettingsKitGallery.focusedComponent at 26), Packages/OsaurusCore/Views/Workflow/WorkflowSummary.swift (WorkflowSummary.condition at 25), and 21 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.

ChatSession.dispatchSend::runTurn (cyclomatic 144) · ×3Packages/OsaurusCore/Views/Chat/ChatView.swift:7829
HTTPHandler.channelRead (cyclomatic 272)Packages/OsaurusCore/Networking/HTTPHandler.swift:495
HTTPHandler.handleAgentRunEndpoint (cyclomatic 205)Packages/OsaurusCore/Networking/HTTPHandler.swift:10496
ConfigEvents.build (cyclomatic 188)Packages/OsaurusCore/Configuration/Declarative/ConfigEvents.swift:383
AppleScriptLoop.run (cyclomatic 172)Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:310

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

What to do

  1. Bring the 1 body over 240 down to 240 or less in Cyclomatic Complexity — start with HTTPHandler.channelRead (cyclomatic 272). — Refactoring it lifts Cyclomatic Complexity from 5.0 to about 5.1/10.

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

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

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

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

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

1323 method(s) exceeded the cognitive complexity threshold of 15; the worst was AgentToolLoop.runHoldingResidency at 448.

ChatSession.dispatchSend::runTurn (cognitive 288) · ×3Packages/OsaurusCore/Views/Chat/ChatView.swift:7829
AgentToolLoop.runHoldingResidency (cognitive 448)Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:2359
ConfigPlanner.validate (cognitive 406)Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:423
ConfigEvents.build (cognitive 337)Packages/OsaurusCore/Configuration/Declarative/ConfigEvents.swift:383
HTTPHandler.channelRead (cognitive 319)Packages/OsaurusCore/Networking/HTTPHandler.swift:495

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

What to do

  1. Bring the 9 bodies over 240 down to 240 or less in Cognitive Complexity — start with AgentToolLoop.runHoldingResidency (cognitive 448), ConfigPlanner.validate (cognitive 406), ConfigEvents.build (cognitive 337). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 9 together lifts Cognitive Complexity from 2.7 to about 3.7/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.

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

D3 · God Classes7.9 / 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.9 / 10 · rule-coverage 100% · ceiling Prevented

795 god class(es) detected.

FileTooLong: Networking/HTTPHandler.swift · ×260Packages/OsaurusCore/Networking/HTTPHandler.swift
MethodTooLong: ChatSession.dispatchSend · ×247Packages/OsaurusCore/Views/Chat/ChatView.swift:7577
ClassTooLong: HTTPHandler · ×184Packages/OsaurusCore/Networking/HTTPHandler.swift:222
TooManyMethods: HTTPHandler · ×102Packages/OsaurusCore/Networking/HTTPHandler.swift:222
FunctionTooLong: MarkdownBlockParsing.swift.parseBlocks · ×2Packages/OsaurusCore/Utils/MarkdownBlockParsing.swift:151

What to do

  1. Resolve the 260 FileTooLong finding(s) in God Classes — start with HTTPHandler.swift, ChatView.swift, FloatingInputCard.swift. — One of this dimension's main actionable groups (260 warning-level).
  2. Resolve the 247 MethodTooLong finding(s) in God Classes — start with HTTPHandler.swift (32), ChatView.swift (9), RemoteProviderService.swift (9). — One of this dimension's main actionable groups (247 warning-level).
  3. Resolve the 184 ClassTooLong finding(s) in God Classes — start with FolderTools.swift (4), ChatView.swift (2), AgentsView.swift (2). — One of this dimension's main actionable groups (184 warning-level).

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

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

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

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

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

1376 duplicated block group(s) detected. 8.4 % of the production lines (69,584 of 831,801) are in a reported copy. A further 1452 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 21 of the 2828 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. Measured on part of this repository only: .c (24% of production source) was not exposed to the token comparison, so duplication there is unmeasured and is not in this count.

Duplicated block (5 lines × 2) · ×97Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Show.swift:60
Duplicated block (6 lines × 2) · ×95Packages/OsaurusCore/AppleApps/Calendar/CalendarService.swift:516
Duplicated block (9 lines × 2) · ×80Packages/OsaurusCore/AppleApps/Maps/MapsTools.swift:258
Duplicated block (8 lines × 2) · ×76Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:306
Duplicated block (7 lines × 2) · ×73Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:227

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

What to do

  1. Resolve the 97 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with HTTPHandler.swift (5), ArchitectConfigurationStore.swift (3), IMessageRPCClient.swift (3). — One of this dimension's main actionable groups (97 warning-level).
  2. Resolve the 95 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with AgentChannelMessageFormatter.swift (3), AgentToolLoop.swift (2), ChatHistoryDatabase.swift (2). — One of this dimension's main actionable groups (95 warning-level).
  3. Resolve the 80 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with HTTPHandler.swift (4), Schedule.swift (3), AgentBundleService.swift (2). — One of this dimension's main actionable groups (80 warning-level).

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

D5 · Coupling9.4 / 10Stronggated by 1 serious finding✓ 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 9.4 / 10 · rule-coverage 100% · ceiling Prevented

14 production modules (Go+SwiftPM+Xcode), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; a workspace's implicit (product-name) dependency is not visible there; 1 module(s) off the main sequence, with abstractness counted on 12 of the 14 (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: OsaurusNetworking

What to do

  1. Resolve the 1 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).

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

D6 · Cohesion (LCOM4)9.4 / 10Stronggated by 37 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.4 / 10 · rule-coverage 100% · ceiling Verified

37 of 788 classes have LCOM4 above 3.

Low cohesion: AppDelegate (LCOM4 17) · ×37Packages/OsaurusCore/AppDelegate.swift:22

What to do

  1. Resolve the 37 Low cohesion finding(s) in Cohesion (LCOM4) — start with REDACTED (2), NativeMessageCellView.swift (2), AppDelegate.swift. — One of this dimension's main actionable groups (37 warning-level).

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).

Detailed fixes: d7_recommendation.md.

D10 · Test Quality9.7 / 10Adequategated by 3 critical findings✓ Tool-verified

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

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

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

44 skipped (37 with a documented reason), 304 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 16057 tests.

Assertions commented out: testExampleApp/osaurusUITests/osaurusUITests.swift:25
No assertions (empty test): modelRuntimeIsAnActorPackages/OsaurusCore/Tests/Model/ModelRuntimePrefixTests.swift:22
Test project verifies nothing: osaurusUITestsApp/osaurusUITests/osaurusUITests.swift:25
No assertions: testLaunchPerformance · ×302App/osaurusUITests/osaurusUITests.swift:51
Skipped test: testModelSearchFunctionality · ×7App/osaurusUITests/osaurusUITests.swift:34

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

What to do

  1. Resolve the 1 Assertions commented out finding(s) in Test Quality — start with osaurusUITests.swift. — One of this dimension's main actionable groups (1 issue-level).
  2. Resolve the 1 No assertions (empty test) finding(s) in Test Quality — start with ModelRuntimePrefixTests.swift. — One of this dimension's main actionable groups (1 issue-level).
  3. Resolve the 1 Test project verifies nothing finding(s) in Test Quality — start with osaurusUITests.swift. — One of this dimension's main actionable groups (1 issue-level).

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

D12 · Dependency Hygiene8.2 7.3 / 10Strong✓ Tool-verified

What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.

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

Maturity: Documented → Verified → Prevented · effective 7.3 / 10 · rule-coverage 89% · ceiling Verified

37 outdated direct SwiftPM dependencies, 0 pinning defect(s). 57 of 64 direct dependencies had their releases listed (0 naming no readable repository, 7 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: async-http-client · ×31

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

D13 · REDACTED Scanning10.0 / 10Exemplary○ Nothing flagged

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

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

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

REDACTED scan ran and found no leaked secrets.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

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

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

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

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

0 of 46 SwiftPM package(s) use a banned license. SwiftPM has no package registry, so each package's licence is the one its repository declares: 43 of them read from the licence file the repository carries at the revision REDACTED pins, and 3 — unpinned, or whose licence file could not be read or named — from api.deps.dev, which reports the licence the repository declares today. Graded: every package a committed REDACTED pins, direct and transitive, and every declared dependency none pins. 1 of them are declared by a manifest that commits no REDACTED (a library, whose resolution is its consumer's), so their own dependencies are resolved by whoever builds it and are not in this verdict. 3 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 Hotspots8.4 / 10Strong✓ Tool-verified

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

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

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

Top hotspots: Packages/OsaurusCore/Views/Chat/ChatView.swift (127×289=36703); Packages/OsaurusCore/Networking/HTTPHandler.swift (69×272=18768); Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift (29×172=4988) Repeated repair below the complexity floor: Packages/OsaurusCore/Views/Common/CodeBlockView.swift (3 of 5 changes were fixes)

Hotspot: Packages/OsaurusCore/Views/Chat/ChatView.swift · ×149Packages/OsaurusCore/Views/Chat/ChatView.swift:7577
Repeated repair: Packages/OsaurusCore/Views/Common/CodeBlockView.swiftPackages/OsaurusCore/Views/Common/CodeBlockView.swift:519

What to do

  1. Resolve the 149 Hotspot finding(s) in Churn × Complexity Hotspots — start with ChatView.swift, HTTPHandler.swift, AgentToolLoop.swift. — One of this dimension's main actionable groups (149 warning-level).
  2. Resolve the 1 Repeated repair finding(s) in Churn × Complexity Hotspots — start with CodeBlockView.swift. — One of this dimension's main actionable groups (1 warning-level).

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

D16 · Bus Factor8.9 / 10Strong✓ Tool-verified

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

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

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

210 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsCreate.swift. Counted over 1940 of the 2189 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

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

What to do

  1. Resolve the 4 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (4 recommendation-level).
  2. Resolve the 1 Further sole-owners (lower concentration) finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).

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

D17 · Explicit Debt10.0 / 10Stronggated by 13 serious findings✓ Tool-verified

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

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

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

13 deducted task-comment markers across 831801 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.

TodoComment · ×12Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:2079
HackCommentPackages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalBootstrap.swift:779

What to do

  1. Resolve the 12 TodoComment finding(s) in Explicit Debt — start with AgentToolLoop.swift (4), AgentInlineBlocks.swift (2), ChatView.swift (2). — One of this dimension's main actionable groups (12 warning-level).
  2. Resolve the 1 HackComment finding(s) in Explicit Debt — start with EvalBootstrap.swift. — One of this dimension's main actionable groups (1 warning-level).

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

D20 · ADR Quality10.0 / 10Exemplary○ Nothing flagged

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

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

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

0 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, a date that is no calendar day). How well each record argues its case is not measured.

✓ On the Gold path — maintain.

Detailed fixes: d20_recommendation.md.

D21 · Naming Consistency8.9 / 10Strong✓ Tool-verified

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

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

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

21 naming inconsistencies among 1901 declarations measured against a convention their peers follow.

`partialJson` spells `Json` where 468 names in the project spell it `JSON` · ×2Packages/OsaurusCore/Models/API/AnthropicAPI.swift:792
`mcpJsonPath` spells `Json` where 468 names in the project spell it `JSON` · ×2Packages/OsaurusCore/Services/GitHubSkillService.swift:412
`getProcessForPID` spells `PID` where 18 names in the project spell it `Pid`Packages/OsaurusCore/ComputerUse/Driver/Mac/SkyLightBridge.swift:249
`InputJsonDelta` spells `Json` where 468 names in the project spell it `JSON`Packages/OsaurusCore/Models/API/AnthropicAPI.swift:788
`responseJsonSchema` spells `Json` where 468 names in the project spell it `JSON`Packages/OsaurusCore/Models/API/GeminiAPI.swift:255

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

What to do

  1. Resolve the 2 `partialJson` spells `Json` where 468 names in the project spell it… finding(s) in Naming Consistency — start with AnthropicAPI.swift (2). — One of this dimension's main actionable groups (2 recommendation-level).
  2. Resolve the 2 `mcpJsonPath` spells `Json` where 468 names in the project spell it… finding(s) in Naming Consistency — start with GitHubSkillService.swift (2). — One of this dimension's main actionable groups (2 recommendation-level).
  3. Resolve the 1 `getProcessForPID` spells `PID` where 18 names in the project spell it… finding(s) in Naming Consistency — start with SkyLightBridge.swift. — One of this dimension's main actionable groups (1 recommendation-level).

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

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

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

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

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

3 of 9 build units (Go, Make, SwiftPM, Xcode) flagged as possibly oversized/incoherent. This repository's .c source was read by no build unit, so this covers part of the tree, not all of it.

Projects may be oversized for their cohesion

What to do

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

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

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

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

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

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

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

24 % of calls cross a namespace and 0 % go through an interface, but 100 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: small — navigation cost is tolerated. Measured over the .swift source only — this repository's .c was not sampled for call sites, so this score covers part of the tree, not all of it.

✓ On the Gold path — maintain.

Detailed fixes: d27_recommendation.md.

D28 · Secrets (history)0.0 / 10Critical✓ 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 0.0 / 10 · rule-coverage 100% · ceiling Documented

356 finding(s): 0 critical, 356 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 355 REDACTED finding(s) in Secrets (history) — start with REDACTED (351), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (355 issue-level).
  2. Resolve the 1 High secret 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)6.0 / 10Adequate✓ Tool-verified

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

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

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

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

50 finding(s): 0 critical, 50 high, 0 medium, 0 low. 47 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 61 file(s) — `Packages/OsaurusCore/AppDelegate.swift` (line 207, line 813), `Packages/OsaurusCore/EmbeddingModels/potion-base-4M/tokenizer.json`, `Packages/OsaurusCore/Folder/ChatFolderState.swift` (line 405), `Packages/OsaurusCore/Managers/AgentManager.swift` (line 74), `Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift` (lines 373–374, line 376, lines 391–392, …), … (+56 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 4 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

What to do

  1. Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 issue-level).
  2. Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  3. No action in Static Analysis (SAST) — all 47 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (47 issue-level, 0 of them charged here).

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

D30 · Dependency Vulnerabilities8.1 / 10Adequategated by 2 critical findings✓ Tool-verified

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

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

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

11 finding(s): 0 critical, 2 high, 9 medium, 0 low.

REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 2 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
  2. Resolve the 8 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (5), REDACTED (3). — One of this dimension's main actionable groups (8 warning-level).
  3. Resolve the 1 Medium vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).

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

D31 · IaC & Container Security10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether Dockerfiles / Terraform / Kubernetes config follow security best practices.

Method: IaC/container misconfiguration scan via trivy config (Dockerfile/Terraform/K8s/Helm/CloudFormation); severity rules to 0-10 moderate normalizer. NotApplicable without manifests. Exhaustive, deterministic.

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

trivy and checkov found no infrastructure-as-code or container misconfigurations.

✓ On the Gold path — maintain.

Detailed fixes: d31_recommendation.md.

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

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

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

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

2 of 1940 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Bundle/MCPBundleManager.swift. Counted over 1940 of the 2189 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned file · ×2Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Bundle/MCPBundleManager.swift:1
Orphaned files with no living knowledge

✓ On the Gold path — maintain.

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

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

Strongest change-coupling: ModelFamilyNames.swift↔Package.swift 80%; Package.swift↔SwiftTransformersTokenizerLoader.swift 76%; SystemPermission.swift↔ConfigurationView.swift 64%

Change coupling: SystemPermission.swift ↔ ConfigurationView.swift · ×5Packages/OsaurusCore/Models/SystemPermission.swift:1
Change-coupling hub: Package.swift → LocalVisionEvidence.swift, ModelFamilyNames.swift, ModelMediaCapabilities.swift, GenerationEventMapper.swift, ImageGenerationService.swift, MLXBatchAdapter.swift, SwiftTransformersTokenizerLoader.swift, ImageGenerationPanelView.swiftPackages/OsaurusCore/Package.swift

What to do

  1. Resolve the 5 Change coupling finding(s) in Change Coupling — start with SystemPermission.swift, ChatConfiguration.swift, NativeBlockViews.swift. — One of this dimension's main actionable groups (5 warning-level).
  2. Resolve the 1 Change-coupling hub finding(s) in Change Coupling — start with Package.swift. — One of this dimension's main actionable groups (1 warning-level).

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

D36 · Supply-chain Provenance & Signing2.5 / 10Weak✓ 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 2.5 / 10 · rule-coverage 100% · ceiling Documented

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

REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
  2. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-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.

D37 · Vulnerability-disclosure Policy4.0 / 10Weak✓ Tool-verified

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

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

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

A vulnerability-disclosure policy (REDACTED) is present but lists no reporting contact.

REDACTED

What to do

  1. Resolve the 1 REDACTED finding(s) in Vulnerability-disclosure Policy — start with REDACTED. — One of this dimension's main actionable groups (1 recommendation-level).

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

D44 · Platform End-of-Life10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.

Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.

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

0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 0 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.

✓ On the Gold path — maintain.

Detailed fixes: d44_recommendation.md.

Frontend & cross-cutting dimensions

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

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

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

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

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

AX3 · Project dependency cycles10.0 / 10Exemplary✓ Tool-verified

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

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

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

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

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

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

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

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

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

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

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

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

DM4 · Rich vs anemic domain model7.9 / 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.

  • `Color` 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. — Packages/OsaurusCore/Models/Theme/CustomTheme.swift:329
  • `Error` 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. — Packages/OsaurusCore/Services/Sync/SyncError+Osaurus.swift:85

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.

DM6 · Domain ↔ infrastructure boundary10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether the domain layer stays free of infrastructure dependencies — a domain entity fused to a persistence ORM on its own declaration (active-record), or reaching a web-framework transport type in its own method, couples the domain to infrastructure. The clean-architecture dependency rule.

Method: Roslyn (DDD-gated): domain-layer types scanned for infrastructure usage in member SIGNATURES and inside method/accessor BODIES — resolved calls and object-creations into EF/Marten/HTTP/Mongo/Redis/message-bus types (not just a namespace allowlist). Deterministic, symbol-resolved, exhaustive over domain-layer bodies, DDD-native.

Coverage: Domain layer identified by NAMESPACE heuristic; infrastructure then resolved by symbol in member SIGNATURES and method/accessor BODIES — rename the layer and the check evaporates.

ED1 · Handler temporal coupling1.0 / 10Critical✓ Tool-verified

Other · Event-Driven — Whether event/message handlers avoid synchronous blocking waits — a blocking wait inside a handler stalls throughput and risks deadlock.

Method: Roslyn semantic scan (event-driven gated): event-handler bodies scanned for HTTP/gRPC invocations by resolved symbol type, not substring. Deterministic, semantic-resolved.

  • `ChannelReplayNonceStore.consume` is an event/message handler that blocks on a synchronous wait (a semaphore/queue `.wait`/`.sync`) — it stalls the handler on a peer or resource and serialises throughput, and can deadlock under load. Await the work asynchronously (`async`/`await`) instead of blocking the handler. — Packages/OsaurusCore/Services/Channels/ChannelReplayNonceStore.swift:72
  • `Keychain.onWriteQueueSync` is an event/message handler that blocks on a synchronous wait (a semaphore/queue `.wait`/`.sync`) — it stalls the handler on a peer or resource and serialises throughput, and can deadlock under load. Await the work asynchronously (`async`/`await`) instead of blocking the handler. — Packages/OsaurusCore/Services/Keychain/Keychain.swift:254

What to do

  • Replace the synchronous wait with `async`/`await` so the handler never blocks on a peer/resource.
M1 · Documentation (README)8.7 / 10Strong✓ Tool-verified

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

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

M2 · Architecture 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 — `Packages/OsaurusEvals/Config/capability-search-sweep.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 repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.

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

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

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

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

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

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

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

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

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

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

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

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

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

  • Only 4/7 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `Packages/OsaurusCLI`, `helpers/osaurus-wa`.

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 6 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner. — REDACTED:4
  • `docs/examples/login-with-osaurus/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — docs/examples/login-with-osaurus/package.json:13

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 & Rollback7.0 / 10Strong✓ 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.

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.

PF3 · Async & latency hygiene6.0 / 10Adequate✓ Tool-verified

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

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

  • `launchAppIfNeeded` is async and calls .waitUntilExit() — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs. — Packages/OsaurusCLI/Sources/OsaurusCLICore/Services/AppControl.swift:23
  • `shutdown` is async and calls .wait() — 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. — Packages/OsaurusCore/Models/Plugin/ExternalPlugin.swift:865
  • `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. (×2) — Packages/OsaurusCore/Services/AgentChannel/AgentChannelTransportRuntime.swift:80, Packages/OsaurusCore/Views/Onboarding/Stage/OnboardingScene.swift:69
  • `readUntilDone` is async and calls .waitUntilExit() — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs. — Packages/OsaurusCore/Services/Workflow/CodeNodeExecutor.swift:423
  • `execute` is async and calls .wait() — 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. — Packages/OsaurusCore/Services/Workflow/WorkflowNodeExecutor.swift:247
  • `readFileSync` in `callback to createServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — docs/examples/login-with-osaurus/server.ts:119

What to do

  • Swift: await instead of blocking — `try await Task.sleep(for:)` for Thread.sleep/sleep, a checked continuation instead of a DispatchSemaphore or DispatchGroup wait, the async Process and URLSession APIs; never park a thread waiting on a Task — the cooperative pool cannot guarantee it progress.
  • TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants.
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.

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

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

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

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

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

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

X3 · Exception handling6.8 / 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.

  • `if err != nil` 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. — helpers/osaurus-wa/rpc.go:40
  • `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. (×39) — Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalDiffMatrixCLI.swift:308, Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalReviewReportCLI.swift:710, Packages/OsaurusCore/Views/Settings/CommandLineToolSection.swift:171, …

What to do

  • Swallowed exception (caught, then discarded)
X5 · Nullable reference types2.0 / 10Critical✓ 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.

  • This repository commits no tsconfig, so whatever type-checks it uses tsc's own defaults, in which `strict` and `strictNullChecks` are OFF: `string` admits `null` and `undefined`, and a value that is null is compiled through to the property access that throws. If the build passes `--strict` on a command line instead, put it in a committed tsconfig — this check reads configuration, and configuration is all it can read.

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 Health52%Adequate — gated by D2, X5Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture92%ExemplaryStrongest area.
Maturity85%StrongSolid.
Readiness58%Adequate — gated by P3Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security54%Adequate — gated by D28, D36Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Domain Modelling91%ExemplarySolid.
Event-Driven10%Critical — gated by ED1Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance60%AdequateAcceptable, with room to improve.
Unscored — 5 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.

  • SC1 Supply-chain hygiene — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X10 Duplicated predicate — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X6 Hand-rolled structured-format parsing — 5 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X9 Subsumed condition operand — 1 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' (Packages/OsaurusCore/Services/SafeDiskCachePurge.swift:2) 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' (Packages/OsaurusCore/Services/SafeDiskCachePurge.swift:2) 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 — 62 check(s) not relevant to this codebase

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

  • AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
  • AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
  • AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
  • AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
  • AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
  • AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
  • AX1 Captive dependencies — not 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 Go request handler (a net/http, Gin, Echo, Fiber or fasthttp handler, or a gRPC service method) is declared as a method or function, and no handler function literal writes a value captured from outside it, so no state is shared between request goroutines. 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 — AX6 reached only 0% of this repository's production lines — swift (823,160 lines), c (260,585 lines), python (6,625 lines), go (1,481 lines), objectivec (13 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXR1 Runtime accessibility — the dev server (`npm run start`) exited before it served a page. Likely cause (our sandbox): `npm run` found no package.json in the folder where our sandbox ran it. This is a limit of our sandbox, not of your repository. Last output: "npm error code ENOENT / npm error syscall open / npm error path <repo>/package.json / npm error errno -2 / npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '<repo>/package.json' / npm error enoent This is related to npm not being able to find a file. / npm error enoent / npm error A complete log of this run can be found in: <path>" No runtime evidence was gathered. This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
  • C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • 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.
  • D22 Internal API Consistency — API consistency is measured on C# only; the exposed Swift surface was not measured.
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value — D24 reads C#, Visual Basic, TypeScript and JavaScript comments only; comments in this repository's .go, .py, .swift source were not judged.
  • 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.
  • D32 Data Compliance (PII/GDPR) — 282 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D8 Code Coverage — Coverage not measured — Swift suite
  • DM1 Aggregate boundaries — not scored for Swift: the sidecar flattens array/collection types (a child COLLECTION = legitimate membership vs a single embedded aggregate is indistinguishable), and aggregate-vs-value-object classification cannot be told apart in source (every struct-holding-struct reads alike) — reported as guidance rather than measured
  • DM2 Strongly-typed ids — no in-repo typed-id idiom — primitive-obsession recorded as advisory DM8, DM2 not gated
  • DM3 Integration-event coupling — not scored for Swift: a cross-SwiftPM-target domain leak cannot be told apart in source from a legitimate shared-kernel/contracts module, and most repositories ship a single module — reported as guidance rather than measured
  • 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 — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
  • P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the Go, 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 — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
  • PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for `Benchmark("…")` in a file importing package-benchmark, or package-benchmark in Package.swift, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
  • PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
  • 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.
  • X1 Async correctness — X1 reached only 1% of this repository's production lines — swift (823,160 lines), c (260,585 lines), go (1,481 lines), objectivec (13 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X12 Unreachable branch — X12 reached only 1% of this repository's production lines — swift (823,160 lines), c (260,585 lines), go (1,481 lines), objectivec (13 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X16 Unfloored truncation loop — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X17 Uncapped recursion over a caller-supplied document — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X18 Disposal-pattern correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X2 Cancellation propagation — X2 reached only 1% of this repository's production lines — swift (823,160 lines), c (260,585 lines), objectivec (13 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X21 Side-effecting pattern guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X23 Unguarded diagnostic materialisation — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X24 Document value interpolated into markup unescaped — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X25 Inert configuration knob — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X27 Collection changed while being enumerated — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X29 Per-element action decided by a fixed element — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X30 Support guard that admits what it rejects — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X4 Structured logging — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository

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 — 415 finding(s)
D28 · Secrets (history) · REDACTED · ×355
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 330 more in this group — see findings.md.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 22 more in this group — see findings.md.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · High CVE · ×2
  • REDACTED
  • REDACTED
DM4 · Rich vs anemic domain model · Anemic domain model · ×2
  • Anemic domain model: Color Packages/OsaurusCore/Models/Theme/CustomTheme.swift:329 — `Color` 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: Error Packages/OsaurusCore/Services/Sync/SyncError+Osaurus.swift:85 — `Error` 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.
ED1 · Handler temporal coupling · Blocking wait inside a handler · ×2
  • Blocking wait inside a handler: ChannelReplayNonceStore.consume Packages/OsaurusCore/Services/Channels/ChannelReplayNonceStore.swift:72 — `ChannelReplayNonceStore.consume` is an event/message handler that blocks on a synchronous wait (a semaphore/queue `.wait`/`.sync`) — it stalls the handler on a peer or resource and serialises throughput, and can deadlock under load. Await the work asynchronously (`async`/`await`) instead of blocking the handler.
  • Blocking wait inside a handler: Keychain.onWriteQueueSync Packages/OsaurusCore/Services/Keychain/Keychain.swift:254 — `Keychain.onWriteQueueSync` is an event/message handler that blocks on a synchronous wait (a semaphore/queue `.wait`/`.sync`) — it stalls the handler on a peer or resource and serialises throughput, and can deadlock under load. Await the work asynchronously (`async`/`await`) instead of blocking the handler.
D10 · Test Quality · Assertions commented out · ×1
  • Assertions commented out: testExample App/osaurusUITests/osaurusUITests.swift:25 — The test body contains commented-out assertion calls and no live one — it runs, verifies nothing, and still passes. Restore the assertions or delete the test; a green test that checks nothing is worse than an absent one.
D10 · Test Quality · No assertions (empty test) · ×1
  • No assertions (empty test): modelRuntimeIsAnActor Packages/OsaurusCore/Tests/Model/ModelRuntimePrefixTests.swift:22 — Test method has an empty body — it asserts nothing and exercises no code.
D10 · Test Quality · Test project verifies nothing · ×1
  • Test project verifies nothing: osaurusUITests App/osaurusUITests/osaurusUITests.swift:25 — No conventional assertion call was detected in 3 of 3 tests in `osaurusUITests` — the project as a whole, not one method. 1 of them has its assertions commented out, so this suite did verify conventionally and was switched off — it is not an approval/verifier harness.
D28 · Secrets (history) · High secret · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
Serious — 6404 finding(s)
D10 · Test Quality · No assertions · ×302
  • No assertions: testLaunchPerformance App/osaurusUITests/osaurusUITests.swift:51 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testLaunch App/osaurusUITests/osaurusUITestsLaunchTests.swift:20 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: aTakenNameIsReportedWithWhoSetIt Packages/OsaurusCore/Tests/Agent/AgentDraftCreateBlockerTests.swift:31 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: nonImageToolResult_isIgnored Packages/OsaurusCore/Tests/AgentDelegation/NativeImageToolArtifactBridgeTests.swift:249 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: createWithAppleApps Packages/OsaurusCore/Tests/AppleApps/AppleAppsDeclarativeConfigTests.swift:204 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: blankScriptInvalid Packages/OsaurusCore/Tests/AppleScript/AppleScriptTests.swift:45 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: missingScriptInvalid Packages/OsaurusCore/Tests/AppleScript/AppleScriptTests.swift:54 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: nonJSONInvalid Packages/OsaurusCore/Tests/AppleScript/AppleScriptTests.swift:63 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: approvalResumes Packages/OsaurusCore/Tests/Attention/SharedRunParkResumeTests.swift:79 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: denialResumes Packages/OsaurusCore/Tests/Attention/SharedRunParkResumeTests.swift:81 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: reasoningOnlyLengthIsNotClassifiedAsFinalResponse Packages/OsaurusCore/Tests/Chat/AgentToolLoopTests.swift:553 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: reasoningOnlyNaturalStopRequiresVisibleAnswer Packages/OsaurusCore/Tests/Chat/AgentToolLoopTests.swift:566 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: intentionalReasoningOnlyDirectChatRemainsFinal Packages/OsaurusCore/Tests/Chat/AgentToolLoopTests.swift:579 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: intentionalUnclosedReasoningOnlyDirectChatRemainsFinal Packages/OsaurusCore/Tests/Chat/AgentToolLoopTests.swift:592 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: unclosedReasoningWithContentEndsWithoutTransparentReplay Packages/OsaurusCore/Tests/Chat/AgentToolLoopTests.swift:627 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: announceOnlyTextIsRecoverableNotFinal Packages/OsaurusCore/Tests/Chat/AgentToolLoopTests.swift:711 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: genuineAnswersStayFinal Packages/OsaurusCore/Tests/Chat/AgentToolLoopTests.swift:912 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: announceOnlyTextIsFinalWhenNoToolsWereOffered Packages/OsaurusCore/Tests/Chat/AgentToolLoopTests.swift:938 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: omittedContentPreservesFinalResponseClassification Packages/OsaurusCore/Tests/Chat/AgentToolLoopTests.swift:955 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: announceCheckDoesNotShadowEarlierTerminalReasons Packages/OsaurusCore/Tests/Chat/AgentToolLoopTests.swift:971 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: permissionToContinueIsFlagged Packages/OsaurusCore/Tests/Chat/AgentToolLoopTests.swift:992 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: substantiveQuestionsAreNotTreatedAsStalls Packages/OsaurusCore/Tests/Chat/AgentToolLoopTests.swift:1018 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: continuationPhraseMidAnswerDoesNotFlag Packages/OsaurusCore/Tests/Chat/AgentToolLoopTests.swift:1043 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: runtimeContextErrorPropagatesDespiteEstimate Packages/OsaurusCore/Tests/Chat/AgentToolLoopTests.swift:3285 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: multiToolRequiredChoiceStaysRequired Packages/OsaurusCore/Tests/Chat/ChatEngineTests.swift:453 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • + 277 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×260
  • FileTooLong: Networking/HTTPHandler.swift Packages/OsaurusCore/Networking/HTTPHandler.swift — FileTooLong — 13793 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: HTTPHandler (222-19166). The bar is 500 significant lines; this is 13293 over it, 27.59× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: Chat/ChatView.swift Packages/OsaurusCore/Views/Chat/ChatView.swift — FileTooLong — 7321 significant lines (blank, comment-only and punctuation-only lines excluded), about 72% of them inside a single declaration: ChatSession (158-10371). The bar is 500 significant lines; this is 6821 over it, 14.64× 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: Chat/FloatingInputCard.swift Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift — FileTooLong — 5608 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 5108 over it, 11.22× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: Services/ModelRuntime.swift Packages/OsaurusCore/Services/ModelRuntime.swift — FileTooLong — 5117 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4617 over it, 10.23× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: Provider/RemoteProviderService.swift Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift — FileTooLong — 4483 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3983 over it, 8.97× 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: Agent/AgentsView.swift Packages/OsaurusCore/Views/Agent/AgentsView.swift — FileTooLong — 4405 significant lines (blank, comment-only and punctuation-only lines excluded), about 79% of them inside a single declaration: AgentDetailView (1251-6773). The bar is 500 significant lines; this is 3905 over it, 8.81× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: Configuration/SettingsSearchIndex.swift Packages/OsaurusCore/Models/Configuration/SettingsSearchIndex.swift — FileTooLong — 4149 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: SettingsSearchIndex (84-5157). The bar is 500 significant lines; this is 3649 over it, 8.30× 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: Folder/FolderTools.swift Packages/OsaurusCore/Folder/FolderTools.swift — FileTooLong — 4104 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3604 over it, 8.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: Chat/NativeMessageCellView.swift Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift — FileTooLong — 3058 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2558 over it, 6.12× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: Chat/ChatSessionSidebar.swift Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift — FileTooLong — 3009 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2509 over it, 6.02× 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: Tools/BuiltinSandboxTools.swift Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift — FileTooLong — 2480 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1980 over it, 4.96× 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: Plugin/PluginHostAPI.swift Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift — FileTooLong — 2356 significant lines (blank, comment-only and punctuation-only lines excluded), about 69% of them inside a single declaration: PluginHostContext (64-2934). The bar is 500 significant lines; this is 1856 over it, 4.71× 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: Chat/SystemPromptComposer.swift Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift — FileTooLong — 2231 significant lines (blank, comment-only and punctuation-only lines excluded), about 100% of them inside a single declaration: SystemPromptComposer (19-4213). The bar is 500 significant lines; this is 1731 over it, 4.46× 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: Storage/MemoryDatabase.swift Packages/OsaurusCore/Storage/MemoryDatabase.swift — FileTooLong — 2052 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: MemoryDatabase (56-3151). The bar is 500 significant lines; this is 1552 over it, 4.10× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: OsaurusEvalsKit/EvalCase.swift Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift — FileTooLong — 1976 significant lines (blank, comment-only and punctuation-only lines excluded), about 100% of them inside a single declaration: EvalCase (23-4036). The bar is 500 significant lines; this is 1476 over it, 3.95× 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: Tools/ToolRegistry.swift Packages/OsaurusCore/Tools/ToolRegistry.swift — FileTooLong — 1904 significant lines (blank, comment-only and punctuation-only lines excluded), about 92% of them inside a single declaration: ToolRegistry (179-3681). The bar is 500 significant lines; this is 1404 over it, 3.81× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: Settings/ProvidersView.swift Packages/OsaurusCore/Views/Settings/ProvidersView.swift — FileTooLong — 1846 significant lines (blank, comment-only and punctuation-only lines excluded), about 60% of them inside a single declaration: ProviderEditSheet (1048-2774). The bar is 500 significant lines; this is 1346 over it, 3.69× 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: Declarative/ConfigApplier.swift Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift — FileTooLong — 1799 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: ConfigApplier (68-2597). The bar is 500 significant lines; this is 1299 over it, 3.60× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: OsaurusEvalsKit/EvalRunner.swift Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift — FileTooLong — 1773 significant lines (blank, comment-only and punctuation-only lines excluded), about 96% of them inside a single declaration: EvalRunner (19-2784). The bar is 500 significant lines; this is 1273 over it, 3.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: Chat/AgentToolLoop.swift Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift — FileTooLong — 1770 significant lines (blank, comment-only and punctuation-only lines excluded), about 75% of them inside a single declaration: AgentToolLoop (1133-3613). The bar is 500 significant lines; this is 1270 over it, 3.54× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: Loop/AppleScriptLoop.swift Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift — FileTooLong — 1742 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: AppleScriptLoop (305-2639). The bar is 500 significant lines; this is 1242 over it, 3.48× 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: Declarative/ConfigPlanner.swift Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift — FileTooLong — 1736 significant lines (blank, comment-only and punctuation-only lines excluded), about 95% of them inside a single declaration: ConfigPlanner (171-2472). The bar is 500 significant lines; this is 1236 over it, 3.47× 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: Storage/AgentChannelMessageStore.swift Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift — FileTooLong — 1735 significant lines (blank, comment-only and punctuation-only lines excluded), about 79% of them inside a single declaration: AgentChannelMessageStore (466-2256). The bar is 500 significant lines; this is 1235 over it, 3.47× 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: Plugin/PluginsView.swift Packages/OsaurusCore/Views/Plugin/PluginsView.swift — FileTooLong — 1716 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1216 over it, 3.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: Chat/ChatWindowState.swift Packages/OsaurusCore/Managers/Chat/ChatWindowState.swift — FileTooLong — 1700 significant lines (blank, comment-only and punctuation-only lines excluded), about 96% of them inside a single declaration: ChatWindowState (189-3295). The bar is 500 significant lines; this is 1200 over it, 3.40× 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.
  • + 235 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×247
  • MethodTooLong: ChatSession.dispatchSend Packages/OsaurusCore/Views/Chat/ChatView.swift:7577 — MethodTooLong — dispatchSend runs 1321 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1221 over it, 13.21× 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: HTTPHandler.handleAgentRunEndpoint Packages/OsaurusCore/Networking/HTTPHandler.swift:10496 — MethodTooLong — handleAgentRunEndpoint runs 1131 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1031 over it, 11.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: AppleScriptLoop.run Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:310 — MethodTooLong — run runs 1030 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 930 over it, 10.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: HTTPHandler.channelRead Packages/OsaurusCore/Networking/HTTPHandler.swift:495 — MethodTooLong — channelRead runs 848 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 748 over it, 8.48× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: AgentToolLoop.runHoldingResidency Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:2359 — MethodTooLong — runHoldingResidency runs 722 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 622 over it, 7.22× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SubagentSession.runPreparedHost Packages/OsaurusCore/Subagent/SubagentSession.swift:549 — MethodTooLong — runPreparedHost runs 611 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 511 over it, 6.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: AgentLoopEvaluator.runConversation Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift:715 — MethodTooLong — runConversation runs 508 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 408 over it, 5.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: EvalRunner.runAgentLoopCaseWithSettings Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerAgentLoop.swift:33 — MethodTooLong — runAgentLoopCaseWithSettings runs 473 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 373 over it, 4.73× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ConfigEvents.build Packages/OsaurusCore/Configuration/Declarative/ConfigEvents.swift:383 — MethodTooLong — build runs 450 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 350 over it, 4.50× 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: ModelRuntime.loadContainer Packages/OsaurusCore/Services/ModelRuntime.swift:4841 — MethodTooLong — loadContainer runs 432 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 332 over it, 4.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: ChatView.chatModeContent Packages/OsaurusCore/Views/Chat/ChatView.swift:11698 — MethodTooLong — chatModeContent runs 431 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 331 over it, 4.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: HTTPHandler.handlePluginRoute Packages/OsaurusCore/Networking/HTTPHandler.swift:2959 — MethodTooLong — handlePluginRoute runs 407 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 307 over it, 4.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: HTTPHandler.handleChatCompletions Packages/OsaurusCore/Networking/HTTPHandler.swift:15297 — MethodTooLong — handleChatCompletions runs 407 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 307 over it, 4.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ConfigPlanner.validate Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:423 — MethodTooLong — validate runs 402 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 302 over it, 4.02× 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: SystemPromptComposer.appendGatedSections Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:972 — MethodTooLong — appendGatedSections runs 392 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 292 over it, 3.92× 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: EvalRunner.runCacheProofCase Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerCacheProof.swift:158 — MethodTooLong — runCacheProofCase runs 380 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 280 over it, 3.80× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: TokenizerBridge.applyChatTemplate Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.swift:211 — MethodTooLong — applyChatTemplate runs 348 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 248 over it, 3.48× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ClaudePluginInstaller.install Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:221 — MethodTooLong — install runs 343 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 243 over it, 3.43× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Skill.builtInSkills Packages/OsaurusCore/Models/Agent/Skill.swift:114 — MethodTooLong — builtInSkills runs 333 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 233 over it, 3.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: ChatSession.processStreamDeltas Packages/OsaurusCore/Views/Chat/ChatView.swift:6167 — MethodTooLong — processStreamDeltas runs 328 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 228 over it, 3.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: AgentChannelEvalHarness.runProactivePublish REDACTED:663 — MethodTooLong — runProactivePublish 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: SystemPromptComposer.resolveTools Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:2766 — MethodTooLong — resolveTools runs 299 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 199 over it, 2.99× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ChatEngine.completeChat Packages/OsaurusCore/Services/Chat/ChatEngine.swift:1832 — MethodTooLong — completeChat runs 293 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 193 over it, 2.93× 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: PluginHostContext.completeStream Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1820 — MethodTooLong — completeStream runs 284 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 184 over it, 2.84× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: RemoteProviderService._streamRemote Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:2946 — MethodTooLong — _streamRemote runs 284 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 184 over it, 2.84× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 222 more in this group — see findings.md.
D3 · God Classes · ClassTooLong · ×184
  • ClassTooLong: HTTPHandler Packages/OsaurusCore/Networking/HTTPHandler.swift:222 — ClassTooLong — 13659 significant lines (blank, comment-only and punctuation-only lines excluded), 258 methods. The bar is 400 significant lines; this is 13259 over it, 34.15× 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: ChatSession Packages/OsaurusCore/Views/Chat/ChatView.swift:157 — ClassTooLong — 5287 significant lines (blank, comment-only and punctuation-only lines excluded), 221 methods. The bar is 400 significant lines; this is 4887 over it, 13.22× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SettingsSearchIndex Packages/OsaurusCore/Models/Configuration/SettingsSearchIndex.swift:84 — ClassTooLong — 4110 significant lines (blank, comment-only and punctuation-only lines excluded), 9 methods. The bar is 400 significant lines; this is 3710 over it, 10.28× 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: AgentDetailView Packages/OsaurusCore/Views/Agent/AgentsView.swift:1251 — ClassTooLong — 3491 significant lines (blank, comment-only and punctuation-only lines excluded), 99 methods. The bar is 400 significant lines; this is 3091 over it, 8.73× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SystemPromptComposer Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:19 — ClassTooLong — 2228 significant lines (blank, comment-only and punctuation-only lines excluded), 71 methods. The bar is 400 significant lines; this is 1828 over it, 5.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.
  • ClassTooLong: MemoryDatabase Packages/OsaurusCore/Storage/MemoryDatabase.swift:56 — ClassTooLong — 2022 significant lines (blank, comment-only and punctuation-only lines excluded), 116 methods. The bar is 400 significant lines; this is 1622 over it, 5.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: EvalCase Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:23 — ClassTooLong — 1974 significant lines (blank, comment-only and punctuation-only lines excluded), 1 methods. The bar is 400 significant lines; this is 1574 over it, 4.94× 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: ConfigApplier Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:68 — ClassTooLong — 1776 significant lines (blank, comment-only and punctuation-only lines excluded), 49 methods. The bar is 400 significant lines; this is 1376 over it, 4.44× 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: ToolRegistry Packages/OsaurusCore/Tools/ToolRegistry.swift:178 — ClassTooLong — 1753 significant lines (blank, comment-only and punctuation-only lines excluded), 99 methods. The bar is 400 significant lines; this is 1353 over it, 4.38× 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: EvalRunner Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:18 — ClassTooLong — 1708 significant lines (blank, comment-only and punctuation-only lines excluded), 170 methods. The bar is 400 significant lines; this is 1308 over it, 4.27× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ConfigPlanner Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:170 — ClassTooLong — 1643 significant lines (blank, comment-only and punctuation-only lines excluded), 47 methods. The bar is 400 significant lines; this is 1243 over it, 4.11× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ChatWindowState Packages/OsaurusCore/Managers/Chat/ChatWindowState.swift:188 — ClassTooLong — 1626 significant lines (blank, comment-only and punctuation-only lines excluded), 115 methods. The bar is 400 significant lines; this is 1226 over it, 4.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: PluginHostContext Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:64 — ClassTooLong — 1616 significant lines (blank, comment-only and punctuation-only lines excluded), 120 methods. The bar is 400 significant lines; this is 1216 over it, 4.04× 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: AppleScriptLoop Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:305 — ClassTooLong — 1612 significant lines (blank, comment-only and punctuation-only lines excluded), 27 methods. The bar is 400 significant lines; this is 1212 over it, 4.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ChatView Packages/OsaurusCore/Views/Chat/ChatView.swift:10400 — ClassTooLong — 1531 significant lines (blank, comment-only and punctuation-only lines excluded), 56 methods. The bar is 400 significant lines; this is 1131 over it, 3.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AgentDatabase Packages/OsaurusCore/Storage/AgentDatabase.swift:289 — ClassTooLong — 1519 significant lines (blank, comment-only and punctuation-only lines excluded), 74 methods. The bar is 400 significant lines; this is 1119 over it, 3.80× 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: MLXBatchAdapter Packages/OsaurusCore/Services/ModelRuntime/MLXBatchAdapter.swift:33 — ClassTooLong — 1497 significant lines (blank, comment-only and punctuation-only lines excluded), 42 methods. The bar is 400 significant lines; this is 1097 over it, 3.74× 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: AgentChannelConnectionService Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:36 — ClassTooLong — 1496 significant lines (blank, comment-only and punctuation-only lines excluded), 57 methods. The bar is 400 significant lines; this is 1096 over it, 3.74× 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: ComputerUseLoop Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:175 — ClassTooLong — 1414 significant lines (blank, comment-only and punctuation-only lines excluded), 38 methods. The bar is 400 significant lines; this is 1014 over it, 3.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: AgentChannelMessageStore Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:466 — ClassTooLong — 1369 significant lines (blank, comment-only and punctuation-only lines excluded), 72 methods. The bar is 400 significant lines; this is 969 over it, 3.42× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: BackgroundTaskManager Packages/OsaurusCore/Managers/BackgroundTaskManager.swift:115 — ClassTooLong — 1343 significant lines (blank, comment-only and punctuation-only lines excluded), 115 methods. The bar is 400 significant lines; this is 943 over it, 3.36× 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: AgentToolLoop Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:1133 — ClassTooLong — 1327 significant lines (blank, comment-only and punctuation-only lines excluded), 46 methods. The bar is 400 significant lines; this is 927 over it, 3.32× 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: SettingsKitGallery Packages/OsaurusCore/Views/DesignSystem/SettingsKitGallery.swift:14 — ClassTooLong — 1232 significant lines (blank, comment-only and punctuation-only lines excluded), 4 methods. The bar is 400 significant lines; this is 832 over it, 3.08× 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: N8nSettingsView Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:23 — ClassTooLong — 1216 significant lines (blank, comment-only and punctuation-only lines excluded), 32 methods. The bar is 400 significant lines; this is 816 over it, 3.04× 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: NativeToolCallRowView Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:856 — ClassTooLong — 1193 significant lines (blank, comment-only and punctuation-only lines excluded), 54 methods. The bar is 400 significant lines; this is 793 over it, 2.98× 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.
  • + 159 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×149
  • Hotspot: Packages/OsaurusCore/Views/Chat/ChatView.swift Packages/OsaurusCore/Views/Chat/ChatView.swift:7577 — Packages/OsaurusCore/Views/Chat/ChatView.swift changed 127 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 289 in ChatSession.dispatchSend at line 7577. 16 of those changes were fix/bug commits, and the other 111 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Views/Chat/ChatView.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: Packages/OsaurusCore/Networking/HTTPHandler.swift Packages/OsaurusCore/Networking/HTTPHandler.swift:495 — Packages/OsaurusCore/Networking/HTTPHandler.swift changed 69 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 272 in HTTPHandler.channelRead at line 495. 6 of those changes were fix/bug commits, and the other 63 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Networking/HTTPHandler.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: Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:2359 — Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift changed 29 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 172 in AgentToolLoop.runHoldingResidency at line 2359. 4 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Services/Chat/AgentToolLoop.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: Packages/OsaurusCore/Services/ModelRuntime.swift Packages/OsaurusCore/Services/ModelRuntime.swift:4841 — Packages/OsaurusCore/Services/ModelRuntime.swift changed 74 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 61 in ModelRuntime.loadContainer at line 4841. 10 of those changes were fix/bug commits, and the other 64 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Services/ModelRuntime.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: Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:423 — Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 172 in ConfigPlanner.validate at line 423. 1 of those changes was a fix/bug commit, and the other 24 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.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: Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:2766 — Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift changed 33 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 117 in SystemPromptComposer.resolveTools at line 2766. 2 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Services/Chat/SystemPromptComposer.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: Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:1007 — Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift changed 93 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in FloatingInputCard.normalBody at line 1007. 11 of those changes were fix/bug commits, and the other 82 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Views/Chat/FloatingInputCard.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: Packages/OsaurusCore/AppDelegate.swift Packages/OsaurusCore/AppDelegate.swift:178 — Packages/OsaurusCore/AppDelegate.swift changed 48 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 61 in AppDelegate.applicationDidFinishLaunching at line 178. 7 of those changes were fix/bug commits, and the other 41 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/AppDelegate.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: Packages/OsaurusCore/Services/ModelRuntime/MLXBatchAdapter.swift Packages/OsaurusCore/Services/ModelRuntime/MLXBatchAdapter.swift:1320 — Packages/OsaurusCore/Services/ModelRuntime/MLXBatchAdapter.swift changed 43 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 60 in MLXBatchAdapter.additionalContext at line 1320. 4 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Services/ModelRuntime/MLXBatchAdapter.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: Packages/OsaurusCore/Tools/ToolRegistry.swift Packages/OsaurusCore/Tools/ToolRegistry.swift:1251 — Packages/OsaurusCore/Tools/ToolRegistry.swift changed 38 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 58 in ToolRegistry.execute at line 1251. 3 of those changes were fix/bug commits, and the other 35 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Tools/ToolRegistry.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: Packages/OsaurusCore/Subagent/SubagentSession.swift Packages/OsaurusCore/Subagent/SubagentSession.swift:549 — Packages/OsaurusCore/Subagent/SubagentSession.swift changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 124 in SubagentSession.runPreparedHost at line 549. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Subagent/SubagentSession.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: Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:2946 — Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift changed 30 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 69 in RemoteProviderService._streamRemote at line 2946. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Services/Provider/RemoteProviderService.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: Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:1636 — Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift changed 30 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 67 in ConfigApplier.applyMCPServers at line 1636. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.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: Packages/OsaurusCore/Models/Chat/ContentBlock.swift Packages/OsaurusCore/Models/Chat/ContentBlock.swift:646 — Packages/OsaurusCore/Models/Chat/ContentBlock.swift changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 113 in ContentBlock.generateBlocks at line 646. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Models/Chat/ContentBlock.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: Packages/OsaurusCore/Services/Chat/ChatEngine.swift Packages/OsaurusCore/Services/Chat/ChatEngine.swift:1376 — Packages/OsaurusCore/Services/Chat/ChatEngine.swift changed 29 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 54 in ChatEngine.wrapStreamWithLogging at line 1376. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Services/Chat/ChatEngine.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: Packages/OsaurusCore/Managers/Model/ModelManager.swift Packages/OsaurusCore/Managers/Model/ModelManager.swift:2299 — Packages/OsaurusCore/Managers/Model/ModelManager.swift changed 29 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 53 in ModelManager.scanLocalModels at line 2299. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Managers/Model/ModelManager.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: Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerAgentLoop.swift Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerAgentLoop.swift:33 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerAgentLoop.swift changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 109 in EvalRunner.runAgentLoopCaseWithSettings at line 33. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerAgentLoop.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: Packages/OsaurusCore/Folder/FolderTools.swift Packages/OsaurusCore/Folder/FolderTools.swift:1535 — Packages/OsaurusCore/Folder/FolderTools.swift changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 70 in FileReadTool.readResolved at line 1535. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Folder/FolderTools.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: Packages/OsaurusCore/Services/Chat/AgentTaskState.swift Packages/OsaurusCore/Services/Chat/AgentTaskState.swift:662 — Packages/OsaurusCore/Services/Chat/AgentTaskState.swift changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 78 in AgentTaskState.record at line 662. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Services/Chat/AgentTaskState.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: Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:4290 — Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 73 in NativeCellHeightEstimator.estimatedHeight at line 4290. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Views/Chat/NativeMessageCellView.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: Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.swift Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.swift:211 — Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.swift changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 116 in TokenizerBridge.applyChatTemplate at line 211. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.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: Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift:715 — Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 89 in AgentLoopEvaluator.runConversation at line 715. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.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: Packages/OsaurusCore/Views/Agent/AgentsView.swift Packages/OsaurusCore/Views/Agent/AgentsView.swift:1760 — Packages/OsaurusCore/Views/Agent/AgentsView.swift changed 44 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in AgentDetailView.bodyCore at line 1760. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Views/Agent/AgentsView.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: Packages/OsaurusCore/Services/ModelRuntime/GenerationEventMapper.swift Packages/OsaurusCore/Services/ModelRuntime/GenerationEventMapper.swift:67 — Packages/OsaurusCore/Services/ModelRuntime/GenerationEventMapper.swift changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 59 in GenerationEventMapper.map at line 67. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Services/ModelRuntime/GenerationEventMapper.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: Packages/OsaurusCore/Models/Configuration/LocalVisionEvidence.swift Packages/OsaurusCore/Models/Configuration/LocalVisionEvidence.swift:136 — Packages/OsaurusCore/Models/Configuration/LocalVisionEvidence.swift changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 89 in LocalVisionEvidence.read at line 136. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Models/Configuration/LocalVisionEvidence.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.
  • + 124 more in this group — see findings.md.
D3 · God Classes · TooManyMethods · ×102
  • TooManyMethods: HTTPHandler Packages/OsaurusCore/Networking/HTTPHandler.swift:222 — TooManyMethods — 258 methods, declared across 4 files: Networking/HTTPHandler.swift (241), Networking/HTTPProtocolErrors.swift (11), Networking/HTTPLoopHelpers.swift (4), Networking/HTTPRequestParse.swift (2). The bar is 30 methods; this is 228 over it, 8.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: ChatSession Packages/OsaurusCore/Views/Chat/ChatView.swift:157 — TooManyMethods — 221 methods, declared across 8 files: Chat/ChatView.swift (198), Workflow/WorkflowWorkModeResume.swift (6), Chat/ChatSession+Harness.swift (5), Chat/ChatSessionWarmup.swift (4), +4 more file(s). The bar is 30 methods; this is 191 over it, 7.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: ModelRuntime Packages/OsaurusCore/Services/ModelRuntime.swift:182 — TooManyMethods — 217 methods. The bar is 30 methods; this is 187 over it, 7.23× 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: RemoteProviderService Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:157 — TooManyMethods — 170 methods. The bar is 30 methods; this is 140 over it, 5.67× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: View Packages/OsaurusCore/DevelopmentDesign/CatalogBaseControlPreview.swift:235 — TooManyMethods — 129 methods, declared across 56 files: Theme/ComponentInspection.swift (10), DesignSystem/SettingsButtons.swift (8), InspectionAdapters/InspectorComposerChips.swift (7), InspectionAdapters/InspectorAgentPickerStyle.swift (6), +52 more file(s). The bar is 30 methods; this is 99 over it, 4.30× 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: PluginHostContext Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:64 — TooManyMethods — 120 methods, declared across 2 files: Plugin/PluginHostAPI.swift (115), Plugin/PluginHostAPI+SessionPersistence.swift (5). The bar is 30 methods; this is 90 over it, 4.00× 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: MemoryDatabase Packages/OsaurusCore/Storage/MemoryDatabase.swift:56 — TooManyMethods — 116 methods. The bar is 30 methods; this is 86 over it, 3.87× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: BackgroundTaskManager Packages/OsaurusCore/Managers/BackgroundTaskManager.swift:115 — TooManyMethods — 115 methods. The bar is 30 methods; this is 85 over it, 3.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ChatWindowState Packages/OsaurusCore/Managers/Chat/ChatWindowState.swift:188 — TooManyMethods — 115 methods. The bar is 30 methods; this is 85 over it, 3.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AgentManager Packages/OsaurusCore/Managers/AgentManager.swift:53 — TooManyMethods — 104 methods, declared across 2 files: Managers/AgentManager.swift (99), Managers/AgentManager+Harness.swift (5). The bar is 30 methods; this is 74 over it, 3.47× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ToolRegistry Packages/OsaurusCore/Tools/ToolRegistry.swift:178 — TooManyMethods — 99 methods. The bar is 30 methods; this is 69 over it, 3.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: AgentDetailView Packages/OsaurusCore/Views/Agent/AgentsView.swift:1251 — TooManyMethods — 99 methods. The bar is 30 methods; this is 69 over it, 3.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: FileChangeJournal Packages/OsaurusCore/Services/FileHistory/FileChangeJournal.swift:32 — TooManyMethods — 94 methods, declared across 3 files: FileHistory/FileChangeJournal.swift (61), FileHistory/FileChangeJournal+Revert.swift (32), FileHistory/FileDiffEngine.swift (1). The bar is 30 methods; this is 64 over it, 3.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: FloatingInputCard Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:35 — TooManyMethods — 94 methods. The bar is 30 methods; this is 64 over it, 3.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AppDelegate Packages/OsaurusCore/AppDelegate.swift:22 — TooManyMethods — 88 methods. The bar is 30 methods; this is 58 over it, 2.93× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: OsaurusRouterAPIClient Packages/OsaurusCore/Services/Router/OsaurusRouterAPIClient.swift:3 — TooManyMethods — 87 methods. The bar is 30 methods; this is 57 over it, 2.90× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: RemoteProviderManager Packages/OsaurusCore/Managers/RemoteProviderManager.swift:46 — TooManyMethods — 86 methods. The bar is 30 methods; this is 56 over it, 2.87× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: EventManager Packages/OsaurusCore/Services/Event/EventManager.swift:27 — TooManyMethods — 82 methods, declared across 2 files: Event/EventManager.swift (69), Event/ChannelMessageEventSource.swift (13). The bar is 30 methods; this is 52 over it, 2.73× 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: OsaurusEvalsCLI Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/OsaurusEvalsCLI.swift:28 — TooManyMethods — 77 methods, declared across 8 files: OsaurusEvalsCLI/EvalReviewReportCLI.swift (22), OsaurusEvalsCLI/OsaurusEvalsCLI.swift (15), OsaurusEvalsCLI/OsaurusEvalsCaptureScreenCLI.swift (12), OsaurusEvalsCLI/EvalDiffMatrixCLI.swift (10), +4 more file(s). The bar is 30 methods; this is 47 over it, 2.57× 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: ChatSessionSidebar Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:20 — TooManyMethods — 76 methods. The bar is 30 methods; this is 46 over it, 2.53× 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: ChatWindowManager Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift:64 — TooManyMethods — 74 methods. The bar is 30 methods; this is 44 over it, 2.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: WorkspacesService Packages/OsaurusCore/Services/Router/WorkspacesService.swift:15 — TooManyMethods — 74 methods. The bar is 30 methods; this is 44 over it, 2.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: AgentDatabase Packages/OsaurusCore/Storage/AgentDatabase.swift:289 — TooManyMethods — 74 methods. The bar is 30 methods; this is 44 over it, 2.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: MCPProviderManager Packages/OsaurusCore/Managers/MCPProviderManager.swift:19 — TooManyMethods — 73 methods. The bar is 30 methods; this is 43 over it, 2.43× 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: SlackConnectionService Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:328 — TooManyMethods — 72 methods. The bar is 30 methods; this is 42 over it, 2.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.
  • + 77 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×97
  • Duplicated block (5 lines × 2) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Show.swift:60 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Show.swift:60-65 | Packages/OsaurusCore/Models/API/OpenAIAPI.swift:1561-1565 — 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 `Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Show.swift:60` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsCreate.swift:586 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsCreate.swift:586-590 | Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsCreate.swift:964-968 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsCreate.swift:586` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) Packages/OsaurusCore/AppleApps/Support/AppleSchema.swift:14 — Packages/OsaurusCore/AppleApps/Support/AppleSchema.swift:14-18 | Packages/OsaurusCore/Tools/SandboxPluginTool.swift:315-320 — 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 `Packages/OsaurusCore/Tools/SandboxPluginTool.swift:315` 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) Packages/OsaurusCore/Folder/FolderTools.swift:3909 — Packages/OsaurusCore/Folder/FolderTools.swift:3909-3914 | Packages/OsaurusCore/Folder/RedactionTools.swift:509-513 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) Packages/OsaurusCore/Identity/APIKeyManager.swift:126 — Packages/OsaurusCore/Identity/APIKeyManager.swift:126-130 | Packages/OsaurusCore/Identity/APIKeyManager.swift:163-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 `Packages/OsaurusCore/Identity/APIKeyManager.swift:126` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) Packages/OsaurusCore/Managers/Chat/ChatSessionExportCoordinator.swift:154 — Packages/OsaurusCore/Managers/Chat/ChatSessionExportCoordinator.swift:154-158 | Packages/OsaurusCore/Managers/Chat/ChatSessionExporter.swift:318-322 — 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 (5 lines × 2) Packages/OsaurusCore/Managers/Model/ModelManager.swift:1591 — Packages/OsaurusCore/Managers/Model/ModelManager.swift:1591-1595 | Packages/OsaurusCore/Managers/Model/ModelManager.swift:1604-1608 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Managers/Model/ModelManager.swift:1591` 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 (5 lines × 2) Packages/OsaurusCore/Models/API/EmbeddingAPI.swift:25 — Packages/OsaurusCore/Models/API/EmbeddingAPI.swift:25-29 | Packages/OsaurusCore/Services/HuggingFaceService.swift:163-167 — 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 `Packages/OsaurusCore/Models/API/EmbeddingAPI.swift:25` 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) Packages/OsaurusCore/Models/AgentChannel/AgentChannelConfiguration.swift:263 — Packages/OsaurusCore/Models/AgentChannel/AgentChannelConfiguration.swift:263-267 | Packages/OsaurusCore/Models/AgentChannel/AgentChannelConfiguration.swift:310-314 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/Models/Configuration/MLXModel.swift:376 — Packages/OsaurusCore/Models/Configuration/MLXModel.swift:376-380 | Packages/OsaurusCore/Services/ModelRuntime.swift:6200-6220 — 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 `Packages/OsaurusCore/Models/Configuration/MLXModel.swift:376` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) Packages/OsaurusCore/Models/Template/TemplateRequirements.swift:132 — Packages/OsaurusCore/Models/Template/TemplateRequirements.swift:132-136 | Packages/OsaurusCore/Models/Workflow/FolderRequirement.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 `Packages/OsaurusCore/Models/Template/TemplateRequirements.swift:132` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:7396 — Packages/OsaurusCore/Networking/HTTPHandler.swift:7396-7400 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7451-7462 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:7396` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:12309 — Packages/OsaurusCore/Networking/HTTPHandler.swift:12309-12313 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12347-12351 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:12309` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:13259 — Packages/OsaurusCore/Networking/HTTPHandler.swift:13259-13263 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17842-17852 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:13259` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:16015 — Packages/OsaurusCore/Networking/HTTPHandler.swift:16015-16019 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16304-16308 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:16015` 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) Packages/OsaurusCore/PluginHost/main.swift:293 — Packages/OsaurusCore/PluginHost/main.swift:293-297 | Packages/OsaurusCore/PluginHost/main.swift:299-303 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/PluginHost/main.swift:293` 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) Packages/OsaurusCore/PluginHost/main.swift:559 — Packages/OsaurusCore/PluginHost/main.swift:559-563 | Packages/OsaurusCore/Services/Plugin/PluginProcessHost.swift:322-327 — 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 (5 lines × 2) Packages/OsaurusCore/PrivacyFilter/Views/RedactionReviewSheet.swift:114 — Packages/OsaurusCore/PrivacyFilter/Views/RedactionReviewSheet.swift:114-118 | Packages/OsaurusCore/PrivacyFilter/Views/RedactionReviewSheet.swift:319-323 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:217 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:217-221 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:500-505 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:500` 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 (5 lines × 2) Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:217 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:217-221 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:593-597 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:222` calls `bump`, `resolveConnection` and `Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:599` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) Packages/OsaurusCore/Services/Auth/PKCE.swift:56 — Packages/OsaurusCore/Services/Auth/PKCE.swift:56-60 | Packages/OsaurusCore/Services/Channels/ChannelSecurityEncoding.swift:12-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. 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) Packages/OsaurusCore/Services/Context/SubagentJobEvaluator.swift:1191 — Packages/OsaurusCore/Services/Context/SubagentJobEvaluator.swift:1191-1196 | Packages/OsaurusCore/Tools/Handoff/ConfiguratorHandoffTool.swift:251-255 — 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 (5 lines × 2) Packages/OsaurusCore/Services/Documents/OOXML/DOCXEditor.swift:213 — Packages/OsaurusCore/Services/Documents/OOXML/DOCXEditor.swift:213-217 | Packages/OsaurusCore/Services/Documents/OOXML/PPTXEditor.swift:136-140 — 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 `Packages/OsaurusCore/Services/Documents/OOXML/DOCXEditor.swift:213` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) Packages/OsaurusCore/Services/ExternalModelLocator.swift:558 — Packages/OsaurusCore/Services/ExternalModelLocator.swift:558-562 | Packages/OsaurusCore/Services/ExternalModelLocator.swift:579-583 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/ExternalModelLocator.swift:558` 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) Packages/OsaurusCore/Services/ExternalModelLocator.swift:1072 — Packages/OsaurusCore/Services/ExternalModelLocator.swift:1072-1076 | Packages/OsaurusCore/Services/ModelSizeCache.swift:129-135 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • + 72 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×95
  • Duplicated block (6 lines × 2) Packages/OsaurusCore/AppleApps/Calendar/CalendarService.swift:516 — Packages/OsaurusCore/AppleApps/Calendar/CalendarService.swift:516-521 | Packages/OsaurusCore/AppleApps/Reminders/RemindersService.swift:395-400 — 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) Packages/OsaurusCore/AppleApps/Notes/NotesTools.swift:127 — Packages/OsaurusCore/AppleApps/Notes/NotesTools.swift:127-132 | Packages/OsaurusCore/AppleApps/Notes/NotesTools.swift:196-201 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/AppleApps/Notes/NotesTools.swift:127` 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) Packages/OsaurusCore/Browser/Tool/BrowserChildTools.swift:128 — Packages/OsaurusCore/Browser/Tool/BrowserChildTools.swift:128-133 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3612-3619 — 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 `Packages/OsaurusCore/Browser/Tool/BrowserChildTools.swift:128` 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) Packages/OsaurusCore/ComputerUse/Driver/Mac/ElementCache.swift:128 — Packages/OsaurusCore/ComputerUse/Driver/Mac/ElementCache.swift:128-133 | Packages/OsaurusCore/ComputerUse/Driver/Mac/ElementCache.swift:176-181 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/ComputerUse/Driver/Mac/ElementCache.swift:128` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1479 — Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1479-1484 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2121-2126 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1479` 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) Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool.swift:708 — Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool.swift:708-713 | Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool.swift:727-732 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/DevelopmentDesign/DesignAgentSurfaceChecks.swift:13 — Packages/OsaurusCore/DevelopmentDesign/DesignAgentSurfaceChecks.swift:13-18 | Packages/OsaurusCore/DevelopmentDesign/DesignCatalogLayoutChecks.swift:9-14 — 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 `Packages/OsaurusCore/DevelopmentDesign/DesignAgentSurfaceChecks.swift:13` 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) Packages/OsaurusCore/Folder/WorkspaceWriteSafety.swift:559 — Packages/OsaurusCore/Folder/WorkspaceWriteSafety.swift:559-567 | Packages/OsaurusCore/Services/Knowledge/KnowledgeDiff.swift:94-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 `Packages/OsaurusCore/Folder/WorkspaceWriteSafety.swift:559` 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) Packages/OsaurusCore/Managers/Chat/ChatSessionImporter.swift:520 — Packages/OsaurusCore/Managers/Chat/ChatSessionImporter.swift:520-526 | Packages/OsaurusCore/Managers/Chat/ChatSessionImporter.swift:643-648 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Managers/Chat/ChatSessionImporter.swift:520` 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) Packages/OsaurusCore/Models/API/AnthropicAPI.swift:511 — Packages/OsaurusCore/Models/API/AnthropicAPI.swift:511-516 | Packages/OsaurusCore/Models/API/AnthropicAPI.swift:820-825 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Models/API/AnthropicAPI.swift:511` 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) Packages/OsaurusCore/Models/API/OpenAIAPI.swift:1654 — Packages/OsaurusCore/Models/API/OpenAIAPI.swift:1654-1664 | Packages/OsaurusCore/Tools/SchemaValidator.swift:853-858 — 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 `Packages/OsaurusCore/Models/API/OpenAIAPI.swift:1654` 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 (6 lines × 2) Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:1322 — Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:1322-1327 | Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:1536-1542 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:1322` 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) Packages/OsaurusCore/Models/AgentChannel/AgentChannelLiveProofReadiness.swift:99 — Packages/OsaurusCore/Models/AgentChannel/AgentChannelLiveProofReadiness.swift:99-104 | Packages/OsaurusCore/Models/AgentChannel/AgentChannelLiveProofReadiness.swift:160-165 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/PrivacyFilter/Model/PrivacyFilterModelDownloader.swift:467 — Packages/OsaurusCore/PrivacyFilter/Model/PrivacyFilterModelDownloader.swift:467-472 | Packages/OsaurusCore/Services/HuggingFaceService.swift:781-787 — 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 `Packages/OsaurusCore/PrivacyFilter/Model/PrivacyFilterModelDownloader.swift:467` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:133 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:133-138 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:343-348 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:133` 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) Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:141 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:141-146 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:352-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 `Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:141` 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) Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:148 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:148-153 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:360-365 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:148` 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) Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:3170 — Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:3170-3175 | Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:3182-3187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:3170` 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) Packages/OsaurusCore/Services/Chat/ToolResultMediaBridge.swift:43 — Packages/OsaurusCore/Services/Chat/ToolResultMediaBridge.swift:43-48 | Packages/OsaurusCore/Services/Chat/ToolResultMediaBridge.swift:50-55 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Chat/ToolResultMediaBridge.swift:50` 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) Packages/OsaurusCore/Services/Inference/MLXService.swift:677 — Packages/OsaurusCore/Services/Inference/MLXService.swift:677-682 | Packages/OsaurusCore/Services/Inference/MLXService.swift:687-692 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) Packages/OsaurusCore/Services/Method/MethodSearchService.swift:258 — Packages/OsaurusCore/Services/Method/MethodSearchService.swift:258-263 | Packages/OsaurusCore/Services/Tool/ToolSearchService.swift:894-899 — before extracting anything, compare `Packages/OsaurusCore/Services/Method/MethodSearchService.swift` and `Packages/OsaurusCore/Services/Tool/ToolSearchService.swift` as WHOLE FILES: this scan already matched 7 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 `Packages/OsaurusCore/Services/Method/MethodSearchService.swift:258` 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) Packages/OsaurusCore/Services/ModelRuntime/ImageGenerationTypes.swift:177 — Packages/OsaurusCore/Services/ModelRuntime/ImageGenerationTypes.swift:177-182 | Packages/OsaurusCore/Services/ModelRuntime/ImageGenerationTypes.swift:238-243 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/ModelRuntime/ImageGenerationTypes.swift:177` 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) Packages/OsaurusCore/Services/Template/WorkflowsRegistryAPIClient.swift:897 — Packages/OsaurusCore/Services/Template/WorkflowsRegistryAPIClient.swift:897-902 | Packages/OsaurusCore/Services/Template/WorkflowsRegistryAPIClient.swift:1118-1123 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Template/WorkflowsRegistryAPIClient.swift:897` 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) Packages/OsaurusCore/Services/Workflow/DialogCoordinator.swift:154 — Packages/OsaurusCore/Services/Workflow/DialogCoordinator.swift:154-159 | Packages/OsaurusCore/Views/Workflow/WorkflowFormView.swift:56-61 — 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 `Packages/OsaurusCore/Services/Workflow/DialogCoordinator.swift:154` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:1219 — Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:1219-1224 | Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:1250-1255 — both copies are in the same file, so extract the 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.
  • + 70 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×80
  • Duplicated block (9 lines × 2) Packages/OsaurusCore/AppleApps/Maps/MapsTools.swift:258 — Packages/OsaurusCore/AppleApps/Maps/MapsTools.swift:258-266 | Packages/OsaurusCore/AppleApps/Maps/MapsTools.swift:287-295 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/AppleApps/Maps/MapsTools.swift:258` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/AppleApps/Maps/MapsTools.swift:268` calls `boolean` and `Packages/OsaurusCore/AppleApps/Maps/MapsTools.swift:297` 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) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:2456 — Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:2456-2464 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:18-29 — 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 `Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:2456` 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) Packages/OsaurusCore/Folder/FileWriteDocumentRouting.swift:497 — Packages/OsaurusCore/Folder/FileWriteDocumentRouting.swift:497-505 | Packages/OsaurusCore/Services/Documents/OOXML/XLSXFormula.swift:53-61 — 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 (9 lines × 2) Packages/OsaurusCore/Folder/FolderTools.swift:4476 — Packages/OsaurusCore/Folder/FolderTools.swift:4476-4484 | Packages/OsaurusCore/Folder/FolderTools.swift:4601-4609 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Folder/FolderTools.swift:4476` 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 (9 lines × 2) Packages/OsaurusCore/Managers/SkillImportPolicy.swift:154 — Packages/OsaurusCore/Managers/SkillImportPolicy.swift:154-162 | Packages/OsaurusCore/Managers/SkillManager.swift:730-738 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (9 lines × 2) Packages/OsaurusCore/Models/AgentChannel/AgentChannelCustomJSONModels.swift:29 — Packages/OsaurusCore/Models/AgentChannel/AgentChannelCustomJSONModels.swift:29-37 | Packages/OsaurusCore/Services/Attention/Participant.swift:90-98 — 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 `Packages/OsaurusCore/Models/AgentChannel/AgentChannelCustomJSONModels.swift:29` 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 (9 lines × 2) Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:63 — Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:63-71 | Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:426-434 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.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 (9 lines × 2) Packages/OsaurusCore/Models/IMessage/IMessageConnectionConfiguration.swift:308 — Packages/OsaurusCore/Models/IMessage/IMessageConnectionConfiguration.swift:308-316 | Packages/OsaurusCore/Models/WhatsApp/WhatsAppConnectionConfiguration.swift:264-272 — before extracting anything, compare `Packages/OsaurusCore/Models/IMessage/IMessageConnectionConfiguration.swift` and `Packages/OsaurusCore/Models/WhatsApp/WhatsAppConnectionConfiguration.swift` as WHOLE FILES: this scan already matched 6 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (9 lines × 2) Packages/OsaurusCore/Models/Schedule/Schedule.swift:148 — Packages/OsaurusCore/Models/Schedule/Schedule.swift:148-156 | Packages/OsaurusCore/Models/Schedule/Schedule.swift:176-184 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Models/Schedule/Schedule.swift:148` 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) Packages/OsaurusCore/Models/Schedule/Schedule.swift:544 — Packages/OsaurusCore/Models/Schedule/Schedule.swift:544-552 | Packages/OsaurusCore/Models/Watcher/Watcher.swift:135-143 — 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 `Packages/OsaurusCore/Models/Schedule/Schedule.swift:544` 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) Packages/OsaurusCore/Models/Schedule/Schedule.swift:620 — Packages/OsaurusCore/Models/Schedule/Schedule.swift:620-628 | Packages/OsaurusCore/Models/Watcher/Watcher.swift:218-226 — 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 `Packages/OsaurusCore/Models/Schedule/Schedule.swift:620` 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) Packages/OsaurusCore/Models/Slack/SlackConnectionConfiguration.swift:632 — Packages/OsaurusCore/Models/Slack/SlackConnectionConfiguration.swift:632-640 | Packages/OsaurusCore/Services/Channels/ChannelReplyTokenService.swift:193-201 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (9 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:7541 — Packages/OsaurusCore/Networking/HTTPHandler.swift:7541-7549 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12497-12505 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:7541` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:8688 — Packages/OsaurusCore/Networking/HTTPHandler.swift:8688-8696 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8707-8715 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:12708 — Packages/OsaurusCore/Networking/HTTPHandler.swift:12708-12716 | Packages/OsaurusCore/Networking/HTTPHandler.swift:13093-13101 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:12708` 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, `Packages/OsaurusCore/Networking/HTTPHandler.swift:13092` calls `runRequestTask` and `Packages/OsaurusCore/Networking/HTTPHandler.swift:12706` 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 × 2) Packages/OsaurusCore/Services/AgentBridge/AgentBundleService.swift:524 — Packages/OsaurusCore/Services/AgentBridge/AgentBundleService.swift:524-532 | Packages/OsaurusCore/Services/AgentBridge/AgentBundleService.swift:535-543 — both copies are in the same file, so extract the 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 (9 lines × 2) Packages/OsaurusCore/Services/AgentBridge/AgentBundleService.swift:701 — Packages/OsaurusCore/Services/AgentBridge/AgentBundleService.swift:701-709 | Packages/OsaurusCore/Services/AgentBridge/AgentBundleService.swift:721-729 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/AgentBridge/AgentBundleService.swift:701` 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 (9 lines × 2) Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:405 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:405-413 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:427-435 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:405` 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) Packages/OsaurusCore/Services/BundledModelSeeder.swift:345 — Packages/OsaurusCore/Services/BundledModelSeeder.swift:345-353 | Packages/OsaurusCore/Services/Sync/SyncConfiguration.swift:79-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 `Packages/OsaurusCore/Services/BundledModelSeeder.swift:345` 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) Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:644 — Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:644-652 | Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:572-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.
  • Duplicated block (9 lines × 2) Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:1558 — Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:1558-1567 | Packages/OsaurusCore/Services/Documents/XLSXAdapter.swift:1056-1064 — 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 `Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:1558` 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) Packages/OsaurusCore/Services/GitHubAuth.swift:54 — Packages/OsaurusCore/Services/GitHubAuth.swift:54-62 | Packages/OsaurusCore/Services/HuggingFaceAuth.swift:65-73 — 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 `Packages/OsaurusCore/Services/GitHubAuth.swift:54` 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 (9 lines × 2) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:457 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:457-465 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:552-560 — 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 `Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:457` 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) Packages/OsaurusCore/Services/Inference/CoreModelService.swift:158 — Packages/OsaurusCore/Services/Inference/CoreModelService.swift:158-166 | Packages/OsaurusCore/Services/Inference/CoreModelService.swift:202-211 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Inference/CoreModelService.swift:202` 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) Packages/OsaurusCore/Services/MCP/MCPServerHub.swift:27 — Packages/OsaurusCore/Services/MCP/MCPServerHub.swift:27-35 | Packages/OsaurusCore/Services/Provider/ProviderConnectivityCenter.swift:27-35 — before extracting anything, compare `Packages/OsaurusCore/Services/MCP/MCPServerHub.swift` and `Packages/OsaurusCore/Services/Provider/ProviderConnectivityCenter.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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.
  • + 55 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×76
  • Duplicated block (8 lines × 2) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:306 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:306-313 | Packages/OsaurusCore/Services/HuggingFaceService.swift:773-780 — 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 (8 lines × 2) Packages/OsaurusCore/ComputerUse/Driver/NativeMacDriver.swift:235 — Packages/OsaurusCore/ComputerUse/Driver/NativeMacDriver.swift:235-242 | Packages/OsaurusCore/ComputerUse/Driver/NativeMacDriver.swift:253-260 — both copies are in the same file, so extract the 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 (8 lines × 2) Packages/OsaurusCore/Managers/Chat/ChatWindowState.swift:1130 — Packages/OsaurusCore/Managers/Chat/ChatWindowState.swift:1130-1137 | Packages/OsaurusCore/Managers/Chat/ChatWindowState.swift:1200-1208 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/Managers/Chat/ChatWindowState.swift:1357 — Packages/OsaurusCore/Managers/Chat/ChatWindowState.swift:1357-1364 | Packages/OsaurusCore/Managers/Chat/ChatWindowState.swift:1448-1455 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Managers/Chat/ChatWindowState.swift:1357` 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 (8 lines × 2) Packages/OsaurusCore/Managers/MCPProviderManager.swift:2016 — Packages/OsaurusCore/Managers/MCPProviderManager.swift:2016-2023 | Packages/OsaurusCore/Services/MCP/MCPProviderProbeService.swift:589-597 — 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 `Packages/OsaurusCore/Services/MCP/MCPProviderProbeService.swift:589` 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) Packages/OsaurusCore/Models/Agent/DefaultAgentConfigurationStore.swift:114 — Packages/OsaurusCore/Models/Agent/DefaultAgentConfigurationStore.swift:114-121 | Packages/OsaurusCore/Models/Configuration/AppConfiguration.swift:230-237 — 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 `Packages/OsaurusCore/Models/Agent/DefaultAgentConfigurationStore.swift:114` 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) Packages/OsaurusCore/Models/AgentChannel/AgentChannelLiveProofReadiness.swift:411 — Packages/OsaurusCore/Models/AgentChannel/AgentChannelLiveProofReadiness.swift:411-425 | Packages/OsaurusCore/Services/Attention/Participant.swift:234-241 — 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 `Packages/OsaurusCore/Models/AgentChannel/AgentChannelLiveProofReadiness.swift:411` 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 lines × 2) Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:65 — Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:65-72 | Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:309-316 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:65` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:1823 — Packages/OsaurusCore/Networking/HTTPHandler.swift:1823-1830 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16708-16715 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:1823` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:18027 — Packages/OsaurusCore/Networking/HTTPHandler.swift:18027-18034 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18113-18120 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/PrivacyFilter/Views/PrivacyPresetRulesSection.swift:322 — Packages/OsaurusCore/PrivacyFilter/Views/PrivacyPresetRulesSection.swift:322-329 | Packages/OsaurusCore/Views/Knowledge/KnowledgeView.swift:571-578 — 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 `Packages/OsaurusCore/PrivacyFilter/Views/PrivacyPresetRulesSection.swift:322` 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) Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:262 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:262-269 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:272-279 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:262` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:345 — Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:345-352 | Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:355-362 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:407 — Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:407-414 | Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:453-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 `Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:407` 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) Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:796 — Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:796-805 | Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:883-890 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:796` 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) Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:851 — Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:851-858 | Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:883-890 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:851` 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) Packages/OsaurusCore/Services/Documents/BusinessDocumentStudioService.swift:876 — Packages/OsaurusCore/Services/Documents/BusinessDocumentStudioService.swift:876-883 | Packages/OsaurusCore/Services/Documents/PDFPPTXWorkflowService.swift:251-264 — 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 `Packages/OsaurusCore/Services/Documents/PDFPPTXWorkflowService.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. 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) Packages/OsaurusCore/Services/Documents/PDFPPTXWorkflowService.swift:114 — Packages/OsaurusCore/Services/Documents/PDFPPTXWorkflowService.swift:114-121 | Packages/OsaurusCore/Services/Documents/PDFPPTXWorkflowService.swift:186-193 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:326 — Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:326-333 | Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:343-350 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/Services/Email/SMTPClient.swift:279 — Packages/OsaurusCore/Services/Email/SMTPClient.swift:279-286 | Packages/OsaurusCore/Services/Event/Email/IMAPClient.swift:580-587 — 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 `Packages/OsaurusCore/Services/Email/SMTPClient.swift:279` 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) Packages/OsaurusCore/Services/Event/Stream/SSEEventSource.swift:92 — Packages/OsaurusCore/Services/Event/Stream/SSEEventSource.swift:92-99 | Packages/OsaurusCore/Services/Provider/OpenAICompatibleStreamParser.swift:183-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 `Packages/OsaurusCore/Services/Event/Stream/SSEEventSource.swift:92` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) Packages/OsaurusCore/Services/Event/WebhookProviderProfile.swift:476 — Packages/OsaurusCore/Services/Event/WebhookProviderProfile.swift:476-483 | Packages/OsaurusCore/Services/MobileConnect/PairingCode.swift:77-84 — 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) Packages/OsaurusCore/Services/GitHubSkillService.swift:460 — Packages/OsaurusCore/Services/GitHubSkillService.swift:460-467 | Packages/OsaurusCore/Services/Skill/ClaudePluginManifestStore.swift:142-149 — 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) Packages/OsaurusCore/Services/Inference/CoreModelService.swift:905 — Packages/OsaurusCore/Services/Inference/CoreModelService.swift:905-912 | Packages/OsaurusCore/Services/Voice/TranscriptionCleanupService.swift:154-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.
  • Duplicated block (8 lines × 2) Packages/OsaurusCore/Services/Keychain/Keychain.swift:295 — Packages/OsaurusCore/Services/Keychain/Keychain.swift:295-302 | Packages/OsaurusCore/Services/Keychain/Keychain.swift:311-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. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Keychain/Keychain.swift:295` 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.
  • + 51 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×73
  • Duplicated block (7 lines × 2) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:227 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:227-233 | Packages/OsaurusCore/Services/HuggingFaceService.swift:943-949 — 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 `Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:227` 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) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsList.swift:38 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsList.swift:38-45 | Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsUninstall.swift:77-83 — 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 `Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsList.swift:38` 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) Packages/OsaurusCore/AppleApps/Support/AppleScriptBridge.swift:232 — Packages/OsaurusCore/AppleApps/Support/AppleScriptBridge.swift:232-238 | Packages/OsaurusCore/Models/Configuration/CodexCLIConfiguration.swift:353-359 — 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 `Packages/OsaurusCore/AppleApps/Support/AppleScriptBridge.swift:232` 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) Packages/OsaurusCore/Browser/Runtime/BrowserSessionCatalog.swift:185 — Packages/OsaurusCore/Browser/Runtime/BrowserSessionCatalog.swift:185-191 | Packages/OsaurusCore/Models/Agent/AgentInviteStore.swift:238-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 `Packages/OsaurusCore/Browser/Runtime/BrowserSessionCatalog.swift:185` 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) Packages/OsaurusCore/Browser/Tool/BrowserToolExecutor.swift:504 — Packages/OsaurusCore/Browser/Tool/BrowserToolExecutor.swift:504-510 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/FixtureBrowserWorld.swift:261-267 — 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 `Packages/OsaurusCore/Browser/Tool/BrowserToolExecutor.swift:504` 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) Packages/OsaurusCore/Configuration/Declarative/AgentToolSelectionResolver.swift:61 — Packages/OsaurusCore/Configuration/Declarative/AgentToolSelectionResolver.swift:61-67 | Packages/OsaurusCore/Configuration/Declarative/AgentToolSelectionResolver.swift:133-139 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2268 — Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2268-2274 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2292-2298 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2268` 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) Packages/OsaurusCore/DevelopmentDesign/DesignAgentSurfaceChecks.swift:89 — Packages/OsaurusCore/DevelopmentDesign/DesignAgentSurfaceChecks.swift:89-95 | Packages/OsaurusCore/DevelopmentDesign/DesignCatalogLayoutChecks.swift:82-88 — 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 `Packages/OsaurusCore/DevelopmentDesign/DesignAgentSurfaceChecks.swift:89` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Packages/OsaurusCore/DevelopmentDesign/DesignCatalogLayoutChecks.swift:81` calls `reset`, `check` and `Packages/OsaurusCore/DevelopmentDesign/DesignAgentSurfaceChecks.swift:88` 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) Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift:986 — Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift:986-992 | Packages/OsaurusCore/Managers/WindowManager.swift:505-511 — 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 `Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift:986` 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) Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:246 — Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:246-252 | Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:285-291 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:1343 — Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:1343-1349 | Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:1356-1363 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:1343` 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) Packages/OsaurusCore/Managers/SkillManager.swift:1027 — Packages/OsaurusCore/Managers/SkillManager.swift:1027-1033 | Packages/OsaurusCore/Managers/SkillManager.swift:1058-1064 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Managers/SkillManager.swift:1027` 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, `Packages/OsaurusCore/Managers/SkillManager.swift:1066` calls `deletingLastPathComponent` and `Packages/OsaurusCore/Managers/SkillManager.swift:1035` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) Packages/OsaurusCore/Models/Chat/SharedArtifact.swift:784 — Packages/OsaurusCore/Models/Chat/SharedArtifact.swift:784-790 | Packages/OsaurusCore/Tools/Database/DatabaseFilePathResolver.swift:294-300 — 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 `Packages/OsaurusCore/Models/Chat/SharedArtifact.swift:784` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:13453 — Packages/OsaurusCore/Networking/HTTPHandler.swift:13453-13462 | Packages/OsaurusCore/Services/Harness/HarnessTurnDriver.swift:95-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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:13453` 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) Packages/OsaurusCore/Services/AgentDelegation/NativeImageJobCoordinator.swift:78 — Packages/OsaurusCore/Services/AgentDelegation/NativeImageJobCoordinator.swift:78-84 | Packages/OsaurusCore/Services/AgentDelegation/NativeImageJobCoordinator.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. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/AgentDelegation/NativeImageJobCoordinator.swift:78` 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) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3528 — Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3528-3534 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3695-3701 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3528` 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) Packages/OsaurusCore/Services/ChatImport/SafeImportFetcher.swift:204 — Packages/OsaurusCore/Services/ChatImport/SafeImportFetcher.swift:204-210 | Packages/OsaurusCore/Services/ChatImport/SafeImportFetcher.swift:259-265 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/ChatImport/SafeImportFetcher.swift:204` 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) Packages/OsaurusCore/Services/Documents/PDFTableDetector.swift:33 — Packages/OsaurusCore/Services/Documents/PDFTableDetector.swift:33-39 | Packages/OsaurusCore/Services/Documents/PDFTableDetector.swift:50-56 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:503 — Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:503-509 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppRPCClient.swift:597-603 — before extracting anything, compare `Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift` and `Packages/OsaurusCore/Services/WhatsApp/WhatsAppRPCClient.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 116 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 `Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:503` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:49 — Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:49-55 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppWatchTransportRuntime.swift:44-50 — before extracting anything, compare `Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift` and `Packages/OsaurusCore/Services/WhatsApp/WhatsAppWatchTransportRuntime.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 88 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 `Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:49` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) Packages/OsaurusCore/Services/LocalReasoningCapability.swift:675 — Packages/OsaurusCore/Services/LocalReasoningCapability.swift:675-682 | Packages/OsaurusCore/Services/LocalReasoningCapability.swift:712-718 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/Services/ModelRuntime/ModelResidencyManager.swift:72 — Packages/OsaurusCore/Services/ModelRuntime/ModelResidencyManager.swift:72-78 | Packages/OsaurusCore/Services/ModelRuntime/ModelResidencyManager.swift:153-159 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/ModelRuntime/ModelResidencyManager.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.
  • Duplicated block (7 lines × 2) Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.swift:810 — Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.swift:810-816 | Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.swift:818-824 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.swift:810` 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) Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:701 — Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:701-707 | Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:710-716 — both copies are in the same file, so extract the 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 (7 lines × 2) Packages/OsaurusCore/Storage/MemoryDatabase.swift:988 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:988-994 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:1061-1067 — both copies are in the same file, so extract the 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.
  • + 48 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (9 corresponding lines) · ×68
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:1003 — Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:1003-1011 | Packages/OsaurusRepository/PluginInstallManager.swift:308-316 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:69 — Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:69-80 | Packages/OsaurusCore/AppleApps/Messages/MessagesTools.swift:57-65 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/Models/Chat/RequestLog.swift:42 — Packages/OsaurusCore/Models/Chat/RequestLog.swift:42-50 | Packages/OsaurusCore/Models/Theme/CustomTheme.swift:43-51 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/Models/Agent/Skill.swift:899 — Packages/OsaurusCore/Models/Agent/Skill.swift:899-907 | Packages/OsaurusRepository/OsaurusBundle.swift:347-355 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/AppleApps/Support/AppleSchema.swift:13 — Packages/OsaurusCore/AppleApps/Support/AppleSchema.swift:13-21 | Packages/OsaurusCore/AppleApps/Support/AppleSchema.swift:26-35 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ComputerUseScorecard.swift:512 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ComputerUseScorecard.swift:512-523 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ComputerUseScorecard.swift:558-566 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/Networking/HTTPHandler.swift:13464 — Packages/OsaurusCore/Networking/HTTPHandler.swift:13464-13477 | Packages/OsaurusCore/Tools/CapabilityTools.swift:314-322 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/Services/Inference/ModelService.swift:322 — Packages/OsaurusCore/Services/Inference/ModelService.swift:322-330 | Packages/OsaurusCore/Services/Inference/ModelService.swift:505-513 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/Models/API/OpenAIAPI.swift:1446 — Packages/OsaurusCore/Models/API/OpenAIAPI.swift:1446-1454 | Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:613-627 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/Views/Workflow/Library/WorkflowLibraryKit.swift:844 — Packages/OsaurusCore/Views/Workflow/Library/WorkflowLibraryKit.swift:844-852 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowLibraryKit.swift:856-866 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/Models/Theme/InspectionAdapters/AssignedMenuPresentation.swift:327 — Packages/OsaurusCore/Models/Theme/InspectionAdapters/AssignedMenuPresentation.swift:327-338 | Packages/OsaurusCore/Models/Theme/InspectionAdapters/AssignedMenuPresentation.swift:350-358 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:1668 — Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:1668-1676 | Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:1809-1818 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/Services/Template/WorkflowsRegistryAPIClient.swift:740 — Packages/OsaurusCore/Services/Template/WorkflowsRegistryAPIClient.swift:740-749 | Packages/OsaurusCore/Services/Template/WorkflowsRegistryAPIClient.swift:937-945 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/Services/Documents/OOXML/PPTXEditor.swift:54 — Packages/OsaurusCore/Services/Documents/OOXML/PPTXEditor.swift:54-62 | Packages/OsaurusCore/Services/Documents/OOXML/XLSXEditor.swift:130-138 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/Services/LocalReasoningCapability.swift:573 — Packages/OsaurusCore/Services/LocalReasoningCapability.swift:573-581 | Packages/OsaurusCore/Services/LocalReasoningCapability.swift:588-598 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/Services/Sync/SyncHostedRunMonitor.swift:278 — Packages/OsaurusCore/Services/Sync/SyncHostedRunMonitor.swift:278-286 | Packages/OsaurusCore/Services/Sync/SyncInboundApplier.swift:396-404 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/Services/Credentials/AppKeys.swift:122 — Packages/OsaurusCore/Services/Credentials/AppKeys.swift:122-131 | Packages/OsaurusCore/Services/Credentials/AppKeys.swift:134-142 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/Views/Plugin/PluginConfigView.swift:139 — Packages/OsaurusCore/Views/Plugin/PluginConfigView.swift:139-147 | Packages/OsaurusCore/Views/Plugin/PluginConfigView.swift:235-244 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:1218 — Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:1218-1226 | Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:1283-1295 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/Views/Chat/ChatImportReviewView.swift:164 — Packages/OsaurusCore/Views/Chat/ChatImportReviewView.swift:164-172 | Packages/OsaurusCore/Views/Settings/StorageSettingsView.swift:446-457 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/Storage/EncryptedSQLiteOpener.swift:202 — Packages/OsaurusCore/Storage/EncryptedSQLiteOpener.swift:202-212 | Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1318-1326 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/Managers/AgentManager.swift:1456 — Packages/OsaurusCore/Managers/AgentManager.swift:1456-1464 | Packages/OsaurusCore/Managers/AgentManager.swift:1470-1480 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/Services/Email/SMTPClient.swift:269 — Packages/OsaurusCore/Services/Email/SMTPClient.swift:269-277 | Packages/OsaurusCore/Services/Event/Email/IMAPClient.swift:570-578 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/Tools/Workflow/WorkflowTools.swift:447 — Packages/OsaurusCore/Tools/Workflow/WorkflowTools.swift:447-455 | Packages/OsaurusCore/Tools/Workflow/WorkflowTools.swift:643-651 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Packages/OsaurusCore/Models/Agent/Agent.swift:819 — Packages/OsaurusCore/Models/Agent/Agent.swift:819-835 | Packages/OsaurusCore/Views/DesignSystem/SettingsChips.swift:61-69 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 43 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (6 corresponding lines) · ×67
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/Services/MediaGeneration/MediaGenerationTypes.swift:123 — Packages/OsaurusCore/Services/MediaGeneration/MediaGenerationTypes.swift:123-132 | Packages/OsaurusCore/Services/MediaGeneration/VeniceMediaCatalog.swift:181-186 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/Services/MCP/MCPProviderKeychain.swift:116 — Packages/OsaurusCore/Services/MCP/MCPProviderKeychain.swift:116-121 | Packages/OsaurusCore/Services/Provider/RemoteProviderKeychain.swift:151-156 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:1895 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:1895-1900 | Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:3060-3066 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/Services/MCP/MCPProviderKeychain.swift:123 — Packages/OsaurusCore/Services/MCP/MCPProviderKeychain.swift:123-128 | Packages/OsaurusCore/Services/Provider/RemoteProviderKeychain.swift:158-163 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/Services/Workflow/WorkflowConnections.swift:393 — Packages/OsaurusCore/Services/Workflow/WorkflowConnections.swift:393-398 | Packages/OsaurusCore/Services/Workflow/WorkflowConnections.swift:400-406 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/Services/Event/EventManager.swift:332 — Packages/OsaurusCore/Services/Event/EventManager.swift:332-339 | Packages/OsaurusCore/Services/Event/EventManager.swift:343-348 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/Managers/Chat/ChatSessionExportCoordinator.swift:153 — Packages/OsaurusCore/Managers/Chat/ChatSessionExportCoordinator.swift:153-158 | Packages/OsaurusCore/Managers/Chat/ChatSessionExporter.swift:317-322 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/Models/Configuration/ModelOptions.swift:608 — Packages/OsaurusCore/Models/Configuration/ModelOptions.swift:608-615 | Packages/OsaurusCore/Models/Configuration/ModelPickerItem.swift:444-449 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/Identity/IdentityModels.swift:239 — Packages/OsaurusCore/Identity/IdentityModels.swift:239-244 | Packages/OsaurusCore/Identity/RevocationStore.swift:53-60 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/Models/Theme/DesignLibrary/InspectorAssignedProgress.swift:80 — Packages/OsaurusCore/Models/Theme/DesignLibrary/InspectorAssignedProgress.swift:80-85 | Packages/OsaurusCore/Models/Theme/DesignLibrary/InspectorAssignedProgress.swift:86-91 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/Models/Theme/Theme.swift:271 — Packages/OsaurusCore/Models/Theme/Theme.swift:271-276 | Packages/OsaurusCore/Models/Theme/Theme.swift:279-284 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1030 — Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1030-1035 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1078-1084 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:460 — Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:460-465 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:852-857 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/Services/Chat/AgentTaskState.swift:1558 — Packages/OsaurusCore/Services/Chat/AgentTaskState.swift:1558-1563 | Packages/OsaurusCore/Views/Chat/ToolDisplayName.swift:198-204 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/ComputerUse/Driver/Mac/BackgroundDriver.swift:297 — Packages/OsaurusCore/ComputerUse/Driver/Mac/BackgroundDriver.swift:297-302 | Packages/OsaurusCore/ComputerUse/Driver/Mac/InputController.swift:116-123 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/Services/Insights/EventActivityLogger.swift:59 — Packages/OsaurusCore/Services/Insights/EventActivityLogger.swift:59-64 | Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/OsaurusEvalsCaptureScreenCLI.swift:393-402 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/Services/ModelDownloadService.swift:967 — Packages/OsaurusCore/Services/ModelDownloadService.swift:967-972 | Packages/OsaurusCore/Services/ModelDownloadService.swift:982-988 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/Views/Plugin/SandboxPluginEditorView.swift:590 — Packages/OsaurusCore/Views/Plugin/SandboxPluginEditorView.swift:590-595 | Packages/OsaurusCore/Views/Plugin/SandboxPluginEditorView.swift:597-602 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/Services/Channels/ChannelReplayNonceStore.swift:160 — Packages/OsaurusCore/Services/Channels/ChannelReplayNonceStore.swift:160-165 | Packages/OsaurusCore/Services/Channels/ChannelWriteKillSwitch.swift:139-144 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:1848 — Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:1848-1853 | Packages/OsaurusCore/Tools/OsaurusTool.swift:443-448 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/Views/Event/EventsView.swift:384 — Packages/OsaurusCore/Views/Event/EventsView.swift:384-389 | Packages/OsaurusCore/Views/Knowledge/KnowledgeView.swift:723-733 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:2263 — Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:2263-2268 | Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:2303-2308 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/DevelopmentDesign/DesignWorkingStore.swift:252 — Packages/OsaurusCore/DevelopmentDesign/DesignWorkingStore.swift:252-257 | Packages/OsaurusCore/DevelopmentDesign/DesignWorkingStore.swift:258-263 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/Services/Credentials/CredentialBinding.swift:173 — Packages/OsaurusCore/Services/Credentials/CredentialBinding.swift:173-178 | Packages/OsaurusCore/Services/Credentials/CredentialBinding.swift:180-185 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Packages/OsaurusCore/Services/Workflow/ToolNodeExecutor.swift:279 — Packages/OsaurusCore/Services/Workflow/ToolNodeExecutor.swift:279-286 | Packages/OsaurusCore/Services/Workflow/WorkflowEvalHarness.swift:931-936 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 42 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (4 corresponding lines) · ×66
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/Views/Chat/NativeCompactionMarkerView.swift:46 — Packages/OsaurusCore/Views/Chat/NativeCompactionMarkerView.swift:46-49 | Packages/OsaurusCore/Views/Chat/TerminalDisplayView.swift:262-266 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/DevelopmentDesign/CatalogInspector.swift:177 — Packages/OsaurusCore/DevelopmentDesign/CatalogInspector.swift:177-180 | Packages/OsaurusCore/DevelopmentDesign/DesignInspectorView.swift:235-238 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/Services/AgentChannel/AgentChannelAutoDestinationResolver.swift:137 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelAutoDestinationResolver.swift:137-146 | Packages/OsaurusCore/Services/AgentChannel/ChannelAgentRoster.swift:334-337 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/Services/FeatureTelemetry.swift:559 — Packages/OsaurusCore/Services/FeatureTelemetry.swift:559-567 | Packages/OsaurusCore/Services/Onboarding/DiscoveryStore.swift:72-75 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/Services/Credentials/Consumers/WorkflowCredentials.swift:40 — Packages/OsaurusCore/Services/Credentials/Consumers/WorkflowCredentials.swift:40-43 | Packages/OsaurusCore/Services/Credentials/Consumers/WorkflowCredentials.swift:45-48 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:1652 — Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:1652-1657 | Packages/OsaurusCore/Utils/ZipArchive.swift:277-280 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/Managers/TTSService.swift:797 — Packages/OsaurusCore/Managers/TTSService.swift:797-800 | Packages/OsaurusCore/Services/Documents/OOXML/OOXMLText.swift:392-395 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/Services/Workflow/WorkflowWorkModeResume.swift:49 — Packages/OsaurusCore/Services/Workflow/WorkflowWorkModeResume.swift:49-52 | Packages/OsaurusCore/Storage/MethodDatabase.swift:525-528 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/Views/Settings/StorageSettingsView.swift:434 — Packages/OsaurusCore/Views/Settings/StorageSettingsView.swift:434-444 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowModelSourceRow.swift:193-196 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/Services/Sandbox/SandboxRootfsTemplateStore.swift:44 — Packages/OsaurusCore/Services/Sandbox/SandboxRootfsTemplateStore.swift:44-50 | Packages/OsaurusCore/Identity/DeviceKey.swift:106-109 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/Services/Sync/SyncHostedRunContract.swift:222 — Packages/OsaurusCore/Services/Sync/SyncHostedRunContract.swift:222-225 | Packages/OsaurusCore/Storage/SchedulerDatabase.swift:609-612 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:7991 — Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:7991-7995 | Packages/OsaurusCore/Views/DesignSystem/SettingsRow.swift:472-475 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/Views/Project/ProjectsView.swift:467 — Packages/OsaurusCore/Views/Project/ProjectsView.swift:467-470 | Packages/OsaurusCore/Views/Credentials/KeysView.swift:193-196 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:421 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:421-424 | Packages/OsaurusCore/Services/HuggingFaceService.swift:1082-1085 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/Services/Knowledge/KnowledgeWriteService.swift:508 — Packages/OsaurusCore/Services/Knowledge/KnowledgeWriteService.swift:508-511 | Packages/OsaurusCore/Views/Event/WorkflowInputBindingEditor.swift:207-210 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/Views/Template/PublishedWorkflowDashboard.swift:405 — Packages/OsaurusCore/Views/Template/PublishedWorkflowDashboard.swift:405-408 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowLibraryKit.swift:96-99 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/Models/Chat/WorkspaceSessionContext.swift:119 — Packages/OsaurusCore/Models/Chat/WorkspaceSessionContext.swift:119-122 | Packages/OsaurusCore/Tools/Handoff/HandoffContracts.swift:149-152 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/Services/ChatImport/ChatImportFastPaths.swift:238 — Packages/OsaurusCore/Services/ChatImport/ChatImportFastPaths.swift:238-241 | Packages/OsaurusCore/Services/ChatImport/ChatImportVerifier.swift:414-417 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/Views/Agent/AgentsView.swift:27 — Packages/OsaurusCore/Views/Agent/AgentsView.swift:27-30 | Packages/OsaurusCore/Views/Workspaces/WorkspacesView.swift:20-23 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/Services/Sync/SyncHostRunner.swift:659 — Packages/OsaurusCore/Services/Sync/SyncHostRunner.swift:659-662 | Packages/OsaurusCore/Views/Chat/ChatView.swift:11168-11172 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorAgentProgressStyle.swift:16 — Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorAgentProgressStyle.swift:16-19 | Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorPromptStyle.swift:21-24 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:567 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:567-573 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalDiff.swift:538-541 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/Models/Chat/DispatchEnvelope.swift:172 — Packages/OsaurusCore/Models/Chat/DispatchEnvelope.swift:172-175 | Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:2134-2137 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/Services/AgentCreation/AgentDraftStore.swift:43 — Packages/OsaurusCore/Services/AgentCreation/AgentDraftStore.swift:43-46 | Packages/OsaurusCore/Services/Workflow/WorkflowDraftStore.swift:60-63 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Packages/OsaurusCore/Services/Auth/OwnerDeviceAccessHost.swift:328 — Packages/OsaurusCore/Services/Auth/OwnerDeviceAccessHost.swift:328-331 | Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:225-228 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 41 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (7 corresponding lines) · ×63
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorModelPickerStyle.swift:48 — Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorModelPickerStyle.swift:48-56 | Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorSuggestionStyle.swift:40-46 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorNativeComponentStyle.swift:32 — Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorNativeComponentStyle.swift:32-38 | Packages/OsaurusCore/Models/Theme/ThemeTextStyleModifier.swift:110-129 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Managers/Model/ModelManager.swift:1589 — Packages/OsaurusCore/Managers/Model/ModelManager.swift:1589-1595 | Packages/OsaurusCore/Managers/Model/ModelManager.swift:1600-1608 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:687 — Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:687-693 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:907-916 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Models/Agent/AgentDispatchTarget.swift:294 — Packages/OsaurusCore/Models/Agent/AgentDispatchTarget.swift:294-300 | Packages/OsaurusCore/Models/Email/EmailChannelConfiguration.swift:255-262 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Models/Chat/Attachment.swift:543 — Packages/OsaurusCore/Models/Chat/Attachment.swift:543-556 | Packages/OsaurusCore/Services/Workflow/MediaNodeExecutor.swift:1095-1101 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Models/Template/Template.swift:402 — Packages/OsaurusCore/Models/Template/Template.swift:402-408 | Packages/OsaurusCore/Services/AgentChannel/ChannelAgentRoster.swift:288-294 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Services/Router/WorkspaceAuditLog.swift:810 — Packages/OsaurusCore/Services/Router/WorkspaceAuditLog.swift:810-817 | Packages/OsaurusCore/Storage/ActivityLogStore.swift:565-571 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Views/Credentials/VaultAccountsView.swift:308 — Packages/OsaurusCore/Views/Credentials/VaultAccountsView.swift:308-314 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowConnectionsSheet.swift:126-133 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/ComputerUse/Feed/ComputerUsePromptQueue.swift:279 — Packages/OsaurusCore/ComputerUse/Feed/ComputerUsePromptQueue.swift:279-285 | Packages/OsaurusCore/Configuration/Declarative/ConfigApprovalQueue.swift:189-196 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Services/Inference/ModelService.swift:306 — Packages/OsaurusCore/Services/Inference/ModelService.swift:306-312 | Packages/OsaurusCore/Services/Inference/ModelService.swift:497-503 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Services/Credentials/CredentialResolver.swift:81 — Packages/OsaurusCore/Services/Credentials/CredentialResolver.swift:81-87 | Packages/OsaurusCore/Services/Credentials/CredentialResolver.swift:92-99 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Services/Credentials/Consumers/PluginCredentials.swift:83 — Packages/OsaurusCore/Services/Credentials/Consumers/PluginCredentials.swift:83-89 | Packages/OsaurusCore/Services/Credentials/Consumers/PluginCredentials.swift:93-99 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Models/Configuration/EmbeddingDetection.swift:171 — Packages/OsaurusCore/Models/Configuration/EmbeddingDetection.swift:171-177 | Packages/OsaurusCore/Models/Configuration/VLMDetection.swift:47-56 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Models/Theme/ThemeRoles.swift:299 — Packages/OsaurusCore/Models/Theme/ThemeRoles.swift:299-305 | Packages/OsaurusCore/Models/Theme/ThemeRoles.swift:442-448 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Subagent/Kinds/TextSubagentKind.swift:1739 — Packages/OsaurusCore/Subagent/Kinds/TextSubagentKind.swift:1739-1754 | Packages/OsaurusCore/Tools/Handoff/HiddenAgentHandoffRunner.swift:159-165 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:2045 — Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:2045-2051 | Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:2055-2061 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Services/ChatImport/ChatImportFastPaths.swift:178 — Packages/OsaurusCore/Services/ChatImport/ChatImportFastPaths.swift:178-184 | Packages/OsaurusCore/Services/ChatImport/ChatImportFastPaths.swift:186-192 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Services/AgentBridge/AgentBundleService.swift:746 — Packages/OsaurusCore/Services/AgentBridge/AgentBundleService.swift:746-752 | Packages/OsaurusCore/Services/AgentBridge/AgentBundleService.swift:754-761 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:1084 — Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:1084-1090 | Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1250-1256 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Services/Credentials/Consumers/PluginCredentials.swift:65 — Packages/OsaurusCore/Services/Credentials/Consumers/PluginCredentials.swift:65-72 | Packages/OsaurusCore/Services/Credentials/Consumers/PluginCredentials.swift:74-80 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Managers/RemoteAgentManager.swift:338 — Packages/OsaurusCore/Managers/RemoteAgentManager.swift:338-346 | Packages/OsaurusCore/Managers/RemoteAgentManager.swift:350-356 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Services/Credentials/SignInSessionStore.swift:142 — Packages/OsaurusCore/Services/Credentials/SignInSessionStore.swift:142-148 | Packages/OsaurusCore/Services/Workflow/WorkflowConnections.swift:187-193 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Views/Agent/AgentsView.swift:767 — Packages/OsaurusCore/Views/Agent/AgentsView.swift:767-775 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowsView.swift:656-662 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Packages/OsaurusCore/Managers/InsightsService.swift:280 — Packages/OsaurusCore/Managers/InsightsService.swift:280-286 | Packages/OsaurusCore/Managers/InsightsService.swift:288-296 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 38 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (5 corresponding lines) · ×63
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/DevelopmentDesign/CatalogNativePreview.swift:97 — Packages/OsaurusCore/DevelopmentDesign/CatalogNativePreview.swift:97-101 | Packages/OsaurusCore/Views/Chat/TerminalDisplayView.swift:670-674 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/Views/Workflow/FlowViewer/WorkflowFlowLayout.swift:128 — Packages/OsaurusCore/Views/Workflow/FlowViewer/WorkflowFlowLayout.swift:128-132 | Packages/OsaurusCore/Views/Workflow/FlowViewer/WorkflowFlowLayout.swift:134-138 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/Services/ChatImport/ChatImportVerifier.swift:334 — Packages/OsaurusCore/Services/ChatImport/ChatImportVerifier.swift:334-339 | Packages/OsaurusCore/Services/Documents/PPTXEmitter.swift:98-102 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:759 — Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:759-763 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:908-912 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/Services/Workflow/InstalledWorkflowStore.swift:374 — Packages/OsaurusCore/Services/Workflow/InstalledWorkflowStore.swift:374-378 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowsView.swift:537-541 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/Services/Inference/ModelService.swift:420 — Packages/OsaurusCore/Services/Inference/ModelService.swift:420-424 | Packages/OsaurusCore/Services/Inference/ModelService.swift:455-459 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/AppleApps/Messages/MessagesTools.swift:34 — Packages/OsaurusCore/AppleApps/Messages/MessagesTools.swift:34-38 | Packages/OsaurusCore/AppleApps/Messages/MessagesTools.swift:79-83 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/Services/ChatImport/SafeImportFetcher.swift:376 — Packages/OsaurusCore/Services/ChatImport/SafeImportFetcher.swift:376-380 | Packages/OsaurusCore/Services/Search/SearchTypes.swift:271-278 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/Views/Workflow/Architect/MediaStepEditor.swift:531 — Packages/OsaurusCore/Views/Workflow/Architect/MediaStepEditor.swift:531-538 | Packages/OsaurusCore/Views/Workflow/Architect/WorkflowNodeEditor.swift:321-325 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/Models/Workflow/WorkflowDraft.swift:552 — Packages/OsaurusCore/Models/Workflow/WorkflowDraft.swift:552-556 | Packages/OsaurusCore/Tools/ToolOutputSchema.swift:41-45 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/Services/Keychain/SessionKeychainItems.swift:22 — Packages/OsaurusCore/Services/Keychain/SessionKeychainItems.swift:22-30 | Packages/OsaurusCore/Services/Keychain/SessionKeychainItems.swift:32-36 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/Views/Chat/SubagentFeedView.swift:255 — Packages/OsaurusCore/Views/Chat/SubagentFeedView.swift:255-259 | Packages/OsaurusCore/Views/Model/ImageGenerationPanelView.swift:629-633 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/Services/FileHistory/FileChangeJournal.swift:715 — Packages/OsaurusCore/Services/FileHistory/FileChangeJournal.swift:715-719 | Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:5964-5968 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/Services/FileHistory/FileChangeSummaryStore.swift:39 — Packages/OsaurusCore/Services/FileHistory/FileChangeSummaryStore.swift:39-43 | Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:438-448 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/Services/Search/SearchHTMLHelpers.swift:271 — Packages/OsaurusCore/Services/Search/SearchHTMLHelpers.swift:271-275 | Packages/OsaurusCore/Services/Search/SearchHTMLHelpers.swift:277-281 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/Services/Workflow/WorkflowSelfHealMonitor.swift:118 — Packages/OsaurusCore/Services/Workflow/WorkflowSelfHealMonitor.swift:118-122 | Packages/OsaurusCore/Views/Workflow/WorkflowRunHistoryList.swift:221-225 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/Views/Template/PublishedWorkflowDashboard.swift:183 — Packages/OsaurusCore/Views/Template/PublishedWorkflowDashboard.swift:183-188 | Packages/OsaurusCore/Views/Template/ShareWorkflowSheet.swift:228-232 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/Identity/DeviceKey.swift:111 — Packages/OsaurusCore/Identity/DeviceKey.swift:111-118 | Packages/OsaurusCore/Services/Auth/PKCE.swift:48-52 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/Services/ModelRuntime/RuntimeConfig.swift:60 — Packages/OsaurusCore/Services/ModelRuntime/RuntimeConfig.swift:60-67 | Packages/OsaurusCore/Models/Configuration/ServerRuntimeSettingsStore.swift:978-982 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/AppleApps/Messages/MessagesService.swift:187 — Packages/OsaurusCore/AppleApps/Messages/MessagesService.swift:187-191 | Packages/OsaurusCore/Storage/ActivityLogStore.swift:1087-1091 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/Models/Workflow/FolderRequirement.swift:83 — Packages/OsaurusCore/Models/Workflow/FolderRequirement.swift:83-87 | Packages/OsaurusCore/Services/Router/OsaurusRouterWorkspaceTypes.swift:149-153 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/Configuration/Declarative/ConfigHistoryRecorder.swift:87 — Packages/OsaurusCore/Configuration/Declarative/ConfigHistoryRecorder.swift:87-91 | Packages/OsaurusCore/Services/Provider/RemoteProviderKeychain.swift:37-45 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerScreenContext.swift:297 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerScreenContext.swift:297-301 | Packages/OsaurusCore/Models/Configuration/ModelFamilyNames.swift:19-23 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorActivityStyle.swift:53 — Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorActivityStyle.swift:53-57 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:4032-4037 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift:1061 — Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift:1061-1065 | Packages/OsaurusCore/Tools/Workflow/WorkflowRunsTool.swift:496-500 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 38 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×58
  • Duplicated block (10 lines × 2) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsInstall.swift:340 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsInstall.swift:340-349 | Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsInstall.swift:432-441 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsInstall.swift:340` 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) Packages/OsaurusCore/AppleApps/Reminders/RemindersTools.swift:275 — Packages/OsaurusCore/AppleApps/Reminders/RemindersTools.swift:275-284 | Packages/OsaurusCore/AppleApps/Reminders/RemindersTools.swift:301-310 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/AppleApps/Reminders/RemindersTools.swift:275` 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) Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:2495 — Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:2495-2504 | Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:1786-1795 — 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 `Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:2495` 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 register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (10 lines × 2) Packages/OsaurusCore/Browser/Tool/BrowserChildTools.swift:86 — Packages/OsaurusCore/Browser/Tool/BrowserChildTools.swift:86-95 | Packages/OsaurusCore/Browser/Tool/BrowserChildTools.swift:97-106 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Browser/Tool/BrowserChildTools.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Packages/OsaurusCore/Browser/Tool/BrowserChildTools.swift:96` calls `stringArray` and `Packages/OsaurusCore/Browser/Tool/BrowserChildTools.swift:85` 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) Packages/OsaurusCore/Configuration/Declarative/ConfigManifest.swift:1108 — Packages/OsaurusCore/Configuration/Declarative/ConfigManifest.swift:1108-1117 | Packages/OsaurusCore/Configuration/Declarative/ConfigManifest.swift:1122-1131 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Configuration/Declarative/ConfigManifest.swift:1108` 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) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2013 — Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2013-2022 | Packages/OsaurusRepository/OsaurusBundle.swift:594-603 — 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 `Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2013` 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) Packages/OsaurusCore/Managers/InsightsService.swift:799 — Packages/OsaurusCore/Managers/InsightsService.swift:799-808 | Packages/OsaurusCore/Managers/InsightsService.swift:1177-1186 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/Managers/Model/SpeechModelManager.swift:270 — Packages/OsaurusCore/Managers/Model/SpeechModelManager.swift:270-281 | Packages/OsaurusCore/Services/AgentDelegation/ChatResidencyHandoff.swift:276-285 — 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 `Packages/OsaurusCore/Managers/Model/SpeechModelManager.swift:270` 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) Packages/OsaurusCore/Models/Agent/Agent.swift:1075 — Packages/OsaurusCore/Models/Agent/Agent.swift:1075-1084 | Packages/OsaurusCore/Services/Chat/AgentConfigSnapshot.swift:242-251 — 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) Packages/OsaurusCore/Models/Configuration/ServerRuntimeSettingsStore.swift:615 — Packages/OsaurusCore/Models/Configuration/ServerRuntimeSettingsStore.swift:615-624 | Packages/OsaurusCore/Models/Configuration/ServerRuntimeSettingsStore.swift:654-663 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Models/Configuration/ServerRuntimeSettingsStore.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.
  • Duplicated block (10 lines × 2) Packages/OsaurusCore/Models/IMessage/IMessageConnectionConfiguration.swift:211 — Packages/OsaurusCore/Models/IMessage/IMessageConnectionConfiguration.swift:211-220 | Packages/OsaurusCore/Models/WhatsApp/WhatsAppConnectionConfiguration.swift:166-175 — before extracting anything, compare `Packages/OsaurusCore/Models/IMessage/IMessageConnectionConfiguration.swift` and `Packages/OsaurusCore/Models/WhatsApp/WhatsAppConnectionConfiguration.swift` as WHOLE FILES: this scan already matched 6 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.
  • Duplicated block (10 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:8576 — Packages/OsaurusCore/Networking/HTTPHandler.swift:8576-8585 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8798-8807 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:8576` 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) Packages/OsaurusCore/Networking/RelayTunnelManager.swift:704 — Packages/OsaurusCore/Networking/RelayTunnelManager.swift:704-713 | Packages/OsaurusCore/Networking/RelayTunnelManager.swift:1359-1368 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/RelayTunnelManager.swift:704` 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 (10 lines × 2) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3555 — Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3555-3564 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1857-1866 — 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 `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3555` 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) Packages/OsaurusCore/Services/Discord/DiscordGatewayPresenceRuntime.swift:51 — Packages/OsaurusCore/Services/Discord/DiscordGatewayPresenceRuntime.swift:51-60 | Packages/OsaurusCore/Services/Slack/SlackSocketModeTransportRuntime.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 `Packages/OsaurusCore/Services/Discord/DiscordGatewayPresenceRuntime.swift:51` 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) Packages/OsaurusCore/Services/Documents/PDFAdapter.swift:500 — Packages/OsaurusCore/Services/Documents/PDFAdapter.swift:500-509 | Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:975-984 — 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 `Packages/OsaurusCore/Services/Documents/PDFAdapter.swift:500` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (10 lines × 2) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:91 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:91-100 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:71-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 `Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:91` 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) Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift:291 — Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift:291-300 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppRuntimeAssets.swift:188-197 — before extracting anything, compare `Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift` and `Packages/OsaurusCore/Services/WhatsApp/WhatsAppRuntimeAssets.swift` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 92 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 `Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift:291` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift:290` calls `sameTeamTrust`, `verified` and `Packages/OsaurusCore/Services/WhatsApp/WhatsAppRuntimeAssets.swift:187` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) Packages/OsaurusCore/Services/MobileConnect/MobilePairingService.swift:601 — Packages/OsaurusCore/Services/MobileConnect/MobilePairingService.swift:601-610 | Packages/OsaurusCore/Services/Sync/SyncPhoneDevices.swift:120-129 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/MobileConnect/MobilePairingService.swift:601` 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 (10 lines × 2) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:731 — Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:731-740 | Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:781-790 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:731` 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) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1766 — Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1766-1775 | Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1806-1815 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1766` 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) Packages/OsaurusCore/Services/Router/AnnouncementsService.swift:164 — Packages/OsaurusCore/Services/Router/AnnouncementsService.swift:164-173 | Packages/OsaurusCore/Services/Router/WelcomeCreditService.swift:238-247 — 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 `Packages/OsaurusCore/Services/Router/AnnouncementsService.swift:164` 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) Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:1289 — Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:1289-1298 | Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:1300-1311 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:1289` 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.
  • Duplicated block (10 lines × 2) Packages/OsaurusCore/Services/Workflow/WorkflowFolderGrantCoordinator.swift:100 — Packages/OsaurusCore/Services/Workflow/WorkflowFolderGrantCoordinator.swift:100-109 | Packages/OsaurusCore/Services/Workflow/WorkflowFolderGrantCoordinator.swift:125-134 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Workflow/WorkflowFolderGrantCoordinator.swift:100` 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 (10 lines × 2) Packages/OsaurusCore/Storage/AgentDatabase.swift:1150 — Packages/OsaurusCore/Storage/AgentDatabase.swift:1150-1159 | Packages/OsaurusCore/Storage/AgentDatabase.swift:1250-1259 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Storage/AgentDatabase.swift:1150` 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.
  • + 33 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (8 corresponding lines) · ×56
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/DevelopmentDesign/CatalogComponents.swift:36 — Packages/OsaurusCore/DevelopmentDesign/CatalogComponents.swift:36-43 | Packages/OsaurusCore/DevelopmentDesign/CatalogInspector.swift:520-527 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/AppleApps/Music/MusicTools.swift:98 — Packages/OsaurusCore/AppleApps/Music/MusicTools.swift:98-105 | Packages/OsaurusCore/AppleApps/Shortcuts/ShortcutsTools.swift:380-387 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/Services/Router/WorkspaceAuditLog.swift:859 — Packages/OsaurusCore/Services/Router/WorkspaceAuditLog.swift:859-866 | Packages/OsaurusCore/Storage/ActivityLogStore.swift:556-563 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/Subagent/Kinds/BrowserUseKind.swift:336 — Packages/OsaurusCore/Subagent/Kinds/BrowserUseKind.swift:336-343 | Packages/OsaurusCore/Subagent/Kinds/TextSubagentKind.swift:1716-1723 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/Models/Template/TemplateRequirements.swift:122 — Packages/OsaurusCore/Models/Template/TemplateRequirements.swift:122-130 | Packages/OsaurusCore/Models/Workflow/FolderRequirement.swift:52-59 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/AppleApps/Support/AppleToolBase.swift:233 — Packages/OsaurusCore/AppleApps/Support/AppleToolBase.swift:233-240 | Packages/OsaurusCore/AppleApps/Support/AppleToolBase.swift:242-250 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/Models/Event/OsaurusEvent.swift:689 — Packages/OsaurusCore/Models/Event/OsaurusEvent.swift:689-696 | Packages/OsaurusCore/Models/Event/SourceConnection.swift:265-272 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/Models/Event/TriggerSourceConfigs.swift:39 — Packages/OsaurusCore/Models/Event/TriggerSourceConfigs.swift:39-47 | Packages/OsaurusCore/Models/Event/TriggerSourceConfigs.swift:84-91 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/Services/HuggingFaceService.swift:546 — Packages/OsaurusCore/Services/HuggingFaceService.swift:546-557 | Packages/OsaurusCore/Services/Search/SearchHTMLHelpers.swift:82-89 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/Services/MCP/MCPProviderKeychain.swift:107 — Packages/OsaurusCore/Services/MCP/MCPProviderKeychain.swift:107-114 | Packages/OsaurusCore/Services/Provider/RemoteProviderKeychain.swift:140-149 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:2196 — Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:2196-2203 | Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:2373-2381 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/Views/Template/PublishedWorkflowDashboard.swift:1005 — Packages/OsaurusCore/Views/Template/PublishedWorkflowDashboard.swift:1005-1012 | Packages/OsaurusCore/Views/Template/ShareWorkflowSheet.swift:1076-1084 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/Services/Context/SubagentJobEvaluator.swift:1169 — Packages/OsaurusCore/Services/Context/SubagentJobEvaluator.swift:1169-1176 | Packages/OsaurusCore/Services/Context/SubagentJobEvaluator.swift:1179-1186 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/Services/Template/TemplateShareOptions.swift:16 — Packages/OsaurusCore/Services/Template/TemplateShareOptions.swift:16-23 | Packages/OsaurusCore/Services/Workflow/WorkflowRunner.swift:863-870 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/Storage/AgentDatabase.swift:377 — Packages/OsaurusCore/Storage/AgentDatabase.swift:377-384 | Packages/OsaurusCore/Storage/AgentDatabaseStore.swift:96-106 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/Models/Template/TemplateRequirements.swift:132 — Packages/OsaurusCore/Models/Template/TemplateRequirements.swift:132-140 | Packages/OsaurusCore/Models/Workflow/FolderRequirement.swift:61-68 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/Views/Agent/AgentReorderSheet.swift:98 — Packages/OsaurusCore/Views/Agent/AgentReorderSheet.swift:98-105 | Packages/OsaurusCore/Views/Settings/RemoteProviderReorderSheet.swift:102-115 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/Managers/InsightsService.swift:434 — Packages/OsaurusCore/Managers/InsightsService.swift:434-441 | Packages/OsaurusCore/Managers/InsightsService.swift:444-451 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:231 — Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:231-238 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:695-702 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/Views/Chat/ToolDisplayName.swift:249 — Packages/OsaurusCore/Views/Chat/ToolDisplayName.swift:249-256 | Packages/OsaurusCore/Views/Chat/ToolDisplayName.swift:318-325 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/Services/Event/Email/IMAPClient.swift:390 — Packages/OsaurusCore/Services/Event/Email/IMAPClient.swift:390-397 | Packages/OsaurusCore/Services/Event/Email/IMAPClient.swift:451-460 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:936 — Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:936-943 | Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:1315-1325 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/PrivacyFilter/Views/PrivacyPresetRulesSection.swift:580 — Packages/OsaurusCore/PrivacyFilter/Views/PrivacyPresetRulesSection.swift:580-588 | Packages/OsaurusCore/Views/Event/EventDetailView.swift:343-350 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/Services/Inference/ResponsesToolChoiceContract.swift:26 — Packages/OsaurusCore/Services/Inference/ResponsesToolChoiceContract.swift:26-34 | Packages/OsaurusCore/Services/Provider/RemoteResponsesCapabilityFallback.swift:41-48 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Packages/OsaurusCore/Storage/ActivityLogStore.swift:772 — Packages/OsaurusCore/Storage/ActivityLogStore.swift:772-779 | Packages/OsaurusCore/Storage/TaskDatabase.swift:414-422 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 31 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (11 corresponding lines) · ×56
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/Services/Router/WorkspaceAgentAccessHost.swift:131 — Packages/OsaurusCore/Services/Router/WorkspaceAgentAccessHost.swift:131-141 | Packages/OsaurusCore/Services/Router/WorkspaceMembershipAttestation.swift:77-91 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1429 — Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1429-1452 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2530-2540 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/ComputerUse/Driver/Mac/Screenshot.swift:365 — Packages/OsaurusCore/ComputerUse/Driver/Mac/Screenshot.swift:365-375 | Packages/OsaurusCore/ComputerUse/Driver/Mac/Screenshot.swift:422-441 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/AppleScript/Exec/MockAppleScriptWorld.swift:146 — Packages/OsaurusCore/AppleScript/Exec/MockAppleScriptWorld.swift:146-161 | Packages/OsaurusCore/AppleScript/Exec/MockAppleScriptWorld.swift:167-177 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/Models/Plugin/PluginHTTP.swift:49 — Packages/OsaurusCore/Models/Plugin/PluginHTTP.swift:49-60 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8995-9005 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:835 — Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:835-846 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2481-2491 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Show.swift:60 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Show.swift:60-75 | Packages/OsaurusCore/Models/Plugin/ExternalPlugin.swift:410-420 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/Services/Router/OsaurusRouterTypes.swift:75 — Packages/OsaurusCore/Services/Router/OsaurusRouterTypes.swift:75-85 | Packages/OsaurusCore/Services/Router/OsaurusRouterTypes.swift:135-147 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/Services/Sync/SyncDeviceFeedContract.swift:63 — Packages/OsaurusCore/Services/Sync/SyncDeviceFeedContract.swift:63-79 | Packages/OsaurusCore/Services/Sync/SyncServedChats.swift:105-115 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/Services/Keychain/ToolSecretsKeychain.swift:193 — Packages/OsaurusCore/Services/Keychain/ToolSecretsKeychain.swift:193-209 | Packages/OsaurusCore/Services/Keychain/ToolSecretsKeychain.swift:274-284 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/Services/Router/WorkspaceAgentAccessHost.swift:614 — Packages/OsaurusCore/Services/Router/WorkspaceAgentAccessHost.swift:614-629 | Packages/OsaurusCore/Services/Router/WorkspaceAgentAccessHost.swift:632-642 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:132 — Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:132-144 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:625-635 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:760 — Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:760-770 | Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:1463-1476 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:462 — Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:462-472 | Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:1555-1565 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/Services/Auth/OwnerDeviceAccessHost.swift:525 — Packages/OsaurusCore/Services/Auth/OwnerDeviceAccessHost.swift:525-535 | Packages/OsaurusCore/Services/Router/WorkspaceAgentAccessHost.swift:690-705 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/Services/GitHubAuth.swift:52 — Packages/OsaurusCore/Services/GitHubAuth.swift:52-62 | Packages/OsaurusCore/Services/HuggingFaceAuth.swift:62-73 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/Services/Provider/OpenAICodexOAuthService.swift:515 — Packages/OsaurusCore/Services/Provider/OpenAICodexOAuthService.swift:515-527 | Packages/OsaurusCore/Services/Provider/XAIOAuthService.swift:346-356 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/Models/Agent/ConfiguratorConfigurationStore.swift:86 — Packages/OsaurusCore/Models/Agent/ConfiguratorConfigurationStore.swift:86-96 | Packages/OsaurusCore/Models/Agent/DefaultAgentConfigurationStore.swift:39-50 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/Services/ExternalModelLocator.swift:1070 — Packages/OsaurusCore/Services/ExternalModelLocator.swift:1070-1080 | Packages/OsaurusCore/Services/ModelSizeCache.swift:127-137 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/Models/Agent/AgentDispatchTarget.swift:120 — Packages/OsaurusCore/Models/Agent/AgentDispatchTarget.swift:120-130 | Packages/OsaurusCore/Services/MediaGeneration/MediaGenerationTypes.swift:73-84 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:783 — Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:783-793 | Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:1110-1121 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/Views/Chat/NativeFileDiffView.swift:675 — Packages/OsaurusCore/Views/Chat/NativeFileDiffView.swift:675-685 | Packages/OsaurusCore/Views/Chat/NativeFileDiffView.swift:687-697 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/Views/Knowledge/KnowledgeWritePreviewView.swift:166 — Packages/OsaurusCore/Views/Knowledge/KnowledgeWritePreviewView.swift:166-176 | Packages/OsaurusCore/Views/Provider/ProviderCredentialPromptSheet.swift:450-461 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/Services/Sync/SyncAgentDirectory.swift:191 — Packages/OsaurusCore/Services/Sync/SyncAgentDirectory.swift:191-201 | Packages/OsaurusCore/Services/Sync/SyncDeviceFeedContract.swift:359-369 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Packages/OsaurusCore/Models/Theme/ThemeTokens.swift:275 — Packages/OsaurusCore/Models/Theme/ThemeTokens.swift:275-286 | Packages/OsaurusRepository/BundleSettings.swift:19-29 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 31 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (10 corresponding lines) · ×54
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Networking/HTTPHandler.swift:8982 — Packages/OsaurusCore/Networking/HTTPHandler.swift:8982-8992 | Packages/OsaurusCore/Services/Sync/SyncConversationMapper.swift:674-683 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:558 — Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:558-568 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:590-599 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Models/Discord/DiscordConnectionConfiguration.swift:54 — Packages/OsaurusCore/Models/Discord/DiscordConnectionConfiguration.swift:54-64 | Packages/OsaurusCore/Models/Event/OsaurusEvent.swift:509-518 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Subagent/SpawnRemoteModelIdentity.swift:27 — Packages/OsaurusCore/Subagent/SpawnRemoteModelIdentity.swift:27-46 | Packages/OsaurusRepository/OsaurusBundle.swift:866-875 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:597 — Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:597-607 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1821-1830 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Services/MobileConnect/RemoteSecretPromptQueue.swift:95 — Packages/OsaurusCore/Services/MobileConnect/RemoteSecretPromptQueue.swift:95-104 | Packages/OsaurusCore/Services/Sync/SyncSecretPromptQueue.swift:148-160 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Identity/AgentKey.swift:64 — Packages/OsaurusCore/Identity/AgentKey.swift:64-73 | Packages/OsaurusCore/Identity/AgentKey.swift:87-99 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:213 — Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:213-229 | Packages/OsaurusCore/Tools/Database/SchedulerTools.swift:273-282 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Views/Chat/ChatMinimap.swift:238 — Packages/OsaurusCore/Views/Chat/ChatMinimap.swift:238-250 | Packages/OsaurusCore/Views/Voice/TranscriptionOverlayView.swift:174-183 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalReviewReportCLI.swift:599 — Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalReviewReportCLI.swift:599-608 | Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalReviewReportCLI.swift:610-622 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Services/Sandbox/SandboxPackageManifest.swift:164 — Packages/OsaurusCore/Services/Sandbox/SandboxPackageManifest.swift:164-173 | Packages/OsaurusCore/Services/Workflow/WorkflowSandboxEnvironment.swift:308-317 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Tools/Database/DatabaseExport.swift:338 — Packages/OsaurusCore/Tools/Database/DatabaseExport.swift:338-347 | Packages/OsaurusCore/Views/Agent/Database/DatabaseSharedUI.swift:18-27 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Services/FileHistory/FileChangeJournal+Revert.swift:128 — Packages/OsaurusCore/Services/FileHistory/FileChangeJournal+Revert.swift:128-137 | Packages/OsaurusCore/Services/FileHistory/FileChangeJournal+Revert.swift:141-152 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Services/Context/MemoryRecallEvaluator.swift:138 — Packages/OsaurusCore/Services/Context/MemoryRecallEvaluator.swift:138-147 | Packages/OsaurusCore/Services/Context/ReasoningChannelEvaluator.swift:98-109 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Models/Plugin/SandboxAgentMap.swift:83 — Packages/OsaurusCore/Models/Plugin/SandboxAgentMap.swift:83-94 | Packages/OsaurusCore/Services/Sandbox/SandboxAgentUIDs.swift:50-59 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Tools/OsaurusTool.swift:451 — Packages/OsaurusCore/Tools/OsaurusTool.swift:451-462 | Packages/OsaurusCore/Tools/SchemaValidator.swift:471-480 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Services/Sandbox/LiveExecRegistry.swift:155 — Packages/OsaurusCore/Services/Sandbox/LiveExecRegistry.swift:155-164 | Packages/OsaurusCore/Subagent/SubagentFeed.swift:602-612 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Views/Chat/MarkdownImageView.swift:408 — Packages/OsaurusCore/Views/Chat/MarkdownImageView.swift:408-420 | Packages/OsaurusCore/Views/Chat/NativeChartView.swift:383-392 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Services/ExternalModelLocator.swift:1082 — Packages/OsaurusCore/Services/ExternalModelLocator.swift:1082-1091 | Packages/OsaurusCore/Services/ModelSizeCache.swift:139-152 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Networking/HTTPHandler.swift:3777 — Packages/OsaurusCore/Networking/HTTPHandler.swift:3777-3786 | Packages/OsaurusCore/Services/LocalReasoningCapability.swift:687-696 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Managers/MCPProviderManager.swift:726 — Packages/OsaurusCore/Managers/MCPProviderManager.swift:726-739 | Packages/OsaurusCore/Managers/RemoteProviderManager.swift:1105-1114 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Managers/Plugin/SandboxPluginManager.swift:630 — Packages/OsaurusCore/Managers/Plugin/SandboxPluginManager.swift:630-639 | Packages/OsaurusCore/Models/SlashCommand/SlashCommandStore.swift:44-54 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Views/Agent/Setup/AgentSetupWizardView.swift:346 — Packages/OsaurusCore/Views/Agent/Setup/AgentSetupWizardView.swift:346-356 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowSetupWizardView.swift:332-341 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Storage/FileHistoryDatabase.swift:266 — Packages/OsaurusCore/Storage/FileHistoryDatabase.swift:266-278 | Packages/OsaurusCore/Storage/FileHistoryDatabase.swift:280-289 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Packages/OsaurusCore/Subagent/Kinds/ImageSubagentKind.swift:524 — Packages/OsaurusCore/Subagent/Kinds/ImageSubagentKind.swift:524-533 | Packages/OsaurusCore/Subagent/Kinds/ImageSubagentKind.swift:535-544 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 29 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (13 corresponding lines) · ×53
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:1902 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:1902-1914 | Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:3071-3090 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:79 — Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:79-93 | Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:169-181 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/AppleScript/Knowledge/AppleScriptDictionaryService.swift:175 — Packages/OsaurusCore/AppleScript/Knowledge/AppleScriptDictionaryService.swift:175-192 | Packages/OsaurusCore/AppleScript/Knowledge/AppleScriptDictionaryService.swift:194-206 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/Models/Insights/ActivityFilter.swift:201 — Packages/OsaurusCore/Models/Insights/ActivityFilter.swift:201-213 | Packages/OsaurusCore/Views/Workspaces/WorkspaceAuditView.swift:241-256 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/Views/Settings/BrowserSettingsView.swift:145 — Packages/OsaurusCore/Views/Settings/BrowserSettingsView.swift:145-157 | Packages/OsaurusCore/Views/Settings/ComputerUseSettingsView.swift:201-213 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/Views/Chat/ChatView.swift:13251 — Packages/OsaurusCore/Views/Chat/ChatView.swift:13251-13264 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ComputerUseScorecard.swift:568-580 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/Services/Router/RouterAccountUsageCenter.swift:479 — Packages/OsaurusCore/Services/Router/RouterAccountUsageCenter.swift:479-494 | Packages/OsaurusCore/Services/Router/RouterAccountUsageCenter.swift:496-508 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:703 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:703-715 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:914-933 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/Storage/ActivityLogStore.swift:782 — Packages/OsaurusCore/Storage/ActivityLogStore.swift:782-794 | Packages/OsaurusCore/Storage/ActivityLogStore.swift:797-815 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/Views/Agent/Creation/AgentCreatorIntro.swift:130 — Packages/OsaurusCore/Views/Agent/Creation/AgentCreatorIntro.swift:130-142 | Packages/OsaurusCore/Views/Workflow/Architect/ArchitectChatEmptyState.swift:103-116 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1260 — Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1260-1272 | Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1277-1291 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/Tools/SandboxPluginRegisterTool.swift:33 — Packages/OsaurusCore/Tools/SandboxPluginRegisterTool.swift:33-45 | Packages/OsaurusCore/Tools/SandboxSecretTools.swift:24-36 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/Services/Workflow/InstalledWorkflowStore.swift:388 — Packages/OsaurusCore/Services/Workflow/InstalledWorkflowStore.swift:388-400 | Packages/OsaurusCore/Services/Workflow/WorkflowDraftStore.swift:324-336 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/Services/Method/MethodSearchService.swift:108 — Packages/OsaurusCore/Services/Method/MethodSearchService.swift:108-120 | Packages/OsaurusCore/Services/Skill/SkillSearchService.swift:133-149 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/Services/Sync/SyncAttentionFeed.swift:64 — Packages/OsaurusCore/Services/Sync/SyncAttentionFeed.swift:64-78 | Packages/OsaurusCore/Services/Sync/SyncManageFeed.swift:138-150 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:1571 — Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:1571-1583 | Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:1588-1600 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/Views/Provider/ProviderCredentialPromptSheet.swift:436 — Packages/OsaurusCore/Views/Provider/ProviderCredentialPromptSheet.swift:436-448 | Packages/OsaurusCore/Views/Settings/ProvidersView.swift:1813-1826 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/Models/Theme/InspectionAdapters/AssignedMenuPresentation.swift:450 — Packages/OsaurusCore/Models/Theme/InspectionAdapters/AssignedMenuPresentation.swift:450-466 | Packages/OsaurusCore/Models/Theme/InspectionAdapters/AssignedNativePicker.swift:179-191 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/Services/ModelRuntime/ImageGenerationService.swift:439 — Packages/OsaurusCore/Services/ModelRuntime/ImageGenerationService.swift:439-451 | Packages/OsaurusCore/Services/ModelRuntime/ImageGenerationService.swift:453-465 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:284 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:284-298 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:268-280 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/PrivacyFilter/Views/PrivacyView.swift:650 — Packages/OsaurusCore/PrivacyFilter/Views/PrivacyView.swift:650-664 | Packages/OsaurusCore/Views/Voice/VoiceSharedComponents.swift:76-88 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/Views/Template/ShareWorkflowSheet.swift:1157 — Packages/OsaurusCore/Views/Template/ShareWorkflowSheet.swift:1157-1169 | Packages/OsaurusCore/Views/Template/ShareWorkflowSheet.swift:1172-1187 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/AppleApps/Calendar/CalendarService.swift:385 — Packages/OsaurusCore/AppleApps/Calendar/CalendarService.swift:385-398 | Packages/OsaurusCore/AppleApps/Reminders/RemindersService.swift:281-293 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:2602 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:2602-2620 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:2293-2305 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:354 — Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:354-366 | Packages/OsaurusCore/Storage/RouterBillingDatabase.swift:506-521 — 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.
  • + 28 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×50
  • Duplicated block (13 lines × 2) Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:1859 — Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:1859-1871 | Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:1929-1941 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:1859` 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) Packages/OsaurusCore/Managers/InsightsService.swift:812 — Packages/OsaurusCore/Managers/InsightsService.swift:812-824 | Packages/OsaurusCore/Models/Chat/RequestLog.swift:643-655 — 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 `Packages/OsaurusCore/Managers/InsightsService.swift:812` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) Packages/OsaurusCore/Models/AgentCollaboration/AgentCollaborationProtocol.swift:104 — Packages/OsaurusCore/Models/AgentCollaboration/AgentCollaborationProtocol.swift:104-116 | Packages/OsaurusCore/Models/AgentCollaboration/AgentCollaborationProtocol.swift:119-131 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (13 lines × 2) Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:239 — Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:239-251 | Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:480-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. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:239` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:5759 — Packages/OsaurusCore/Networking/HTTPHandler.swift:5759-5771 | Packages/OsaurusCore/Networking/HTTPHandler.swift:5853-5865 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:5759` 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 (13 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:7076 — Packages/OsaurusCore/Networking/HTTPHandler.swift:7076-7088 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8088-8100 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:7076` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:7200 — Packages/OsaurusCore/Networking/HTTPHandler.swift:7200-7212 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7649-7661 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:7200` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:11822 — Packages/OsaurusCore/Networking/HTTPHandler.swift:11822-11834 | Packages/OsaurusCore/Networking/HTTPHandler.swift:11888-11900 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:11822` 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, `Packages/OsaurusCore/Networking/HTTPHandler.swift:11885` calls `server` and `Packages/OsaurusCore/Networking/HTTPHandler.swift:11821` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:13334 — Packages/OsaurusCore/Networking/HTTPHandler.swift:13334-13346 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18404-18416 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:13334` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:16184 — Packages/OsaurusCore/Networking/HTTPHandler.swift:16184-16196 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17501-17513 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:16184` 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 (13 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:16587 — Packages/OsaurusCore/Networking/HTTPHandler.swift:16587-16599 | Packages/OsaurusCore/Services/Chat/ChatEngine.swift:554-566 — 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) Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:786 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:786-798 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:844-856 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.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.
  • Duplicated block (13 lines × 2) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3957 — Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3957-3969 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:4145-4157 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3957` 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 (13 lines × 2) Packages/OsaurusCore/Services/Context/CapabilityClaimsEvaluator.swift:1104 — Packages/OsaurusCore/Services/Context/CapabilityClaimsEvaluator.swift:1104-1116 | Packages/OsaurusCore/Utils/StringCleaning.swift:184-196 — 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 `Packages/OsaurusCore/Services/Context/CapabilityClaimsEvaluator.swift:1104` 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) Packages/OsaurusCore/Services/GitHubSkillService.swift:1226 — Packages/OsaurusCore/Services/GitHubSkillService.swift:1226-1238 | Packages/OsaurusCore/Services/GitHubSkillService.swift:2021-2033 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:583 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:583-595 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:683-695 — 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 `Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:583` 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 (13 lines × 2) Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:198 — Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:198-210 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppRPCClient.swift:191-203 — before extracting anything, compare `Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift` and `Packages/OsaurusCore/Services/WhatsApp/WhatsAppRPCClient.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 116 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) Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:388 — Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:388-400 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppRPCClient.swift:470-482 — before extracting anything, compare `Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift` and `Packages/OsaurusCore/Services/WhatsApp/WhatsAppRPCClient.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 116 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) Packages/OsaurusCore/Services/Knowledge/KnowledgeSearchService.swift:84 — Packages/OsaurusCore/Services/Knowledge/KnowledgeSearchService.swift:84-96 | Packages/OsaurusCore/Services/Memory/MemorySearchService.swift:193-205 — 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 `Packages/OsaurusCore/Services/Knowledge/KnowledgeSearchService.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 (13 lines × 2) Packages/OsaurusCore/Services/Memory/MemoryService.swift:949 — Packages/OsaurusCore/Services/Memory/MemoryService.swift:949-961 | Packages/OsaurusCore/Services/Memory/MemoryService.swift:965-977 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Memory/MemoryService.swift:949` 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 (13 lines × 2) Packages/OsaurusCore/Services/Provider/OpenAICompatibleStreamParser.swift:773 — Packages/OsaurusCore/Services/Provider/OpenAICompatibleStreamParser.swift:773-785 | Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:2162-2174 — 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 (13 lines × 2) Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1011 — Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1011-1023 | Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1154-1166 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1011` 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 (13 lines × 2) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3850 — Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3850-3864 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3951-3963 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3850` 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 (13 lines × 2) Packages/OsaurusCore/Tools/Database/DatabaseImport.swift:197 — Packages/OsaurusCore/Tools/Database/DatabaseImport.swift:197-209 | Packages/OsaurusCore/Tools/Database/DatabaseImport.swift:308-320 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/Database/DatabaseImport.swift:197` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) Packages/OsaurusCore/Tools/MCPProviderTool.swift:200 — Packages/OsaurusCore/Tools/MCPProviderTool.swift:200-212 | Packages/OsaurusCore/Tools/ToolRegistry.swift:587-599 — 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.
  • + 25 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (12 corresponding lines) · ×48
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/Views/Onboarding/DesignSystem/OnboardingComponents.swift:325 — Packages/OsaurusCore/Views/Onboarding/DesignSystem/OnboardingComponents.swift:325-339 | Packages/OsaurusCore/Views/Onboarding/DesignSystem/OnboardingComponents.swift:351-362 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/Networking/HTTPHandler.swift:13447 — Packages/OsaurusCore/Networking/HTTPHandler.swift:13447-13462 | Packages/OsaurusCore/Services/Harness/HarnessTurnDriver.swift:90-101 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/AppleApps/Maps/MapsService.swift:292 — Packages/OsaurusCore/AppleApps/Maps/MapsService.swift:292-303 | Packages/OsaurusCore/AppleApps/Maps/MapsService.swift:379-390 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/Services/LocalGenerationDefaults.swift:447 — Packages/OsaurusCore/Services/LocalGenerationDefaults.swift:447-461 | Packages/OsaurusCore/Services/LocalGenerationDefaults.swift:463-474 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/Models/AgentChannel/AgentChannelAsyncModels.swift:453 — Packages/OsaurusCore/Models/AgentChannel/AgentChannelAsyncModels.swift:453-468 | Packages/OsaurusCore/Models/Channels/ChannelSecurityPolicy.swift:107-118 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/Services/Event/EventStore.swift:36 — Packages/OsaurusCore/Services/Event/EventStore.swift:36-48 | Packages/OsaurusCore/Services/Event/SourceConnectionStore.swift:117-128 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/Services/AgentChannel/AgentChannelAsyncSubstrate.swift:228 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelAsyncSubstrate.swift:228-239 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:1459-1470 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:2180 — Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:2180-2191 | Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:2196-2211 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/PrivacyFilter/Model/PrivacyFilterModelBundle.swift:190 — Packages/OsaurusCore/PrivacyFilter/Model/PrivacyFilterModelBundle.swift:190-201 | Packages/OsaurusRepository/PluginInstallManager.swift:523-536 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/Managers/BackgroundTaskManager.swift:972 — Packages/OsaurusCore/Managers/BackgroundTaskManager.swift:972-983 | Packages/OsaurusCore/Managers/BackgroundTaskManager.swift:1048-1059 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:176 — Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:176-187 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:190-202 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/Storage/MemoryDatabase.swift:1317 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:1317-1331 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2726-2737 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/Services/Credentials/SignInSessionStore.swift:242 — Packages/OsaurusCore/Services/Credentials/SignInSessionStore.swift:242-254 | Packages/OsaurusCore/Services/Workflow/WorkflowConnections.swift:223-234 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/Views/Provider/ProviderCredentialPromptSheet.swift:311 — Packages/OsaurusCore/Views/Provider/ProviderCredentialPromptSheet.swift:311-322 | Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:921-932 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/Models/Event/EventPayload.swift:290 — Packages/OsaurusCore/Models/Event/EventPayload.swift:290-302 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:729-740 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/Services/AgentBridge/AgentBundleService.swift:557 — Packages/OsaurusCore/Services/AgentBridge/AgentBundleService.swift:557-568 | Packages/OsaurusCore/Services/AgentBridge/AgentBundleService.swift:717-729 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/Services/ChatImport/SafeImportFetcher.swift:204 — Packages/OsaurusCore/Services/ChatImport/SafeImportFetcher.swift:204-215 | Packages/OsaurusCore/Services/ChatImport/SafeImportFetcher.swift:259-270 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:197 — Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:197-210 | Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:781-792 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/Managers/AgentManager.swift:1949 — Packages/OsaurusCore/Managers/AgentManager.swift:1949-1961 | Packages/OsaurusCore/Managers/AgentManager.swift:2006-2017 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/Services/Documents/PDFAdapter.swift:688 — Packages/OsaurusCore/Services/Documents/PDFAdapter.swift:688-702 | Packages/OsaurusCore/Utils/InsightsBodyCapture.swift:23-34 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/Services/Sync/SyncHostRunner.swift:299 — Packages/OsaurusCore/Services/Sync/SyncHostRunner.swift:299-310 | Packages/OsaurusCore/Services/Sync/SyncServedChats.swift:326-337 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift:986 — Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift:986-998 | Packages/OsaurusCore/Managers/WindowManager.swift:505-516 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/Configuration/Declarative/ConfigEvents.swift:1439 — Packages/OsaurusCore/Configuration/Declarative/ConfigEvents.swift:1439-1450 | Packages/OsaurusCore/Configuration/Declarative/ConfigEvents.swift:1452-1463 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/Services/Sandbox/SandboxManager.swift:2386 — Packages/OsaurusCore/Services/Sandbox/SandboxManager.swift:2386-2397 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3454-3465 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Packages/OsaurusCore/Identity/MasterKey.swift:441 — Packages/OsaurusCore/Identity/MasterKey.swift:441-461 | Packages/OsaurusCore/Identity/MasterMnemonicStore.swift:143-154 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 23 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×47
  • Duplicated block (12 lines × 2) Packages/OsaurusCore/Folder/FolderTools.swift:4471 — Packages/OsaurusCore/Folder/FolderTools.swift:4471-4482 | Packages/OsaurusCore/Tools/AgentLoopTools.swift:60-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 `Packages/OsaurusCore/Folder/FolderTools.swift:4471` 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) Packages/OsaurusCore/Models/API/AnthropicAPI.swift:236 — Packages/OsaurusCore/Models/API/AnthropicAPI.swift:236-247 | Packages/OsaurusCore/Models/API/AnthropicAPI.swift:523-534 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Models/API/AnthropicAPI.swift:236` 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) Packages/OsaurusCore/Models/API/AnthropicAPI.swift:953 — Packages/OsaurusCore/Models/API/AnthropicAPI.swift:953-964 | Packages/OsaurusCore/Models/Configuration/ModelInfo.swift:580-591 — 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 `Packages/OsaurusCore/Models/API/AnthropicAPI.swift:953` 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) Packages/OsaurusCore/Models/AgentChannel/AgentChannelLiveProofReadiness.swift:204 — Packages/OsaurusCore/Models/AgentChannel/AgentChannelLiveProofReadiness.swift:204-215 | Packages/OsaurusCore/Models/AgentChannel/AgentChannelLiveProofReadiness.swift:283-294 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) Packages/OsaurusCore/Models/Theme/ThemeTokens.swift:59 — Packages/OsaurusCore/Models/Theme/ThemeTokens.swift:59-70 | Packages/OsaurusCore/Models/Theme/ThemeTokens.swift:73-84 — both copies are in the same file, so extract the 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 (12 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:5875 — Packages/OsaurusCore/Networking/HTTPHandler.swift:5875-5886 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6787-6798 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:5875` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:6281 — Packages/OsaurusCore/Networking/HTTPHandler.swift:6281-6292 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8350-8361 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:6281` 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) Packages/OsaurusCore/Networking/HTTPProtocolErrors.swift:212 — Packages/OsaurusCore/Networking/HTTPProtocolErrors.swift:212-223 | Packages/OsaurusCore/Tools/ToolEnvelope.swift:671-682 — 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 `Packages/OsaurusCore/Networking/HTTPProtocolErrors.swift:212` 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) Packages/OsaurusCore/Services/AgentCollaboration/AgentCollaborationService.swift:92 — Packages/OsaurusCore/Services/AgentCollaboration/AgentCollaborationService.swift:92-103 | Packages/OsaurusCore/Services/AgentCollaboration/AgentCollaborationService.swift:113-124 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/AgentCollaboration/AgentCollaborationService.swift:92` 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) Packages/OsaurusCore/Services/AgentDelegation/NativeImageJobCoordinator.swift:521 — Packages/OsaurusCore/Services/AgentDelegation/NativeImageJobCoordinator.swift:521-532 | Packages/OsaurusCore/Services/AgentDelegation/NativeImageJobCoordinator.swift:574-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. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/AgentDelegation/NativeImageJobCoordinator.swift:521` 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 × 2) Packages/OsaurusCore/Services/Chat/ChatEngine.swift:1929 — Packages/OsaurusCore/Services/Chat/ChatEngine.swift:1929-1940 | Packages/OsaurusCore/Services/Chat/ChatEngine.swift:2111-2122 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Chat/ChatEngine.swift:1929` 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) Packages/OsaurusCore/Services/ChunkedFileDownloader.swift:677 — Packages/OsaurusCore/Services/ChunkedFileDownloader.swift:677-688 | Packages/OsaurusCore/Services/ModelDownloadService.swift:2069-2080 — 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 `Packages/OsaurusCore/Services/ChunkedFileDownloader.swift:677` 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) Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift:421 — Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift:421-432 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppHelperInstaller.swift:315-326 — before extracting anything, compare `Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift` and `Packages/OsaurusCore/Services/WhatsApp/WhatsAppHelperInstaller.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 57 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 (12 lines × 2) Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:321 — Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:321-332 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppRPCClient.swift:402-413 — before extracting anything, compare `Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift` and `Packages/OsaurusCore/Services/WhatsApp/WhatsAppRPCClient.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 116 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 `Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:321` 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) Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift:190 — Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift:190-201 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppRuntimeAssets.swift:117-128 — before extracting anything, compare `Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift` and `Packages/OsaurusCore/Services/WhatsApp/WhatsAppRuntimeAssets.swift` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 92 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 (12 lines × 2) Packages/OsaurusCore/Services/Inference/CoreModelService.swift:317 — Packages/OsaurusCore/Services/Inference/CoreModelService.swift:317-328 | Packages/OsaurusCore/Services/Inference/CoreModelService.swift:362-373 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Inference/CoreModelService.swift:317` 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, `Packages/OsaurusCore/Services/Inference/CoreModelService.swift:374` calls `findInstalledModel` and `Packages/OsaurusCore/Services/Inference/CoreModelService.swift:329` 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 (12 lines × 2) Packages/OsaurusCore/Services/Inference/MLXService.swift:582 — Packages/OsaurusCore/Services/Inference/MLXService.swift:582-593 | Packages/OsaurusCore/Services/MCP/MCPAuthFailureProbe.swift:81-92 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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) Packages/OsaurusCore/Services/MCP/MCPProviderKeychain.swift:198 — Packages/OsaurusCore/Services/MCP/MCPProviderKeychain.swift:198-209 | Packages/OsaurusCore/Services/Provider/RemoteProviderKeychain.swift:228-239 — 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, `Packages/OsaurusCore/Services/MCP/MCPProviderKeychain.swift:188` calls `envAccount` and `Packages/OsaurusCore/Services/Provider/RemoteProviderKeychain.swift:218` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) Packages/OsaurusCore/Services/Provider/ProviderNetworkDiagnostics.swift:213 — Packages/OsaurusCore/Services/Provider/ProviderNetworkDiagnostics.swift:213-224 | Packages/OsaurusCore/Services/Provider/ProviderNetworkDiagnostics.swift:540-551 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Provider/ProviderNetworkDiagnostics.swift:213` 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 first that the copies are not typed on the same thing: the declarations holding them bind `provider` to `RemoteProvider` in one and `MCPProvider` 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 (12 lines × 2) Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:908 — Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:908-919 | Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:926-937 — both copies are in the same file, so extract the 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 (12 lines × 2) Packages/OsaurusCore/Storage/MemoryDatabase.swift:2044 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:2044-2055 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2543-2554 — both copies are in the same file, so extract the 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 (12 lines × 2) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3300 — Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3300-3311 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3327-3338 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3300` 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) Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:649 — Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:649-660 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:749-760 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:649` 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) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:1067 — Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:1067-1078 | Packages/OsaurusCore/Views/Sharing/SharedWithYouSection.swift:124-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. 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 (12 lines × 2) Packages/OsaurusCore/Views/Chat/ChatView.swift:9033 — Packages/OsaurusCore/Views/Chat/ChatView.swift:9033-9045 | Packages/OsaurusCore/Views/Chat/ChatView.swift:9067-9078 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Chat/ChatView.swift:9033` 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.
  • + 22 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (15 corresponding lines) · ×43
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Views/Plugin/ClaudeMarketplaceCard.swift:78 — Packages/OsaurusCore/Views/Plugin/ClaudeMarketplaceCard.swift:78-94 | Packages/OsaurusCore/Views/Plugin/GitHubImportSheet.swift:1018-1032 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:832 — Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:832-846 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:985-999 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:405 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:405-419 | Packages/OsaurusCore/Services/HuggingFaceService.swift:1062-1080 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Views/Template/TemplateImportReviewView.swift:347 — Packages/OsaurusCore/Views/Template/TemplateImportReviewView.swift:347-361 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowDetailPage.swift:326-344 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Services/DeclaredReasoningEffort.swift:137 — Packages/OsaurusCore/Services/DeclaredReasoningEffort.swift:137-151 | Packages/OsaurusCore/Services/LocalReasoningCapability.swift:138-152 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Views/Credentials/VaultAccountsView.swift:393 — Packages/OsaurusCore/Views/Credentials/VaultAccountsView.swift:393-407 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowConnectionsSheet.swift:137-157 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:853 — Packages/OsaurusCore/Views/Plugin/PluginsView.swift:853-872 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:874-888 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Views/Plugin/ClaudePluginDetailView.swift:1176 — Packages/OsaurusCore/Views/Plugin/ClaudePluginDetailView.swift:1176-1190 | Packages/OsaurusCore/Views/Template/ListingEditorViews.swift:336-352 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Models/Agent/ArchitectConfigurationStore.swift:105 — Packages/OsaurusCore/Models/Agent/ArchitectConfigurationStore.swift:105-119 | Packages/OsaurusCore/Models/Agent/ConfiguratorConfigurationStore.swift:60-75 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Models/Template/ListingEdits.swift:93 — Packages/OsaurusCore/Models/Template/ListingEdits.swift:93-107 | Packages/OsaurusCore/Models/Template/ListingEdits.swift:177-191 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Storage/MemoryDatabase.swift:2641 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:2641-2655 | Packages/OsaurusCore/Storage/MethodDatabase.swift:381-395 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Tools/KnowledgeWriteTools.swift:110 — Packages/OsaurusCore/Tools/KnowledgeWriteTools.swift:110-129 | Packages/OsaurusCore/Tools/KnowledgeWriteTools.swift:455-469 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Bundle/MCPBundleManager.swift:148 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Bundle/MCPBundleManager.swift:148-162 | Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalReviewReportCLI.swift:695-713 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Views/Plugin/SandboxPluginEditorView.swift:558 — Packages/OsaurusCore/Views/Plugin/SandboxPluginEditorView.swift:558-572 | Packages/OsaurusCore/Views/Plugin/SandboxPluginEditorView.swift:574-588 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Managers/TTSService.swift:258 — Packages/OsaurusCore/Managers/TTSService.swift:258-275 | Packages/OsaurusCore/Managers/TTSService.swift:317-331 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1592 — Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1592-1606 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1670-1691 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Services/Router/WorkspaceAuditLog.swift:613 — Packages/OsaurusCore/Services/Router/WorkspaceAuditLog.swift:613-627 | Packages/OsaurusCore/Services/Router/WorkspaceAuditLog.swift:629-643 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Views/Agent/Templates/AgentTemplatesIntroCard.swift:254 — Packages/OsaurusCore/Views/Agent/Templates/AgentTemplatesIntroCard.swift:254-268 | Packages/OsaurusCore/Views/Workspaces/WorkspacesIntroExplainer.swift:278-292 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Models/Task/TaskQueue.swift:43 — Packages/OsaurusCore/Models/Task/TaskQueue.swift:43-58 | Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:1395-1409 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift:382 — Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift:382-396 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppHelperInstaller.swift:274-291 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Models/Template/TemplateRequirements.swift:169 — Packages/OsaurusCore/Models/Template/TemplateRequirements.swift:169-183 | Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:331-351 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Services/Harness/HarnessRuntimeStore.swift:109 — Packages/OsaurusCore/Services/Harness/HarnessRuntimeStore.swift:109-123 | Packages/OsaurusCore/Services/Sync/SyncConfiguration.swift:77-93 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Services/Router/AnnouncementsService.swift:106 — Packages/OsaurusCore/Services/Router/AnnouncementsService.swift:106-120 | Packages/OsaurusCore/Services/Router/SupportService.swift:136-152 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Services/Sync/SyncHostedRunMonitor.swift:51 — Packages/OsaurusCore/Services/Sync/SyncHostedRunMonitor.swift:51-65 | Packages/OsaurusCore/Services/Sync/SyncServedChats.swift:249-267 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Packages/OsaurusCore/Services/Router/WorkspaceAuditLog.swift:572 — Packages/OsaurusCore/Services/Router/WorkspaceAuditLog.swift:572-593 | Packages/OsaurusCore/Services/Router/WorkspaceAuditLog.swift:597-611 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 18 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×41
  • Duplicated block (11 lines × 2) Packages/OsaurusCore/AppleScript/Tool/AppleScriptToolDispatch.swift:485 — Packages/OsaurusCore/AppleScript/Tool/AppleScriptToolDispatch.swift:485-495 | Packages/OsaurusCore/AppleScript/Tool/AppleScriptToolDispatch.swift:667-677 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/Browser/Runtime/BrowserSession.swift:867 — Packages/OsaurusCore/Browser/Runtime/BrowserSession.swift:867-877 | Packages/OsaurusCore/Browser/Runtime/BrowserSession.swift:878-888 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:1519 — Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:1519-1529 | Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:1532-1542 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:1519` 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) Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool.swift:392 — Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool.swift:392-402 | Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool.swift:451-461 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/Managers/MCPProviderManager.swift:710 — Packages/OsaurusCore/Managers/MCPProviderManager.swift:710-720 | Packages/OsaurusCore/Managers/RemoteProviderManager.swift:1080-1090 — 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 (11 lines × 2) Packages/OsaurusCore/Managers/TTSService.swift:500 — Packages/OsaurusCore/Managers/TTSService.swift:500-510 | Packages/OsaurusCore/Managers/TTSService.swift:619-629 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Managers/TTSService.swift:500` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:1625 — Packages/OsaurusCore/Networking/HTTPHandler.swift:1625-1635 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16760-16770 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:1625` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:3520 — Packages/OsaurusCore/Networking/HTTPHandler.swift:3520-3530 | Packages/OsaurusCore/Networking/HTTPHandler.swift:5871-5881 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:3520` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:6783 — Packages/OsaurusCore/Networking/HTTPHandler.swift:6783-6793 | Packages/OsaurusCore/Networking/HTTPHandler.swift:9173-9183 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:6783` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:7561 — Packages/OsaurusCore/Networking/HTTPHandler.swift:7561-7571 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12340-12350 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:7561` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:10229 — Packages/OsaurusCore/Networking/HTTPHandler.swift:10229-10239 | Packages/OsaurusCore/Networking/HTTPHandler.swift:10390-10400 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:12129 — Packages/OsaurusCore/Networking/HTTPHandler.swift:12129-12139 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12164-12174 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:12129` 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) Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:437 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:437-447 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:508-518 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:437` 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) Packages/OsaurusCore/Services/AgentDelegation/NativeImageJobCoordinator.swift:69 — Packages/OsaurusCore/Services/AgentDelegation/NativeImageJobCoordinator.swift:69-79 | Packages/OsaurusCore/Services/ModelRuntime/ImageGenerationTypes.swift:168-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.
  • Duplicated block (11 lines × 2) Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:867 — Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:867-877 | Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:1237-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 `Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:867` 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 (11 lines × 2) Packages/OsaurusCore/Services/Discord/DiscordGatewayPresenceRuntime.swift:72 — Packages/OsaurusCore/Services/Discord/DiscordGatewayPresenceRuntime.swift:72-82 | Packages/OsaurusCore/Services/Slack/SlackSocketModeTransportRuntime.swift:61-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.
  • Duplicated block (11 lines × 2) Packages/OsaurusCore/Services/Documents/XLSXAdapter.swift:880 — Packages/OsaurusCore/Services/Documents/XLSXAdapter.swift:880-890 | Packages/OsaurusCore/Services/Documents/XLSXEmitter.swift:356-366 — 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 (11 lines × 2) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1357 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1357-1367 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:1417-1427 — 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 `Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1357` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift:376 — Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift:376-386 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppRuntimeAssets.swift:222-232 — before extracting anything, compare `Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift` and `Packages/OsaurusCore/Services/WhatsApp/WhatsAppRuntimeAssets.swift` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 92 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 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) Packages/OsaurusCore/Services/Method/MethodService.swift:132 — Packages/OsaurusCore/Services/Method/MethodService.swift:132-142 | Packages/OsaurusCore/Services/Method/MethodService.swift:152-162 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Method/MethodService.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. 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, `Packages/OsaurusCore/Services/Method/MethodService.swift:131` calls `replacingOccurrences` and `Packages/OsaurusCore/Services/Method/MethodService.swift:151` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 2) Packages/OsaurusCore/Services/Router/RouterAccountUsageCenter.swift:484 — Packages/OsaurusCore/Services/Router/RouterAccountUsageCenter.swift:484-494 | Packages/OsaurusCore/Services/Router/RouterAccountUsageCenter.swift:498-508 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Router/RouterAccountUsageCenter.swift:484` 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) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3266 — Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3266-3276 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3328-3338 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3266` 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) Packages/OsaurusCore/Views/Agent/AgentsView.swift:2660 — Packages/OsaurusCore/Views/Agent/AgentsView.swift:2660-2673 | Packages/OsaurusCore/Views/Agent/BuiltInAgentAvatarPicker.swift:178-188 — 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 `Packages/OsaurusCore/Views/Agent/AgentsView.swift:2660` 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) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5896 — Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5896-5906 | Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5934-5944 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5896` 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) Packages/OsaurusCore/Views/Chat/HostedSecretCard.swift:58 — Packages/OsaurusCore/Views/Chat/HostedSecretCard.swift:58-68 | Packages/OsaurusCore/Views/Chat/SecretPromptOverlay.swift:152-162 — 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 `Packages/OsaurusCore/Views/Chat/HostedSecretCard.swift:58` 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.
  • + 16 more in this group — see findings.md.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×40
  • Swallowed exception (caught, then discarded) helpers/osaurus-wa/rpc.go:40 — `if err != nil` 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) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalDiffMatrixCLI.swift:308 — `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) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalReviewReportCLI.swift:710 — `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) Packages/OsaurusCore/Views/Settings/CommandLineToolSection.swift:171 — `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) Packages/OsaurusCore/Views/Onboarding/Dino/DinoDirector.swift:92 — `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) Packages/OsaurusCore/Views/Model/ImageGenerationPanelView.swift:300 — `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) Packages/OsaurusCore/Views/Model/Catalog/LanguageCatalogSource.swift:396 — `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) Packages/OsaurusCore/Views/Model/Catalog/LocalModelsCatalogPage.swift:105 — `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) Packages/OsaurusCore/Views/Identity/IdentityView.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) Packages/OsaurusCore/Views/Identity/RecoverFromMnemonicSheet.swift:336 — `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) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:1520 — `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) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:6132 — `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) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:9179 — `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) Packages/OsaurusCore/Views/Chat/MarkdownImageView.swift:416 — `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) Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:1411 — `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) Packages/OsaurusCore/Views/Agent/Database/DatabaseHistoryView.swift:350 — `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) Packages/OsaurusCore/Utils/LoginShellPath.swift:89 — `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) Packages/OsaurusCore/Tools/ConfigurationTools.swift:1069 — `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) Packages/OsaurusCore/Subagent/OwnedSubagentOperation.swift:37 — `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) Packages/OsaurusCore/Subagent/SubagentBatchAdmissionPlanner.swift:413 — `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) Packages/OsaurusCore/Storage/StorageExportService.swift:538 — `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) Packages/OsaurusCore/Services/GitHubSkillService.swift:1278 — `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) Packages/OsaurusCore/Services/GitHubSkillService.swift:1410 — `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) Packages/OsaurusCore/Services/GitHubSkillService.swift:1424 — `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) Packages/OsaurusCore/Services/GitHubSkillService.swift:1839 — `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.
  • + 15 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (16 corresponding lines) · ×38
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/Views/DesignSystem/SettingsKitGallery.swift:228 — Packages/OsaurusCore/Views/DesignSystem/SettingsKitGallery.swift:228-246 | Packages/OsaurusCore/Views/DesignSystem/SettingsKitGallery.swift:1406-1466 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalMatrix.swift:811 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalMatrix.swift:811-1074 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReport.swift:820-853 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/AppleApps/Calendar/CalendarService.swift:426 — Packages/OsaurusCore/AppleApps/Calendar/CalendarService.swift:426-441 | Packages/OsaurusCore/AppleApps/Reminders/RemindersService.swift:341-358 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/Services/Provider/OpenAICodexOAuthService.swift:485 — Packages/OsaurusCore/Services/Provider/OpenAICodexOAuthService.swift:485-500 | Packages/OsaurusCore/Services/Provider/XAIOAuthService.swift:188-208 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigDocument.swift:963 — Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigDocument.swift:963-978 | Packages/OsaurusCore/Models/Plugin/SandboxPlugin.swift:97-114 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/Models/API/AnthropicAPI.swift:727 — Packages/OsaurusCore/Models/API/AnthropicAPI.swift:727-742 | Packages/OsaurusCore/Models/API/AnthropicAPI.swift:840-858 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/Services/Template/WorkflowsRegistryAPIClient.swift:891 — Packages/OsaurusCore/Services/Template/WorkflowsRegistryAPIClient.swift:891-912 | Packages/OsaurusCore/Services/Template/WorkflowsRegistryAPIClient.swift:1113-1128 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:7322 — Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:7322-7341 | Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:7353-7368 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/AppleScript/Loop/AppleScriptTraceLog.swift:73 — Packages/OsaurusCore/AppleScript/Loop/AppleScriptTraceLog.swift:73-90 | Packages/OsaurusCore/ComputerUse/Loop/ComputerUseTraceLog.swift:66-81 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/Storage/MemoryDatabase.swift:1729 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:1729-1744 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2186-2203 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/Services/Search/NativeSearchBackends.swift:156 — Packages/OsaurusCore/Services/Search/NativeSearchBackends.swift:156-171 | Packages/OsaurusCore/Services/Search/NativeSearchBackends.swift:244-262 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/Storage/StorageFormatConverter.swift:65 — Packages/OsaurusCore/Storage/StorageFormatConverter.swift:65-80 | Packages/OsaurusCore/Storage/StorageFormatConverter.swift:84-99 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/Models/Chat/ContentBlock.swift:1346 — Packages/OsaurusCore/Models/Chat/ContentBlock.swift:1346-1361 | Packages/OsaurusCore/Tools/RenderChartTool.swift:881-896 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/Models/Workflow/InstalledWorkflow.swift:46 — Packages/OsaurusCore/Models/Workflow/InstalledWorkflow.swift:46-61 | Packages/OsaurusCore/Services/Workflow/WorkflowEvalHarness.swift:64-82 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:773 — Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:773-800 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:937-952 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1240 — Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1240-1255 | Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:228-243 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/Views/Agent/Creation/AgentCreatorIntro.swift:58 — Packages/OsaurusCore/Views/Agent/Creation/AgentCreatorIntro.swift:58-73 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowLibraryKit.swift:328-343 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/Views/Agent/AgentsView.swift:2620 — Packages/OsaurusCore/Views/Agent/AgentsView.swift:2620-2635 | Packages/OsaurusCore/Views/Agent/BuiltInAgentAvatarPicker.swift:149-167 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/Services/Documents/BusinessDocumentStudioService.swift:870 — Packages/OsaurusCore/Services/Documents/BusinessDocumentStudioService.swift:870-885 | Packages/OsaurusCore/Services/Documents/PDFPPTXWorkflowService.swift:247-271 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsInstall.swift:374 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsInstall.swift:374-389 | Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsInstall.swift:391-409 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:929 — Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:929-944 | Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:946-961 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/Views/Workflow/FlowViewer/WorkflowFlowCanvas.swift:828 — Packages/OsaurusCore/Views/Workflow/FlowViewer/WorkflowFlowCanvas.swift:828-844 | Packages/OsaurusCore/Views/Workflow/FlowViewer/WorkflowFlowInspector.swift:256-271 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:545 — Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:545-564 | Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:566-581 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:320 — Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:320-335 | Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:337-352 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Packages/OsaurusCore/ComputerUse/Loop/DesktopResponsesModelStep.swift:46 — Packages/OsaurusCore/ComputerUse/Loop/DesktopResponsesModelStep.swift:46-61 | Packages/OsaurusCore/Services/Context/ResponsesEvaluationStep.swift:21-39 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 13 more in this group — see findings.md.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×38
  • Members sharing a duplicated core (4 members, 50+ identical tokens) Packages/OsaurusCore/AppleApps/Support/AppleScriptBridge.swift:229 — Packages/OsaurusCore/AppleApps/Support/AppleScriptBridge.swift:229-244 | Packages/OsaurusCore/Models/Configuration/CodexCLIConfiguration.swift:351-372 | Packages/OsaurusCore/Networking/HTTPProtocolErrors.swift:209-223 | Packages/OsaurusCore/Tools/ToolEnvelope.swift:668-682 — 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) Packages/OsaurusCore/Browser/Runtime/BrowserSession.swift:660 — Packages/OsaurusCore/Browser/Runtime/BrowserSession.swift:660-681 | Packages/OsaurusCore/Browser/Runtime/BrowserSession.swift:683-726 | Packages/OsaurusCore/Browser/Runtime/BrowserSession.swift:728-759 | Packages/OsaurusCore/Browser/Runtime/BrowserSession.swift:761-786 — 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) Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:237 — Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:237-244 | Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:815-823 | Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:869-878 | Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:983-992 — 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) Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:246 — Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:246-253 | Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:825-833 | Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:880-889 | Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:994-1003 — 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) Packages/OsaurusCore/Models/Chat/RequestLog.swift:1226 — Packages/OsaurusCore/Models/Chat/RequestLog.swift:1226-1234 | Packages/OsaurusCore/Models/Chat/RequestLog.swift:1237-1245 | Packages/OsaurusCore/Models/Chat/RequestLog.swift:1252-1266 | Packages/OsaurusCore/Models/Chat/RequestLog.swift:1273-1287 — 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) Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:476 — Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:476-491 | Packages/OsaurusCore/Tools/Workflow/WorkflowDiscoverTool.swift:494-509 | Packages/OsaurusCore/Views/Workflow/FlowViewer/WorkflowFlowStyle.swift:12-33 | Packages/OsaurusCore/Views/Workflow/WorkflowSummary.swift:123-144 — 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:4703 — Packages/OsaurusCore/Networking/HTTPHandler.swift:4703-4997 | Packages/OsaurusCore/Networking/HTTPHandler.swift:15863-16045 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16160-16331 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17425-17815 — 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:5943 — Packages/OsaurusCore/Networking/HTTPHandler.swift:5943-6026 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6065-6105 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8399-8451 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8773-8861 — 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:14835 — Packages/OsaurusCore/Networking/HTTPHandler.swift:14835-15164 | Packages/OsaurusCore/Networking/HTTPHandler.swift:15863-16045 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16160-16331 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17931-18081 — 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) Packages/OsaurusCore/Networking/HTTPProtocolErrors.swift:90 — Packages/OsaurusCore/Networking/HTTPProtocolErrors.swift:90-112 | Packages/OsaurusCore/Networking/HTTPProtocolErrors.swift:143-162 | Packages/OsaurusCore/Networking/HTTPProtocolErrors.swift:164-183 | Packages/OsaurusCore/Networking/HTTPProtocolErrors.swift:185-204 — 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) Packages/OsaurusCore/PrivacyFilter/Views/PrivacyPresetRulesSection.swift:35 — Packages/OsaurusCore/PrivacyFilter/Views/PrivacyPresetRulesSection.swift:35-55 | Packages/OsaurusCore/PrivacyFilter/Views/PrivacyView.swift:753-791 | Packages/OsaurusCore/PrivacyFilter/Views/PrivacyView.swift:813-846 | Packages/OsaurusCore/PrivacyFilter/Views/PrivacyView.swift:916-950 — 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) Packages/OsaurusCore/Services/AgentDelegation/NativeImageJobCoordinator.swift:66 — Packages/OsaurusCore/Services/AgentDelegation/NativeImageJobCoordinator.swift:66-102 | Packages/OsaurusCore/Services/AgentDelegation/NativeImageJobCoordinator.swift:125-159 | Packages/OsaurusCore/Services/ModelRuntime/ImageGenerationTypes.swift:165-199 | Packages/OsaurusCore/Services/ModelRuntime/ImageGenerationTypes.swift:226-260 — 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) Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:795 — Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:795-832 | Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:849-880 | Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:882-899 | Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:901-938 — 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) Packages/OsaurusCore/Services/Documents/CSVAdapter.swift:86 — Packages/OsaurusCore/Services/Documents/CSVAdapter.swift:86-125 | Packages/OsaurusCore/Services/Documents/PlainTextAdapter.swift:25-68 | Packages/OsaurusCore/Services/Documents/RichDocumentAdapter.swift:26-99 | Packages/OsaurusCore/Services/Documents/XLSXAdapter.swift:28-100 — 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) Packages/OsaurusCore/Services/Email/EmailChannelService.swift:229 — Packages/OsaurusCore/Services/Email/EmailChannelService.swift:229-239 | Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:401-411 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:744-754 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:504-514 — 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) Packages/OsaurusCore/Services/Email/EmailChannelService.swift:717 — Packages/OsaurusCore/Services/Email/EmailChannelService.swift:717-736 | Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1357-1378 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:1417-1431 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:1527-1556 — 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) Packages/OsaurusCore/Services/MCP/MCPProviderProbeService.swift:174 — Packages/OsaurusCore/Services/MCP/MCPProviderProbeService.swift:174-203 | Packages/OsaurusCore/Services/Provider/OpenAICodexOAuthService.swift:458-481 | Packages/OsaurusCore/Services/Provider/ProviderReplayDiagnostics.swift:204-246 | Packages/OsaurusCore/Services/Provider/XAIOAuthService.swift:319-342 — 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) Packages/OsaurusCore/Services/SystemPermissionService.swift:889 — Packages/OsaurusCore/Services/SystemPermissionService.swift:889-921 | Packages/OsaurusCore/Services/SystemPermissionService.swift:928-955 | Packages/OsaurusCore/Services/SystemPermissionService.swift:961-987 | Packages/OsaurusCore/Services/SystemPermissionService.swift:1028-1042 — 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) Packages/OsaurusCore/Storage/ConfigHistoryDatabase.swift:143 — Packages/OsaurusCore/Storage/ConfigHistoryDatabase.swift:143-178 | Packages/OsaurusCore/Storage/EventRunDatabase.swift:131-198 | Packages/OsaurusCore/Storage/TaskDatabase.swift:183-289 | Packages/OsaurusCore/Storage/WorkflowRunDatabase.swift:106-145 — 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) Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:514 — Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:514-569 | Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:990-1023 | Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1127-1166 | Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:246-291 — 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) Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:514 — Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:514-569 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:860-908 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:910-960 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2207-2234 — 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) Packages/OsaurusCore/Storage/MemoryDatabase.swift:1486 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:1486-1579 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:1907-1994 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2291-2319 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2377-2447 — 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) Packages/OsaurusCore/Storage/MemoryDatabase.swift:1589 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:1589-1607 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:1996-2014 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2883-2901 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2904-2922 — 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) Packages/OsaurusCore/Storage/MemoryDatabase.swift:1613 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:1613-1638 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:1644-1666 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:1668-1687 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:1694-1713 — 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) Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift:301 — Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift:301-382 | Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift:1101-1169 | Packages/OsaurusCore/Tools/Workflow/WorkflowDiscoverTool.swift:144-182 | Packages/OsaurusCore/Tools/Workflow/WorkflowRunsTool.swift:78-148 — 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.
  • + 13 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (14 corresponding lines) · ×38
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:256 — Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:256-269 | Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:209-223 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Services/ChatImport/ChatImportFastPaths.swift:205 — Packages/OsaurusCore/Services/ChatImport/ChatImportFastPaths.swift:205-219 | Packages/OsaurusCore/Services/ChatImport/ChatImportFastPaths.swift:221-234 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/PrivacyFilter/Core/PrivacyFilterPipeline.swift:1236 — Packages/OsaurusCore/PrivacyFilter/Core/PrivacyFilterPipeline.swift:1236-1249 | Packages/OsaurusCore/PrivacyFilter/Core/StreamingUnscrubber.swift:261-281 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1054 — Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1054-1067 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1086-1100 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Services/Knowledge/KnowledgeLinkResolver.swift:160 — Packages/OsaurusCore/Services/Knowledge/KnowledgeLinkResolver.swift:160-173 | Packages/OsaurusCore/Services/Knowledge/KnowledgeWriteService.swift:319-337 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Services/AgentCreation/AgentDraftStore.swift:26 — Packages/OsaurusCore/Services/AgentCreation/AgentDraftStore.swift:26-39 | Packages/OsaurusCore/Services/Workflow/WorkflowDraftStore.swift:29-42 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Identity/APIKeyManager.swift:125 — Packages/OsaurusCore/Identity/APIKeyManager.swift:125-138 | Packages/OsaurusCore/Identity/APIKeyManager.swift:162-175 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Models/Event/EventRun.swift:47 — Packages/OsaurusCore/Models/Event/EventRun.swift:47-60 | Packages/OsaurusCore/Models/Task/TaskModels.swift:53-68 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Services/Memory/MetalSafeEmbedder.swift:26 — Packages/OsaurusCore/Services/Memory/MetalSafeEmbedder.swift:26-41 | Packages/OsaurusCore/Services/Memory/MetalSafeEmbedder.swift:43-56 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Models/Voice/TranscriptionConfiguration.swift:68 — Packages/OsaurusCore/Models/Voice/TranscriptionConfiguration.swift:68-81 | Packages/OsaurusCore/Models/Voice/VADConfiguration.swift:120-134 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:2136 — Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:2136-2149 | Packages/OsaurusCore/Views/Plugin/ClaudePluginDetailView.swift:806-826 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:420 — Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:420-435 | Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:451-464 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Models/Configuration/MCPProviderConfiguration.swift:274 — Packages/OsaurusCore/Models/Configuration/MCPProviderConfiguration.swift:274-287 | Packages/OsaurusCore/Models/Configuration/MCPProviderConfiguration.swift:293-306 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Views/Router/RouterAccountUsageCenterView.swift:205 — Packages/OsaurusCore/Views/Router/RouterAccountUsageCenterView.swift:205-218 | Packages/OsaurusCore/Views/Router/RouterAccountUsageCenterView.swift:436-449 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Models/Agent/AgentInviteStore.swift:219 — Packages/OsaurusCore/Models/Agent/AgentInviteStore.swift:219-234 | Packages/OsaurusCore/Models/Knowledge/KnowledgeCollectionStore.swift:61-74 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:475 — Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:475-490 | Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:803-816 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Models/Task/TaskModels.swift:72 — Packages/OsaurusCore/Models/Task/TaskModels.swift:72-85 | Packages/OsaurusCore/Models/Task/TaskModels.swift:111-124 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:1582 — Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:1582-1598 | Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:1679-1692 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Views/Provider/ProviderCredentialPromptSheet.swift:530 — Packages/OsaurusCore/Views/Provider/ProviderCredentialPromptSheet.swift:530-543 | Packages/OsaurusCore/Views/Settings/ComputerUseSettingsView.swift:614-634 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Services/Onboarding/OnboardingFirstRun.swift:420 — Packages/OsaurusCore/Services/Onboarding/OnboardingFirstRun.swift:420-436 | Packages/OsaurusCore/Services/Onboarding/OnboardingFirstRun.swift:444-457 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Views/Agent/AgentCapabilityManagerView.swift:605 — Packages/OsaurusCore/Views/Agent/AgentCapabilityManagerView.swift:605-618 | Packages/OsaurusCore/Views/Settings/ProvidersView.swift:1323-1340 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift:537 — Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift:537-550 | Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift:554-567 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Models/Insights/ActivityLogSettings.swift:81 — Packages/OsaurusCore/Models/Insights/ActivityLogSettings.swift:81-94 | Packages/OsaurusCore/PrivacyFilter/Store/PrivacyFilterStore.swift:44-58 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Views/Plugin/SandboxPluginEditorView.swift:171 — Packages/OsaurusCore/Views/Plugin/SandboxPluginEditorView.swift:171-184 | Packages/OsaurusCore/Views/Plugin/SandboxPluginEditorView.swift:186-199 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Packages/OsaurusCore/Views/DesignSystem/SettingsFields.swift:827 — Packages/OsaurusCore/Views/DesignSystem/SettingsFields.swift:827-840 | Packages/OsaurusCore/Views/DesignSystem/SettingsFields.swift:842-855 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 13 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×37
  • Duplicated block (14 lines × 2) Packages/OsaurusCore/Managers/InsightsService.swift:788 — Packages/OsaurusCore/Managers/InsightsService.swift:788-801 | Packages/OsaurusCore/Models/Chat/RequestLog.swift:619-632 — 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) Packages/OsaurusCore/Managers/RemoteProviderManager.swift:1804 — Packages/OsaurusCore/Managers/RemoteProviderManager.swift:1804-1817 | Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:6795-6808 — 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 `Packages/OsaurusCore/Managers/RemoteProviderManager.swift:1804` 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) Packages/OsaurusCore/Models/API/AnthropicAPI.swift:977 — Packages/OsaurusCore/Models/API/AnthropicAPI.swift:977-990 | Packages/OsaurusCore/Models/Configuration/ModelInfo.swift:604-617 — 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 `Packages/OsaurusCore/Models/API/AnthropicAPI.swift:977` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:322 — Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:322-335 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:373-386 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:322` 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 (14 lines × 2) Packages/OsaurusCore/Models/Chat/SharedArtifact.swift:903 — Packages/OsaurusCore/Models/Chat/SharedArtifact.swift:903-916 | Packages/OsaurusCore/Tools/Database/DatabaseFilePathResolver.swift:313-326 — 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, `Packages/OsaurusCore/Models/Chat/SharedArtifact.swift:918` calls `sanitizeArtifactFilename`, `extractPathComponent` and `Packages/OsaurusCore/Tools/Database/DatabaseFilePathResolver.swift:328` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14 lines × 2) Packages/OsaurusCore/Models/Configuration/ModelMetadataParser.swift:296 — Packages/OsaurusCore/Models/Configuration/ModelMetadataParser.swift:296-309 | Packages/OsaurusCore/Models/Configuration/ModelMetadataParser.swift:310-323 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:9054 — Packages/OsaurusCore/Networking/HTTPHandler.swift:9054-9067 | Packages/OsaurusCore/Networking/HTTPHandler.swift:9567-9580 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:9054` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:9662 — Packages/OsaurusCore/Networking/HTTPHandler.swift:9662-9675 | Packages/OsaurusCore/Networking/HTTPHandler.swift:9695-9708 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:9662` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:10309 — Packages/OsaurusCore/Networking/HTTPHandler.swift:10309-10322 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12975-12988 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:10309` 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 (14 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:13066 — Packages/OsaurusCore/Networking/HTTPHandler.swift:13066-13079 | Packages/OsaurusCore/Networking/HTTPHandler.swift:13095-13108 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:13066` 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 (14 lines × 2) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:703 — Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:703-716 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:2439-2452 — both copies are in the same file, so extract the 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, `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:718` calls `set`, `String` and `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:2453` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14 lines × 2) Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift:177 — Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift:177-190 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalTranscript.swift:94-107 — 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 `Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift:177` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:486 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:486-499 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:581-594 — 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 `Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:486` 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) Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift:263 — Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift:263-276 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppHelperInstaller.swift:230-243 — before extracting anything, compare `Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift` and `Packages/OsaurusCore/Services/WhatsApp/WhatsAppHelperInstaller.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 57 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 `Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift:263` 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 `pins` to `IMessageHelperPins` in one and `WhatsAppHelperPins` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (14 lines × 2) Packages/OsaurusCore/Services/ModelRuntime.swift:1538 — Packages/OsaurusCore/Services/ModelRuntime.swift:1538-1551 | Packages/OsaurusCore/Services/ModelRuntime.swift:1594-1607 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/ModelRuntime.swift:1538` 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) Packages/OsaurusCore/Services/ModelRuntime.swift:2405 — Packages/OsaurusCore/Services/ModelRuntime.swift:2405-2418 | Packages/OsaurusCore/Services/ModelRuntime.swift:2554-2567 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) Packages/OsaurusCore/Services/Slack/SlackSocketModeTransportRuntime.swift:365 — Packages/OsaurusCore/Services/Slack/SlackSocketModeTransportRuntime.swift:365-378 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:1663-1676 — 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 `Packages/OsaurusCore/Services/Slack/SlackSocketModeTransportRuntime.swift:365` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Services/Slack/SlackSocketModeTransportRuntime.swift:379` calls `cancel` and `Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:1677` 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 (14 lines × 2) Packages/OsaurusCore/Storage/PluginDatabase.swift:292 — Packages/OsaurusCore/Storage/PluginDatabase.swift:292-305 | Packages/OsaurusCore/Storage/PluginDatabase.swift:319-332 — both copies are in the same file, so extract the 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 (14 lines × 2) Packages/OsaurusCore/Tools/Database/DatabaseFilePathResolver.swift:39 — Packages/OsaurusCore/Tools/Database/DatabaseFilePathResolver.swift:39-52 | Packages/OsaurusCore/Tools/Database/DatabaseFilePathResolver.swift:101-114 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/Database/DatabaseFilePathResolver.swift:39` 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) Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:388 — Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:388-401 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:485-498 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:388` 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) Packages/OsaurusCore/Views/Agent/AgentsView.swift:5640 — Packages/OsaurusCore/Views/Agent/AgentsView.swift:5640-5653 | Packages/OsaurusCore/Views/Settings/OrchestratorSupportSections.swift:215-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. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Agent/AgentsView.swift:5640` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) Packages/OsaurusCore/Views/Agent/Creation/AgentCreatorIntro.swift:60 — Packages/OsaurusCore/Views/Agent/Creation/AgentCreatorIntro.swift:60-73 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowLibraryKit.swift:330-343 — 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 (14 lines × 2) Packages/OsaurusCore/Views/Chat/ChatHistoryPane.swift:682 — Packages/OsaurusCore/Views/Chat/ChatHistoryPane.swift:682-695 | Packages/OsaurusCore/Views/Chat/ChatHistoryPane.swift:1027-1040 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Chat/ChatHistoryPane.swift:682` 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) Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:142 — Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:142-155 | Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift:138-151 — before extracting anything, compare `Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift` and `Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 146 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 `Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:142` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) Packages/OsaurusCore/Views/Chat/NativeCompactionMarkerView.swift:281 — Packages/OsaurusCore/Views/Chat/NativeCompactionMarkerView.swift:281-294 | Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift:433-446 — 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.
  • + 12 more in this group — see findings.md.
D6 · Cohesion (LCOM4) · Low cohesion · ×37
  • Low cohesion: AppDelegate (LCOM4 17) Packages/OsaurusCore/AppDelegate.swift:22 — AppDelegate's methods fall into 17 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 17 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: AgentManager (LCOM4 17) Packages/OsaurusCore/Managers/AgentManager.swift:53 — AgentManager's methods fall into 17 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 17 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: SelectableNSTextView (LCOM4 17) Packages/OsaurusCore/Views/Chat/SelectableTextView.swift:953 — SelectableNSTextView's methods fall into 17 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 17 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: LocalAgentBridge (LCOM4 12) Packages/OsaurusCore/Services/AgentBridge/LocalAgentBridge.swift:32 — LocalAgentBridge's methods fall into 12 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 12 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: Array (LCOM4 12) Packages/OsaurusCore/AppleApps/Music/MusicService.swift:345 — Array's methods fall into 12 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 12 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: NotificationService (LCOM4 11) Packages/OsaurusCore/Services/NotificationService.swift:12 — NotificationService's methods fall into 11 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 11 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: UpdaterViewModel (LCOM4 11) Packages/OsaurusCore/Services/UpdaterService.swift:11 — UpdaterViewModel's methods fall into 11 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 11 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: Data (LCOM4 11) Packages/OsaurusRepository/BoundedArchiveExtractor.swift:1048 — Data's methods fall into 11 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 11 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: String (LCOM4 11) Packages/OsaurusCore/Folder/FileEditMatcher.swift:520 — String's methods fall into 11 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 11 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: CodeNSTextView (LCOM4 9) Packages/OsaurusCore/Views/Common/CodeBlockView.swift:429 — CodeNSTextView's methods fall into 9 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: XMLElement (LCOM4 8) Packages/OsaurusCore/Services/Documents/OOXML/OOXMLPackage.swift:348 — XMLElement'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: SkillManager (LCOM4 7) Packages/OsaurusCore/Managers/SkillManager.swift:64 — SkillManager'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: FakeSlackClient (LCOM4 6) REDACTED:44 — FakeSlackClient's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: MLXService (LCOM4 6) Packages/OsaurusCore/Services/Inference/MLXService.swift:18 — MLXService's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: CellTextView (LCOM4 6) Packages/OsaurusCore/Views/Chat/NativeBlockViews.swift:1079 — CellTextView's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: FixtureCUDriver (LCOM4 5) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/FixtureCUDriver.swift:25 — FixtureCUDriver'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: HuggingFaceService (LCOM4 5) Packages/OsaurusCore/Services/HuggingFaceService.swift:11 — HuggingFaceService'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: MockMacDriver (LCOM4 5) Packages/OsaurusCore/ComputerUse/Driver/MockMacDriver.swift:13 — MockMacDriver'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: NDJSONResponseWriter (LCOM4 5) Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:712 — NDJSONResponseWriter'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: FakeTelegramClient (LCOM4 5) REDACTED:143 — FakeTelegramClient'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: PluginHostContext (LCOM4 5) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:64 — PluginHostContext'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: SyncHostedRunMonitor (LCOM4 5) Packages/OsaurusCore/Services/Sync/SyncHostedRunMonitor.swift:15 — SyncHostedRunMonitor'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: AudioInputManager (LCOM4 4) Packages/OsaurusCore/Managers/SpeechService.swift:133 — AudioInputManager'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: BackgroundTaskState (LCOM4 4) Packages/OsaurusCore/Models/BackgroundTaskModels.swift:152 — BackgroundTaskState'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: PluginRuntime (LCOM4 4) Packages/OsaurusCore/PluginHost/main.swift:361 — PluginRuntime'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.
  • + 12 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (17 corresponding lines) · ×36
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/Views/DesignSystem/SettingsKitGallery.swift:247 — Packages/OsaurusCore/Views/DesignSystem/SettingsKitGallery.swift:247-277 | Packages/OsaurusCore/Views/DesignSystem/SettingsKitGallery.swift:1470-1531 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift:957 — Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift:957-973 | Packages/OsaurusCore/Managers/WindowManager.swift:430-453 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/Tools/Workflow/WorkflowTools.swift:474 — Packages/OsaurusCore/Tools/Workflow/WorkflowTools.swift:474-490 | Packages/OsaurusCore/Tools/Workflow/WorkflowTools.swift:653-669 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/Views/Workspaces/WorkspacesIntroExplainer.swift:811 — Packages/OsaurusCore/Views/Workspaces/WorkspacesIntroExplainer.swift:811-832 | Packages/OsaurusCore/Views/Workspaces/WorkspacesIntroExplainer.swift:836-852 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1314 — Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1314-1331 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1834-1850 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/Tools/Database/DatabaseImport.swift:565 — Packages/OsaurusCore/Tools/Database/DatabaseImport.swift:565-581 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:61-78 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/Tools/ToolRegistry.swift:2260 — Packages/OsaurusCore/Tools/ToolRegistry.swift:2260-2276 | Packages/OsaurusCore/Tools/ToolRegistry.swift:2280-2296 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift:398 — Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift:398-415 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppHelperInstaller.swift:293-309 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/Services/Knowledge/KnowledgeIndexService.swift:187 — Packages/OsaurusCore/Services/Knowledge/KnowledgeIndexService.swift:187-206 | Packages/OsaurusCore/Services/Knowledge/KnowledgeIndexService.swift:212-228 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/Models/Chat/HostRunRequest.swift:65 — Packages/OsaurusCore/Models/Chat/HostRunRequest.swift:65-81 | Packages/OsaurusCore/Services/ModelRuntime/HandledGPUFailureReport.swift:49-71 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/Models/Insights/ActivityLogSettings.swift:96 — Packages/OsaurusCore/Models/Insights/ActivityLogSettings.swift:96-112 | Packages/OsaurusCore/PrivacyFilter/Store/PrivacyFilterStore.swift:62-82 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/Views/Agent/Creation/AgentCreatorIntro.swift:87 — Packages/OsaurusCore/Views/Agent/Creation/AgentCreatorIntro.swift:87-103 | Packages/OsaurusCore/Views/Workflow/Architect/ArchitectChatEmptyState.swift:30-50 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/Views/Settings/ServerSettings/AuthenticationSection.swift:98 — Packages/OsaurusCore/Views/Settings/ServerSettings/AuthenticationSection.swift:98-118 | Packages/OsaurusCore/Views/Settings/ServerView.swift:731-747 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/Views/Skill/SkillsView.swift:401 — Packages/OsaurusCore/Views/Skill/SkillsView.swift:401-418 | Packages/OsaurusCore/Views/Workspaces/WorkspaceSheets.swift:142-158 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5301 — Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5301-5319 | Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5324-5340 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:510 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:510-526 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2269-2287 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/Views/Plugin/SandboxPluginEditorView.swift:201 — Packages/OsaurusCore/Views/Plugin/SandboxPluginEditorView.swift:201-217 | Packages/OsaurusCore/Views/Plugin/SandboxPluginEditorView.swift:219-239 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/Utils/DebugLog.swift:25 — Packages/OsaurusCore/Utils/DebugLog.swift:25-48 | Packages/OsaurusCore/Utils/TTFTTrace.swift:134-150 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:3794 — Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:3794-3810 | Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:3919-3935 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:93 — Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:93-111 | Packages/OsaurusCore/Services/Documents/WorkbookWorkflowService.swift:21-37 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/Views/Agent/AgentSharedWithSection.swift:138 — Packages/OsaurusCore/Views/Agent/AgentSharedWithSection.swift:138-156 | Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:1725-1741 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Bundle/BundleCommand.swift:13 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Bundle/BundleCommand.swift:13-29 | Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Manifest/ManifestCommand.swift:13-31 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/AppleScript/Tool/AppleScriptToolDispatch.swift:848 — Packages/OsaurusCore/AppleScript/Tool/AppleScriptToolDispatch.swift:848-864 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:2575-2592 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:375 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:375-391 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:1278-1294 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Packages/OsaurusCore/Views/Plugin/ClaudePluginDetailView.swift:727 — Packages/OsaurusCore/Views/Plugin/ClaudePluginDetailView.swift:727-747 | Packages/OsaurusCore/Views/Plugin/ClaudePluginDetailView.swift:852-868 — 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.
  • + 11 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (3 corresponding lines) · ×36
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCore/DevelopmentDesign/CatalogInspector.swift:61 — Packages/OsaurusCore/DevelopmentDesign/CatalogInspector.swift:61-63 | Packages/OsaurusCore/DevelopmentDesign/CatalogInspector.swift:65-71 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsCreate.swift:44 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsCreate.swift:44-46 | Packages/OsaurusCore/Managers/TTSService.swift:722-726 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCore/Services/Skill/SkillSearchService.swift:344 — Packages/OsaurusCore/Services/Skill/SkillSearchService.swift:344-352 | Packages/OsaurusCore/Tools/Workflow/WorkflowDiscoverTool.swift:362-364 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCore/Services/ChatImport/ChatImportFastPaths.swift:364 — Packages/OsaurusCore/Services/ChatImport/ChatImportFastPaths.swift:364-368 | Packages/OsaurusCore/Services/Insights/ActivityExportService.swift:327-329 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCompat.swift:417 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCompat.swift:417-419 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalMatrix.swift:635-637 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:432 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:432-434 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:518-520 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:189 — Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:189-191 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppRPCClient.swift:182-184 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCore/AppleApps/Support/AppleSchema.swift:55 — Packages/OsaurusCore/AppleApps/Support/AppleSchema.swift:55-57 | Packages/OsaurusCore/Browser/Tool/BrowserChildTools.swift:299-301 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCore/AppleApps/Support/AppleSchema.swift:63 — Packages/OsaurusCore/AppleApps/Support/AppleSchema.swift:63-65 | Packages/OsaurusCore/Browser/Tool/BrowserChildTools.swift:307-309 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCore/Services/Credentials/CredentialStore.swift:44 — Packages/OsaurusCore/Services/Credentials/CredentialStore.swift:44-46 | Packages/OsaurusCore/Services/Keychain/AgentSecretsKeychain.swift:64-70 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCore/Services/Keychain/ToolSecretsKeychain.swift:296 — Packages/OsaurusCore/Services/Keychain/ToolSecretsKeychain.swift:296-298 | Packages/OsaurusCore/Services/Keychain/WorkflowSecretsKeychain.swift:65-67 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCore/Services/MCP/MCPProviderKeychain.swift:49 — Packages/OsaurusCore/Services/MCP/MCPProviderKeychain.swift:49-51 | Packages/OsaurusCore/Services/Provider/RemoteProviderKeychain.swift:58-61 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCore/Subagent/Kinds/AppleScriptKind.swift:511 — Packages/OsaurusCore/Subagent/Kinds/AppleScriptKind.swift:511-513 | Packages/OsaurusCore/Views/Workflow/FlowViewer/WorkflowFlowStory.swift:95-97 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCore/Services/ChatImport/SafeImportFetcher.swift:59 — Packages/OsaurusCore/Services/ChatImport/SafeImportFetcher.swift:59-61 | Packages/OsaurusCore/Services/Template/TemplateImportRouter.swift:255-257 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCore/Services/Router/WorkspaceAgentProofSigner.swift:14 — Packages/OsaurusCore/Services/Router/WorkspaceAgentProofSigner.swift:14-16 | Packages/OsaurusCore/Services/Template/WorkflowShareService.swift:1236-1238 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCore/Views/Chat/ClarifyPromptOverlay.swift:285 — Packages/OsaurusCore/Views/Chat/ClarifyPromptOverlay.swift:285-291 | Packages/OsaurusCore/Views/Model/ModelDetailView.swift:1600-1602 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCLI/Sources/OsaurusCLICore/Services/AccessKeyCredential.swift:101 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Services/AccessKeyCredential.swift:101-103 | Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:7121-7123 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:1648 — Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:1648-1650 | Packages/OsaurusCore/Utils/ZipArchive.swift:273-275 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:74 — Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:74-76 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppRPCClient.swift:68-70 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:215 — Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:215-217 | Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:434-441 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:218 — Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:218-220 | Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:443-450 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:70 — Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:70-72 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppRPCClient.swift:64-66 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCore/Views/Chat/NativeCompactionMarkerView.swift:42 — Packages/OsaurusCore/Views/Chat/NativeCompactionMarkerView.swift:42-44 | Packages/OsaurusCore/Views/Chat/NativeFileDiffView.swift:150-152 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCore/Services/Auth/LoginWithOsaurus/LoginWithOsaurusRequest.swift:179 — Packages/OsaurusCore/Services/Auth/LoginWithOsaurus/LoginWithOsaurusRequest.swift:179-181 | Packages/OsaurusCore/Services/Router/WorkspacesDeepLinkRouter.swift:35-38 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) Packages/OsaurusCore/AppleApps/Maps/MapsTools.swift:150 — Packages/OsaurusCore/AppleApps/Maps/MapsTools.swift:150-152 | Packages/OsaurusCore/AppleApps/Music/MusicTools.swift:33-35 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 11 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (20 corresponding lines) · ×28
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1272 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1272-1293 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:1440-1459 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Models/Workflow/InstalledWorkflow.swift:270 — Packages/OsaurusCore/Models/Workflow/InstalledWorkflow.swift:270-290 | Packages/OsaurusCore/Models/Workflow/WorkflowDraft.swift:87-106 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1154 — Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1154-1178 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1247-1266 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Models/AgentChannel/AgentChannelConfiguration.swift:885 — Packages/OsaurusCore/Models/AgentChannel/AgentChannelConfiguration.swift:885-909 | Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:141-160 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Services/Template/WorkflowShareService.swift:725 — Packages/OsaurusCore/Services/Template/WorkflowShareService.swift:725-745 | Packages/OsaurusCore/Services/Template/WorkflowShareService.swift:747-766 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Services/Auth/OwnerDeviceAccessHost.swift:341 — Packages/OsaurusCore/Services/Auth/OwnerDeviceAccessHost.swift:341-371 | Packages/OsaurusCore/Services/Router/WorkspaceAgentAccessHost.swift:336-355 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Views/Plugin/ClaudeMarketplaceDetailView.swift:417 — Packages/OsaurusCore/Views/Plugin/ClaudeMarketplaceDetailView.swift:417-439 | Packages/OsaurusCore/Views/Plugin/ClaudePluginDetailView.swift:637-656 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Views/Agent/AgentsView.swift:5639 — Packages/OsaurusCore/Views/Agent/AgentsView.swift:5639-5658 | Packages/OsaurusCore/Views/Settings/OrchestratorSupportSections.swift:214-233 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:1565 — Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:1565-1590 | Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:1809-1828 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:2087 — Packages/OsaurusCore/Views/Plugin/PluginsView.swift:2087-2106 | Packages/OsaurusCore/Views/Workspaces/WorkspacesView.swift:524-547 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Views/Settings/ServerSettings/CacheSection.swift:476 — Packages/OsaurusCore/Views/Settings/ServerSettings/CacheSection.swift:476-495 | Packages/OsaurusCore/Views/Settings/ServerSettings/MTPSection.swift:261-282 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Views/Workflow/Architect/WorkflowRequirementsPanel.swift:96 — Packages/OsaurusCore/Views/Workflow/Architect/WorkflowRequirementsPanel.swift:96-118 | Packages/OsaurusCore/Views/Workflow/FlowViewer/WorkflowFlowInspector.swift:193-212 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Views/Chat/CompactionDialogView.swift:190 — Packages/OsaurusCore/Views/Chat/CompactionDialogView.swift:190-209 | Packages/OsaurusCore/Views/Chat/CompactionDialogView.swift:211-237 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Views/Agent/Creation/AgentCreatorIntro.swift:105 — Packages/OsaurusCore/Views/Agent/Creation/AgentCreatorIntro.swift:105-128 | Packages/OsaurusCore/Views/Workflow/Architect/ArchitectChatEmptyState.swift:52-71 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/ComputerUse/Driver/Mac/Screenshot.swift:293 — Packages/OsaurusCore/ComputerUse/Driver/Mac/Screenshot.swift:293-313 | Packages/OsaurusCore/ComputerUse/Driver/Mac/Screenshot.swift:315-334 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Services/DeclaredReasoningEffort.swift:103 — Packages/OsaurusCore/Services/DeclaredReasoningEffort.swift:103-123 | Packages/OsaurusCore/Services/LocalReasoningCapability.swift:88-107 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:393 — Packages/OsaurusCore/Views/Plugin/PluginsView.swift:393-412 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:2565-2584 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Models/Agent/AgentGenerationSettings.swift:20 — Packages/OsaurusCore/Models/Agent/AgentGenerationSettings.swift:20-39 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:1586-1612 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Services/Discord/DiscordGatewayPresenceRuntime.swift:51 — Packages/OsaurusCore/Services/Discord/DiscordGatewayPresenceRuntime.swift:51-70 | Packages/OsaurusCore/Services/Slack/SlackSocketModeTransportRuntime.swift:40-59 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/PrivacyFilter/Core/MessageScrubbing.swift:380 — Packages/OsaurusCore/PrivacyFilter/Core/MessageScrubbing.swift:380-403 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyFilterPipeline.swift:1164-1183 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Storage/SchedulerDatabase.swift:310 — Packages/OsaurusCore/Storage/SchedulerDatabase.swift:310-329 | Packages/OsaurusCore/Storage/SchedulerDatabase.swift:332-355 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Services/AgentChannel/AgentChannelPublishService.swift:540 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelPublishService.swift:540-559 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelPublishService.swift:562-581 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Models/Schedule/Schedule.swift:265 — Packages/OsaurusCore/Models/Schedule/Schedule.swift:265-290 | Packages/OsaurusCore/Models/Schedule/Schedule.swift:387-406 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Services/Telegram/TelegramAPIClient.swift:433 — Packages/OsaurusCore/Services/Telegram/TelegramAPIClient.swift:433-452 | Packages/OsaurusCore/Services/Telegram/TelegramAPIClient.swift:454-475 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1828 — Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1828-1847 | Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1849-1870 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 3 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×27
  • Duplicated block (15 lines × 2) Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1317 — Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1317-1331 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1836-1850 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1317` 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, `Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1316` calls `ensureMessageStart` and `Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1835` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (15 lines × 2) Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:477 — Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:477-491 | Packages/OsaurusCore/Tools/Workflow/WorkflowDiscoverTool.swift:495-509 — 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 (15 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:3572 — Packages/OsaurusCore/Networking/HTTPHandler.swift:3572-3586 | Packages/OsaurusCore/Networking/HTTPHandler.swift:3600-3614 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:3572` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:10016 — Packages/OsaurusCore/Networking/HTTPHandler.swift:10016-10030 | Packages/OsaurusCore/Networking/HTTPHandler.swift:10142-10156 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:10016` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:14040 — Packages/OsaurusCore/Networking/HTTPHandler.swift:14040-14054 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14142-14156 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:14040` 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) Packages/OsaurusCore/Services/Chat/ChatSessionWarmup.swift:102 — Packages/OsaurusCore/Services/Chat/ChatSessionWarmup.swift:102-116 | Packages/OsaurusCore/Views/Chat/ChatView.swift:8340-8354 — 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 `Packages/OsaurusCore/Services/Chat/ChatSessionWarmup.swift:102` 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) Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:197 — Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:197-211 | Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:359-373 — 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 `Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:197` 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) Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift:167 — Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift:167-181 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppHelperInstaller.swift:168-182 — before extracting anything, compare `Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift` and `Packages/OsaurusCore/Services/WhatsApp/WhatsAppHelperInstaller.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 57 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 `Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift:167` 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 (15 lines × 2) Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:165 — Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:165-179 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppWatchTransportRuntime.swift:147-161 — before extracting anything, compare `Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift` and `Packages/OsaurusCore/Services/WhatsApp/WhatsAppWatchTransportRuntime.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 88 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 `Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:165` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) Packages/OsaurusCore/Services/MediaGeneration/MediaGenerationCoordinator.swift:487 — Packages/OsaurusCore/Services/MediaGeneration/MediaGenerationCoordinator.swift:487-501 | Packages/OsaurusCore/Services/MediaGeneration/MediaGenerationCoordinator.swift:503-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. 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 (15 lines × 2) Packages/OsaurusCore/Services/ModelRuntime/ModelResidencyManager.swift:107 — Packages/OsaurusCore/Services/ModelRuntime/ModelResidencyManager.swift:107-121 | Packages/OsaurusCore/Services/ModelRuntime/ModelResidencyManager.swift:177-191 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/ModelRuntime/ModelResidencyManager.swift:107` 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) Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:590 — Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:590-604 | Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:620-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. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:590` 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 (15 lines × 2) Packages/OsaurusCore/Services/Slack/SlackSocketModeTransportRuntime.swift:392 — Packages/OsaurusCore/Services/Slack/SlackSocketModeTransportRuntime.swift:392-406 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:1688-1702 — 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 `Packages/OsaurusCore/Services/Slack/SlackSocketModeTransportRuntime.swift:392` 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) Packages/OsaurusCore/Storage/AgentDatabase.swift:1134 — Packages/OsaurusCore/Storage/AgentDatabase.swift:1134-1148 | Packages/OsaurusCore/Storage/AgentDatabase.swift:1293-1307 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Storage/AgentDatabase.swift:1134` 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 (15 lines × 2) Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:883 — Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:883-897 | Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:910-924 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:883` 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, `Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:898` calls `log` and `Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:925` 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 (15 lines × 2) Packages/OsaurusCore/Subagent/SpawnDescriptors.swift:245 — Packages/OsaurusCore/Subagent/SpawnDescriptors.swift:245-259 | Packages/OsaurusCore/Subagent/SpawnDescriptors.swift:288-302 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Subagent/SpawnDescriptors.swift:245` 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) Packages/OsaurusCore/Tools/AgentChannelTools.swift:94 — Packages/OsaurusCore/Tools/AgentChannelTools.swift:94-108 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:236-250 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/AgentChannelTools.swift:94` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) Packages/OsaurusCore/Utils/ChatPerfTrace.swift:178 — Packages/OsaurusCore/Utils/ChatPerfTrace.swift:178-192 | Packages/OsaurusCore/Utils/TTFTTrace.swift:136-150 — 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 `Packages/OsaurusCore/Utils/ChatPerfTrace.swift:178` 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) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:227 — Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:227-241 | Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:877-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. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:227` 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, `Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:226` calls `isAgentExpanded` and `Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:876` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (15 lines × 2) Packages/OsaurusCore/Views/Common/SimpleComponents.swift:64 — Packages/OsaurusCore/Views/Common/SimpleComponents.swift:64-78 | Packages/OsaurusCore/Views/Model/ModelDetailView.swift:1549-1563 — 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) Packages/OsaurusCore/Views/Event/EventFormComponents.swift:588 — Packages/OsaurusCore/Views/Event/EventFormComponents.swift:588-602 | Packages/OsaurusCore/Views/Event/EventFormComponents.swift:1261-1275 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Event/EventFormComponents.swift:588` 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 (15 lines × 2) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:398 — Packages/OsaurusCore/Views/Plugin/PluginsView.swift:398-412 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:2570-2584 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Plugin/PluginsView.swift:398` 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) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:774 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:774-788 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:837-851 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 368 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 (15 lines × 2) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:671 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:671-685 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:888-902 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 680 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 (15 lines × 2) Packages/OsaurusCore/Views/Settings/RemoteProvidersView.swift:482 — Packages/OsaurusCore/Views/Settings/RemoteProvidersView.swift:482-496 | Packages/OsaurusCore/Views/Settings/RemoteProvidersView.swift:643-657 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 2 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (23 corresponding lines) · ×26
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Models/Workflow/WorkflowRun.swift:199 — Packages/OsaurusCore/Models/Workflow/WorkflowRun.swift:199-221 | Packages/OsaurusCore/Models/Workflow/WorkflowRun.swift:544-566 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) helpers/osaurus-wa/bridge.go:830 — helpers/osaurus-wa/bridge.go:830-853 | helpers/osaurus-wa/bridge.go:928-950 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Views/Plugin/ClaudePluginDetailView.swift:971 — Packages/OsaurusCore/Views/Plugin/ClaudePluginDetailView.swift:971-993 | Packages/OsaurusCore/Views/Plugin/ClaudePluginDetailView.swift:1047-1069 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Views/Settings/ServerSettings/LiveActivitySection.swift:107 — Packages/OsaurusCore/Views/Settings/ServerSettings/LiveActivitySection.swift:107-129 | Packages/OsaurusCore/Views/Settings/ServerSettings/LiveActivitySection.swift:140-163 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Services/Documents/CSVAdapter.swift:290 — Packages/OsaurusCore/Services/Documents/CSVAdapter.swift:290-312 | Packages/OsaurusCore/Services/Documents/CSVAdapter.swift:314-341 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Services/Template/WorkflowShareService.swift:585 — Packages/OsaurusCore/Services/Template/WorkflowShareService.swift:585-607 | Packages/OsaurusCore/Services/Template/WorkflowShareService.swift:612-635 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:3454 — Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:3454-3477 | Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:3489-3511 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Tools/ToolRegistry.swift:2741 — Packages/OsaurusCore/Tools/ToolRegistry.swift:2741-2763 | Packages/OsaurusCore/Tools/ToolRegistry.swift:2768-2790 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Views/Router/RouterAccountUsageCenterView.swift:531 — Packages/OsaurusCore/Views/Router/RouterAccountUsageCenterView.swift:531-553 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowDetailPage.swift:218-242 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:728 — Packages/OsaurusCore/Views/Plugin/PluginsView.swift:728-752 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:2424-2446 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:82 — Packages/OsaurusCore/Views/Plugin/PluginsView.swift:82-104 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:2284-2306 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Views/Plugin/ClaudePluginUserConfigSheet.swift:85 — Packages/OsaurusCore/Views/Plugin/ClaudePluginUserConfigSheet.swift:85-107 | Packages/OsaurusCore/Views/Plugin/ToolSecretsSheet.swift:117-144 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Views/Plugin/ClaudePluginUserConfigSheet.swift:32 — Packages/OsaurusCore/Views/Plugin/ClaudePluginUserConfigSheet.swift:32-54 | Packages/OsaurusCore/Views/Plugin/ToolSecretsSheet.swift:50-81 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:850 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:850-872 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1082-1104 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Views/Settings/BrowserSettingsView.swift:197 — Packages/OsaurusCore/Views/Settings/BrowserSettingsView.swift:197-222 | Packages/OsaurusCore/Views/Settings/ComputerUseSettingsView.swift:285-307 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:1613 — Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:1613-1635 | Packages/OsaurusCore/Services/Documents/XLSXAdapter.swift:1103-1126 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Services/Router/OsaurusRouterAccountService.swift:338 — Packages/OsaurusCore/Services/Router/OsaurusRouterAccountService.swift:338-360 | Packages/OsaurusCore/Services/Router/OsaurusRouterAccountService.swift:367-389 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Models/Evidence/EvidenceReportRegistry.swift:94 — Packages/OsaurusCore/Models/Evidence/EvidenceReportRegistry.swift:94-116 | Packages/OsaurusCore/Models/Evidence/EvidenceReportRegistry.swift:157-179 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Models/Configuration/MCPProviderTemplate.swift:143 — Packages/OsaurusCore/Models/Configuration/MCPProviderTemplate.swift:143-171 | Packages/OsaurusCore/Services/GitHubSkillService.swift:542-564 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Services/ModelRuntime/ImageGenerationTypes.swift:58 — Packages/OsaurusCore/Services/ModelRuntime/ImageGenerationTypes.swift:58-80 | Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:55-77 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:308 — Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:308-330 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2351-2375 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Managers/BlockMemoizer.swift:419 — Packages/OsaurusCore/Managers/BlockMemoizer.swift:419-441 | Packages/OsaurusCore/Views/Chat/MessageThreadView.swift:86-109 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1307 — Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1307-1329 | Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1714-1736 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Services/SystemPermissionService.swift:217 — Packages/OsaurusCore/Services/SystemPermissionService.swift:217-242 | Packages/OsaurusCore/Services/SystemPermissionService.swift:370-392 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:841 — Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:841-863 | Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:900-923 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 1 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (19 corresponding lines) · ×26
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Services/Event/FolderEventSource.swift:446 — Packages/OsaurusCore/Services/Event/FolderEventSource.swift:446-464 | Packages/OsaurusCore/Services/Knowledge/KnowledgeFolderWatcher.swift:172-195 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Views/Model/HuggingFaceImportSheet.swift:58 — Packages/OsaurusCore/Views/Model/HuggingFaceImportSheet.swift:58-76 | Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:1843-1864 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Storage/MethodDatabase.swift:353 — Packages/OsaurusCore/Storage/MethodDatabase.swift:353-371 | Packages/OsaurusCore/Storage/RouterBillingDatabase.swift:484-504 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Views/Workspaces/WorkspacesIntroExplainer.swift:590 — Packages/OsaurusCore/Views/Workspaces/WorkspacesIntroExplainer.swift:590-608 | Packages/OsaurusCore/Views/Workspaces/WorkspacesIntroExplainer.swift:610-628 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Services/Method/MethodService.swift:123 — Packages/OsaurusCore/Services/Method/MethodService.swift:123-142 | Packages/OsaurusCore/Services/Method/MethodService.swift:144-162 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Services/Knowledge/KnowledgeSearchService.swift:119 — Packages/OsaurusCore/Services/Knowledge/KnowledgeSearchService.swift:119-141 | Packages/OsaurusCore/Services/Memory/MemorySearchService.swift:226-244 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5888 — Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5888-5906 | Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5926-5944 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Services/Sync/SyncHostRunner.swift:799 — Packages/OsaurusCore/Services/Sync/SyncHostRunner.swift:799-817 | Packages/OsaurusCore/Services/Sync/SyncHostRunner.swift:820-838 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:404 — Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:404-422 | Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:452-473 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Models/AgentChannel/AgentChannelConfiguration.swift:252 — Packages/OsaurusCore/Models/AgentChannel/AgentChannelConfiguration.swift:252-270 | Packages/OsaurusCore/Models/AgentChannel/AgentChannelConfiguration.swift:292-316 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Views/Memory/MemoryDiagnosticsViews.swift:670 — Packages/OsaurusCore/Views/Memory/MemoryDiagnosticsViews.swift:670-688 | Packages/OsaurusCore/Views/Memory/MemoryDiagnosticsViews.swift:745-769 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Storage/MemoryDatabase.swift:2155 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:2155-2173 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2602-2623 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Managers/SkillManager.swift:257 — Packages/OsaurusCore/Managers/SkillManager.swift:257-278 | Packages/OsaurusCore/Managers/SkillManager.swift:285-303 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusRepository/CentralRepositoryManager.swift:375 — Packages/OsaurusRepository/CentralRepositoryManager.swift:375-396 | Packages/OsaurusRepository/PluginInstallManager.swift:583-601 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1229 — Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1229-1247 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1315-1333 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsCreate.swift:62 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsCreate.swift:62-80 | Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsCreate.swift:82-108 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Models/Chat/ChatInputHistory.swift:45 — Packages/OsaurusCore/Models/Chat/ChatInputHistory.swift:45-63 | Packages/OsaurusCore/Models/Chat/ChatInputHistory.swift:69-87 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Models/Chat/RequestLog.swift:455 — Packages/OsaurusCore/Models/Chat/RequestLog.swift:455-473 | Packages/OsaurusCore/Services/Provider/OpenAICodexOAuthService.swift:123-141 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Models/Configuration/SettingsSearchIndex.swift:41 — Packages/OsaurusCore/Models/Configuration/SettingsSearchIndex.swift:41-59 | Packages/OsaurusCore/Services/Router/OsaurusRouterTypes.swift:463-485 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift:109 — Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift:109-129 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalTranscript.swift:50-68 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:707 — Packages/OsaurusCore/Views/Plugin/PluginsView.swift:707-725 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:2400-2421 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Services/ModelRuntime/RuntimeProofMatrixReporter.swift:170 — Packages/OsaurusCore/Services/ModelRuntime/RuntimeProofMatrixReporter.swift:170-190 | Packages/OsaurusCore/Storage/AgentDatabase.swift:199-217 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Managers/ToastManager.swift:299 — Packages/OsaurusCore/Managers/ToastManager.swift:299-318 | Packages/OsaurusCore/Managers/ToastManager.swift:321-339 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Managers/ToastManager.swift:230 — Packages/OsaurusCore/Managers/ToastManager.swift:230-248 | Packages/OsaurusCore/Managers/ToastManager.swift:251-269 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:243 — Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:243-261 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:274-292 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 1 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×26
  • Duplicated block (6 lines × 3) Packages/OsaurusCore/AppleApps/Support/AppleScriptBridge.swift:233 — Packages/OsaurusCore/AppleApps/Support/AppleScriptBridge.swift:233-238 | Packages/OsaurusCore/Networking/HTTPProtocolErrors.swift:213-218 | Packages/OsaurusCore/Tools/ToolEnvelope.swift:672-677 — 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 `Packages/OsaurusCore/AppleApps/Support/AppleScriptBridge.swift:233` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) Packages/OsaurusCore/Models/AgentChannel/AgentChannelLiveProofReadiness.swift:41 — Packages/OsaurusCore/Models/AgentChannel/AgentChannelLiveProofReadiness.swift:41-46 | Packages/OsaurusCore/Models/AgentChannel/AgentChannelLiveProofReadiness.swift:204-209 | Packages/OsaurusCore/Models/AgentChannel/AgentChannelLiveProofReadiness.swift:283-288 — 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 (6 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:3551 — Packages/OsaurusCore/Networking/HTTPHandler.swift:3551-3556 | Packages/OsaurusCore/Networking/HTTPHandler.swift:4079-4085 | Packages/OsaurusCore/Networking/HTTPLoopHelpers.swift:181-186 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:3551` 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 × 3) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3609 — Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3609-3616 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1887-1894 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3186-3191 — 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 `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3609` 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.
  • Duplicated block (6 lines × 3) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:523 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:523-528 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:838-843 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:620-627 — 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 `Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:523` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.swift:43 — Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.swift:43-50 | Packages/OsaurusCore/Tools/AgentLoopTools.swift:313-318 | Packages/OsaurusCore/Tools/AgentLoopTools.swift:621-626 — 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 `Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.swift:43` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 3) Packages/OsaurusCore/Services/Router/OsaurusRouterAPIClient.swift:60 — Packages/OsaurusCore/Services/Router/OsaurusRouterAPIClient.swift:60-65 | Packages/OsaurusCore/Services/Router/OsaurusRouterAPIClient.swift:333-338 | Packages/OsaurusCore/Services/Router/OsaurusRouterAPIClient.swift:472-477 — 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 (6 lines × 3) Packages/OsaurusCore/Services/Router/OsaurusRouterAPIClient.swift:629 — Packages/OsaurusCore/Services/Router/OsaurusRouterAPIClient.swift:629-634 | Packages/OsaurusCore/Services/Router/OsaurusRouterAPIClient.swift:637-642 | Packages/OsaurusCore/Services/Router/OsaurusRouterAPIClient.swift:664-669 — 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. 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 × 3) Packages/OsaurusCore/Services/Template/WorkflowShareService.swift:735 — Packages/OsaurusCore/Services/Template/WorkflowShareService.swift:735-740 | Packages/OsaurusCore/Services/Template/WorkflowShareService.swift:757-762 | Packages/OsaurusCore/Services/Template/WorkflowShareService.swift:826-831 — 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 `Packages/OsaurusCore/Services/Template/WorkflowShareService.swift:735` 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) Packages/OsaurusCore/Services/Template/WorkflowsRegistryAPIClient.swift:1037 — Packages/OsaurusCore/Services/Template/WorkflowsRegistryAPIClient.swift:1037-1042 | Packages/OsaurusCore/Services/Template/WorkflowsRegistryAPIClient.swift:1048-1053 | Packages/OsaurusCore/Services/Template/WorkflowsRegistryAPIClient.swift:1079-1084 — 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 (6 lines × 3) Packages/OsaurusCore/Storage/ActivityLogStore.swift:1107 — Packages/OsaurusCore/Storage/ActivityLogStore.swift:1107-1112 | Packages/OsaurusCore/Storage/ActivityLogStore.swift:1118-1123 | Packages/OsaurusCore/Storage/ActivityLogStore.swift:1138-1143 — 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 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 × 3) Packages/OsaurusCore/Storage/TaskDatabase.swift:640 — Packages/OsaurusCore/Storage/TaskDatabase.swift:640-645 | Packages/OsaurusCore/Storage/TaskDatabase.swift:653-658 | Packages/OsaurusCore/Storage/TaskDatabase.swift:674-679 — 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 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 × 3) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1693 — Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1693-1698 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2118-2125 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2687-2692 — 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 `Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1693` 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 × 3) Packages/OsaurusCore/Tools/Database/SchedulerTools.swift:25 — Packages/OsaurusCore/Tools/Database/SchedulerTools.swift:25-30 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReviewReport.swift:995-1002 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalScoreboard.swift:896-903 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (6 lines × 3) Packages/OsaurusCore/Tools/Workflow/WorkflowTools.swift:542 — Packages/OsaurusCore/Tools/Workflow/WorkflowTools.swift:542-547 | Packages/OsaurusCore/Tools/Workflow/WorkflowTools.swift:573-578 | Packages/OsaurusCore/Tools/Workflow/WorkflowTools.swift:619-624 — 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 (6 lines × 3) Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2443 — Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2443-2448 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2493-2498 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:3606-3611 — 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 `Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2443` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) Packages/OsaurusCore/Views/Event/EventEditorSheet.swift:232 — Packages/OsaurusCore/Views/Event/EventEditorSheet.swift:232-238 | Packages/OsaurusCore/Views/Knowledge/KnowledgeView.swift:430-436 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:2142-2147 — 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 `Packages/OsaurusCore/Views/Event/EventEditorSheet.swift:232` 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 × 3) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:559 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:559-565 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalDiff.swift:531-536 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReviewReport.swift:898-904 — 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 `Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:559` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (6 lines × 3) Packages/OsaurusCore/Services/MCP/MCPProviderProbeService.swift:193 — Packages/OsaurusCore/Services/MCP/MCPProviderProbeService.swift:193-198 | Packages/OsaurusCore/Services/Provider/OpenAICodexOAuthService.swift:471-476 | Packages/OsaurusCore/Services/Provider/XAIOAuthService.swift:332-337 — 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) Packages/OsaurusCore/Models/AgentChannel/AgentChannelConfiguration.swift:1118 — Packages/OsaurusCore/Models/AgentChannel/AgentChannelConfiguration.swift:1118-1123 | Packages/OsaurusCore/Models/IMessage/IMessageConnectionConfiguration.swift:318-323 | Packages/OsaurusCore/Models/WhatsApp/WhatsAppConnectionConfiguration.swift:274-279 — before extracting anything, compare `Packages/OsaurusCore/Models/IMessage/IMessageConnectionConfiguration.swift` and `Packages/OsaurusCore/Models/WhatsApp/WhatsAppConnectionConfiguration.swift` as WHOLE FILES: this scan already matched 6 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.
  • Duplicated block (6 lines × 3) Packages/OsaurusCore/Services/Sync/SyncHostRunner.swift:57 — Packages/OsaurusCore/Services/Sync/SyncHostRunner.swift:57-62 | Packages/OsaurusCore/Services/Sync/SyncManageFeed.swift:52-57 | Packages/OsaurusCore/Services/Sync/SyncServedChats.swift:169-174 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Packages/OsaurusCore/Services/Sync/SyncServedChats.swift:166` calls `syncLocalState`, `appendingPathComponent` and `Packages/OsaurusCore/Services/Sync/SyncHostRunner.swift:54` 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 × 3) Packages/OsaurusCore/Models/Discord/DiscordConnectionConfiguration.swift:113 — Packages/OsaurusCore/Models/Discord/DiscordConnectionConfiguration.swift:113-118 | Packages/OsaurusCore/Models/Slack/SlackConnectionConfiguration.swift:229-234 | Packages/OsaurusCore/Models/Telegram/TelegramConnectionConfiguration.swift:195-200 — before extracting anything, compare `Packages/OsaurusCore/Models/Discord/DiscordConnectionConfiguration.swift` and `Packages/OsaurusCore/Models/Slack/SlackConnectionConfiguration.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `connectionId` to `String = AgentChannelConnection.nativeDiscordConnectionId` in one and `String = AgentChannelConnection.nativeSlackConnectionId` 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 × 3) Packages/OsaurusCore/Models/Discord/DiscordConnectionConfiguration.swift:157 — Packages/OsaurusCore/Models/Discord/DiscordConnectionConfiguration.swift:157-162 | Packages/OsaurusCore/Models/Slack/SlackConnectionConfiguration.swift:283-288 | Packages/OsaurusCore/Models/Telegram/TelegramConnectionConfiguration.swift:239-244 — before extracting anything, compare `Packages/OsaurusCore/Models/Discord/DiscordConnectionConfiguration.swift` and `Packages/OsaurusCore/Models/Slack/SlackConnectionConfiguration.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `connectionId` to `String = AgentChannelConnection.nativeDiscordConnectionId` in one and `String = AgentChannelConnection.nativeSlackConnectionId` 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 × 3) Packages/OsaurusCore/Services/Method/MethodSearchService.swift:32 — Packages/OsaurusCore/Services/Method/MethodSearchService.swift:32-37 | Packages/OsaurusCore/Services/Skill/SkillSearchService.swift:46-51 | Packages/OsaurusCore/Services/Tool/ToolSearchService.swift:128-133 — before extracting anything, compare `Packages/OsaurusCore/Services/Method/MethodSearchService.swift` and `Packages/OsaurusCore/Services/Skill/SkillSearchService.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 3) Packages/OsaurusCore/Storage/EventRunDatabase.swift:406 — Packages/OsaurusCore/Storage/EventRunDatabase.swift:406-411 | Packages/OsaurusCore/Storage/WorkflowRunDatabase.swift:207-212 | Packages/OsaurusCore/Storage/WorkflowRunDatabase.swift:250-255 — before extracting anything, compare `Packages/OsaurusCore/Storage/EventRunDatabase.swift` and `Packages/OsaurusCore/Storage/WorkflowRunDatabase.swift` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 68 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.
  • + 1 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×23
  • Duplicated block (16 lines × 2) Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:854 — Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:854-869 | Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:1079-1094 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:854` 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 (16 lines × 2) Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:129 — Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:129-144 | Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:969-984 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:129` 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 (16 lines × 2) Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift:1289 — Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift:1289-1304 | Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift:1389-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 `Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift:1289` 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 (16 lines × 2) Packages/OsaurusCore/Managers/HotKeyManager.swift:73 — Packages/OsaurusCore/Managers/HotKeyManager.swift:73-88 | Packages/OsaurusCore/Managers/TranscriptionHotKeyManager.swift:92-108 — 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 `Packages/OsaurusCore/Managers/HotKeyManager.swift:73` 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 (16 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:3190 — Packages/OsaurusCore/Networking/HTTPHandler.swift:3190-3205 | Packages/OsaurusCore/Networking/HTTPHandler.swift:3228-3243 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:14187 — Packages/OsaurusCore/Networking/HTTPHandler.swift:14187-14202 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14256-14271 — both copies are in the same file, so extract the 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, `Packages/OsaurusCore/Networking/HTTPHandler.swift:14203` calls `makeHop` and `Packages/OsaurusCore/Networking/HTTPHandler.swift:14272` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (16 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:15907 — Packages/OsaurusCore/Networking/HTTPHandler.swift:15907-15922 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16222-16237 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:15907` 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 before the matched lines, `Packages/OsaurusCore/Networking/HTTPHandler.swift:15903` calls `rejectInvalidHTTPToolChoice`, `ResponsesInferenceRequest`, `ollama` and `Packages/OsaurusCore/Networking/HTTPHandler.swift:16220` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (16 lines × 2) Packages/OsaurusCore/Services/AgentDelegation/NativeImageJobCoordinator.swift:85 — Packages/OsaurusCore/Services/AgentDelegation/NativeImageJobCoordinator.swift:85-100 | Packages/OsaurusCore/Services/ModelRuntime/ImageGenerationTypes.swift:183-198 — 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. Note what the matched lines are: every one of them assigns one field to another, so the block is a hand-written mapper between two data shapes rather than behaviour with a helper inside it. Extracting one shared function only works if both sites map the SAME pair of types in the same direction — check that first, because inverse or differently-typed mappers have no single function they can both call. Where they do not, the moves that exist are a generated or reflective mapper, a common embedded/base type the fields live on once, or accepting the run and covering it with a test that fails when a field is added to one side only.
  • Duplicated block (16 lines × 2) Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift:359 — Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift:359-374 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppRuntimeAssets.swift:205-220 — before extracting anything, compare `Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift` and `Packages/OsaurusCore/Services/WhatsApp/WhatsAppRuntimeAssets.swift` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 92 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 (16 lines × 2) Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:460 — Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:460-475 | Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:508-523 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:460` 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 (16 lines × 2) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1669 — Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1669-1684 | Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:2155-2170 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1669` 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) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:1761 — Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:1761-1776 | Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:1922-1937 — both copies are in the same file, so extract the 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 (16 lines × 2) Packages/OsaurusCore/Services/Tool/ToolIndexService.swift:392 — Packages/OsaurusCore/Services/Tool/ToolIndexService.swift:392-407 | Packages/OsaurusCore/Services/Tool/ToolSearchService.swift:718-733 — 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 `Packages/OsaurusCore/Services/Tool/ToolIndexService.swift:392` 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, `Packages/OsaurusCore/Services/Tool/ToolSearchService.swift:734` calls `registryParameterText` and `Packages/OsaurusCore/Services/Tool/ToolIndexService.swift:408` 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 (16 lines × 2) Packages/OsaurusCore/Storage/MemoryDatabase.swift:1590 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:1590-1605 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:1997-2012 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/Storage/MemoryDatabase.swift:2884 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:2884-2899 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2905-2920 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/Views/Agent/AgentsView.swift:166 — Packages/OsaurusCore/Views/Agent/AgentsView.swift:166-181 | Packages/OsaurusCore/Views/Workspaces/WorkspacesView.swift:91-106 — 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 `Packages/OsaurusCore/Views/Agent/AgentsView.swift:166` 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) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:710 — Packages/OsaurusCore/Views/Plugin/PluginsView.swift:710-725 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:2406-2421 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Plugin/PluginsView.swift:710` 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, `Packages/OsaurusCore/Views/Plugin/PluginsView.swift:2405` calls `GitHubTokenCard` and `Packages/OsaurusCore/Views/Plugin/PluginsView.swift:709` 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 (16 lines × 2) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:420 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:420-435 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:322-337 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 680 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 (16 lines × 2) Packages/OsaurusCore/Views/Voice/VoiceInputOverlay.swift:371 — Packages/OsaurusCore/Views/Voice/VoiceInputOverlay.swift:371-386 | Packages/OsaurusCore/Views/Voice/VoiceInputOverlay.swift:403-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 `Packages/OsaurusCore/Views/Voice/VoiceInputOverlay.swift:371` 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 (16 lines × 2) Packages/OsaurusCore/Views/Common/AnimatedProgressComponents.swift:243 — Packages/OsaurusCore/Views/Common/AnimatedProgressComponents.swift:243-258 | Packages/OsaurusCore/Views/Toast/ToastView.swift:194-209 — 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 (16 lines × 2) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalMatrix.swift:875 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalMatrix.swift:875-890 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReport.swift:831-846 — 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, `Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalMatrix.swift:870` calls `compactMap` and `Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReport.swift:830` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (16 lines × 2) Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:1750 — Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:1750-1765 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:1767-1782 — both copies are in the same file, so extract the 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) Packages/OsaurusCore/Services/Provider/OpenAICodexOAuthService.swift:729 — Packages/OsaurusCore/Services/Provider/OpenAICodexOAuthService.swift:729-744 | Packages/OsaurusCore/Services/Provider/XAIOAuthService.swift:455-470 — 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 (17 lines × 2) · ×21
  • Duplicated block (17 lines × 2) Packages/OsaurusCore/Managers/BlockMemoizer.swift:425 — Packages/OsaurusCore/Managers/BlockMemoizer.swift:425-441 | Packages/OsaurusCore/Views/Chat/MessageThreadView.swift:93-109 — 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 `Packages/OsaurusCore/Managers/BlockMemoizer.swift:425` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) Packages/OsaurusCore/Models/API/OpenAIAPI.swift:979 — Packages/OsaurusCore/Models/API/OpenAIAPI.swift:979-995 | Packages/OsaurusCore/Models/API/OpenAIAPI.swift:1016-1032 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Models/API/OpenAIAPI.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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (17 lines × 2) Packages/OsaurusCore/Models/Configuration/ModelPickerItem.swift:1100 — Packages/OsaurusCore/Models/Configuration/ModelPickerItem.swift:1100-1116 | Packages/OsaurusCore/Models/Configuration/ModelPickerItem.swift:1121-1137 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Models/Configuration/ModelPickerItem.swift:1100` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:974 — Packages/OsaurusCore/Networking/HTTPHandler.swift:974-990 | Packages/OsaurusCore/Networking/HTTPHandler.swift:1113-1129 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:974` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:13947 — Packages/OsaurusCore/Networking/HTTPHandler.swift:13947-13963 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14031-14047 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:13947` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:18164 — Packages/OsaurusCore/Networking/HTTPHandler.swift:18164-18180 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18919-18935 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:18164` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (17 lines × 2) Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:241 — Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:241-257 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppWatchTransportRuntime.swift:217-233 — before extracting anything, compare `Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift` and `Packages/OsaurusCore/Services/WhatsApp/WhatsAppWatchTransportRuntime.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 88 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 `Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:241` 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 (17 lines × 2) Packages/OsaurusCore/Services/Inference/FoundationModelService.swift:459 — Packages/OsaurusCore/Services/Inference/FoundationModelService.swift:459-475 | Packages/OsaurusCore/Services/Inference/FoundationModelService.swift:515-531 — both copies are in the same file, so extract the 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 (17 lines × 2) Packages/OsaurusCore/Services/MCP/OAuth/MCPOAuthDiscovery.swift:196 — Packages/OsaurusCore/Services/MCP/OAuth/MCPOAuthDiscovery.swift:196-212 | Packages/OsaurusCore/Services/MCP/OAuth/MCPOAuthDiscovery.swift:389-405 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/MCP/OAuth/MCPOAuthDiscovery.swift:196` 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 (17 lines × 2) Packages/OsaurusCore/Services/SystemPermissionService.swift:936 — Packages/OsaurusCore/Services/SystemPermissionService.swift:936-952 | Packages/OsaurusCore/Services/SystemPermissionService.swift:968-984 — both copies are in the same file, so extract the 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 (17 lines × 2) Packages/OsaurusCore/Services/ToolPermissionPromptService.swift:492 — Packages/OsaurusCore/Services/ToolPermissionPromptService.swift:492-508 | Packages/OsaurusCore/Services/ToolPermissionPromptService.swift:536-552 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/ToolPermissionPromptService.swift:492` 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 (17 lines × 2) Packages/OsaurusCore/Tools/KnowledgeTools.swift:291 — Packages/OsaurusCore/Tools/KnowledgeTools.swift:291-307 | Packages/OsaurusCore/Tools/SearchMemoryTool.swift:125-141 — 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.
  • Duplicated block (17 lines × 2) Packages/OsaurusCore/Views/Agent/Creation/AgentCreatorIntro.swift:184 — Packages/OsaurusCore/Views/Agent/Creation/AgentCreatorIntro.swift:184-200 | Packages/OsaurusCore/Views/Workflow/Architect/ArchitectChatEmptyState.swift:139-155 — 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 `Packages/OsaurusCore/Views/Agent/Creation/AgentCreatorIntro.swift:184` 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) Packages/OsaurusCore/Views/DesignSystem/SettingsKitGallery.swift:323 — Packages/OsaurusCore/Views/DesignSystem/SettingsKitGallery.swift:323-339 | Packages/OsaurusCore/Views/DesignSystem/SettingsKitGallery.swift:1216-1232 — both copies are in the same file, so extract the 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 (17 lines × 2) Packages/OsaurusCore/Views/Plugin/ClaudePluginCard.swift:144 — Packages/OsaurusCore/Views/Plugin/ClaudePluginCard.swift:144-160 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:1177-1193 — 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 `Packages/OsaurusCore/Views/Plugin/ClaudePluginCard.swift:144` 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 (17 lines × 2) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:107 — Packages/OsaurusCore/Views/Plugin/PluginsView.swift:107-123 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:2506-2522 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Plugin/PluginsView.swift:107` 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 (17 lines × 2) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:336 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:336-352 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:345-361 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 368 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 `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:336` 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 (17 lines × 2) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:814 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:814-830 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:1106-1122 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 260 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 `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:814` 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 (17 lines × 2) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:1604 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:1604-1620 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:1912-1928 — both copies are in the same file, so extract the 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 (17 lines × 2) Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:221 — Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:221-237 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppRPCClient.swift:212-228 — before extracting anything, compare `Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift` and `Packages/OsaurusCore/Services/WhatsApp/WhatsAppRPCClient.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 116 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (17 lines × 2) Packages/OsaurusCore/Views/DesignSystem/SettingsKitGallery.swift:249 — Packages/OsaurusCore/Views/DesignSystem/SettingsKitGallery.swift:249-265 | Packages/OsaurusCore/Views/DesignSystem/SettingsKitGallery.swift:1477-1493 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/DesignSystem/SettingsKitGallery.swift:249` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Edited copy of a member (21 corresponding lines) · ×20
  • Edited copy of a member (21 corresponding lines) Packages/OsaurusCore/Services/Workflow/WorkflowRunner.swift:421 — Packages/OsaurusCore/Services/Workflow/WorkflowRunner.swift:421-441 | Packages/OsaurusCore/Services/Workflow/WorkflowRunner.swift:454-486 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Packages/OsaurusCore/Models/Schedule/Schedule.swift:620 — Packages/OsaurusCore/Models/Schedule/Schedule.swift:620-641 | Packages/OsaurusCore/Models/Watcher/Watcher.swift:218-238 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Packages/OsaurusCore/Views/Chat/ClarifyPromptOverlay.swift:325 — Packages/OsaurusCore/Views/Chat/ClarifyPromptOverlay.swift:325-360 | Packages/OsaurusCore/Views/Model/ModelDetailView.swift:1630-1650 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2256 — Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2256-2280 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2282-2302 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Packages/OsaurusCore/Views/Agent/SpawnConfigurationEditor.swift:356 — Packages/OsaurusCore/Views/Agent/SpawnConfigurationEditor.swift:356-376 | Packages/OsaurusCore/Views/Workspaces/WorkspaceAgentPickerOption.swift:43-65 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Packages/OsaurusCore/Models/API/AnthropicAPI.swift:977 — Packages/OsaurusCore/Models/API/AnthropicAPI.swift:977-997 | Packages/OsaurusCore/Models/Configuration/ModelInfo.swift:604-624 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Packages/OsaurusCore/Services/Documents/PDFPPTXWorkflowService.swift:104 — Packages/OsaurusCore/Services/Documents/PDFPPTXWorkflowService.swift:104-124 | Packages/OsaurusCore/Services/Documents/PDFPPTXWorkflowService.swift:175-196 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5111 — Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5111-5132 | Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5138-5158 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Packages/OsaurusCore/Views/Settings/StorageSettingsView.swift:550 — Packages/OsaurusCore/Views/Settings/StorageSettingsView.swift:550-572 | Packages/OsaurusCore/Views/Settings/StorageSettingsView.swift:574-594 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift:49 — Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift:49-71 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:2279-2299 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Packages/OsaurusCore/Services/OnboardingModelsProxy.swift:79 — Packages/OsaurusCore/Services/OnboardingModelsProxy.swift:79-99 | Packages/OsaurusCore/Services/Router/OsaurusRouterAuthSigner.swift:69-95 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:234 — Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:234-254 | Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:185-207 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Packages/OsaurusCore/Models/AgentChannel/AgentChannelN8nModels.swift:263 — Packages/OsaurusCore/Models/AgentChannel/AgentChannelN8nModels.swift:263-286 | Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:1731-1751 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Packages/OsaurusCore/ComputerUse/Driver/Mac/Screenshot.swift:73 — Packages/OsaurusCore/ComputerUse/Driver/Mac/Screenshot.swift:73-93 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:1783-1803 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Packages/OsaurusCore/Services/Router/OsaurusRouterTypes.swift:766 — Packages/OsaurusCore/Services/Router/OsaurusRouterTypes.swift:766-786 | Packages/OsaurusCore/Services/Router/OsaurusRouterTypes.swift:837-857 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:469 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:469-489 | Packages/OsaurusCore/Services/ModelDownloadService.swift:2097-2118 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Packages/OsaurusCore/Models/Knowledge/KnowledgeModels.swift:157 — Packages/OsaurusCore/Models/Knowledge/KnowledgeModels.swift:157-177 | Packages/OsaurusCore/Models/Knowledge/KnowledgeModels.swift:203-225 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Packages/OsaurusCore/Models/Memory/MemoryModels.swift:348 — Packages/OsaurusCore/Models/Memory/MemoryModels.swift:348-370 | Packages/OsaurusCore/Services/FeatureTelemetry.swift:65-85 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Packages/OsaurusCore/Storage/MemoryDatabase.swift:1084 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:1084-1107 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:1112-1132 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Packages/OsaurusCore/Services/Voice/KeyboardSimulationService.swift:68 — Packages/OsaurusCore/Services/Voice/KeyboardSimulationService.swift:68-94 | Packages/OsaurusCore/Services/Voice/KeyboardSimulationService.swift:98-118 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×18
  • Duplicated block (18 lines × 2) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Config.swift:69 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Config.swift:69-86 | Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Config.swift:112-129 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Config.swift:69` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) Packages/OsaurusCore/Browser/Runtime/BrowserSession.swift:661 — Packages/OsaurusCore/Browser/Runtime/BrowserSession.swift:661-678 | Packages/OsaurusCore/Browser/Runtime/BrowserSession.swift:762-779 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Browser/Runtime/BrowserSession.swift:762` 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 (18 lines × 2) Packages/OsaurusCore/Managers/HotKeyManager.swift:52 — Packages/OsaurusCore/Managers/HotKeyManager.swift:52-69 | Packages/OsaurusCore/Managers/TranscriptionHotKeyManager.swift:70-87 — 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 `Packages/OsaurusCore/Managers/HotKeyManager.swift:52` 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 (18 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:4722 — Packages/OsaurusCore/Networking/HTTPHandler.swift:4722-4739 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17496-17513 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:4722` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:12348 — Packages/OsaurusCore/Networking/HTTPHandler.swift:12348-12365 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12394-12411 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:12348` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:14058 — Packages/OsaurusCore/Networking/HTTPHandler.swift:14058-14075 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14160-14177 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:14058` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:15882 — Packages/OsaurusCore/Networking/HTTPHandler.swift:15882-15899 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16179-16196 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:15882` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:18214 — Packages/OsaurusCore/Networking/HTTPHandler.swift:18214-18231 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18969-18986 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:18214` 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 (18 lines × 2) Packages/OsaurusCore/Services/MediaGeneration/MediaGenerationTypes.swift:291 — Packages/OsaurusCore/Services/MediaGeneration/MediaGenerationTypes.swift:291-308 | Packages/OsaurusCore/Services/MediaGeneration/VeniceMediaCatalog.swift:150-167 — 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 (18 lines × 2) Packages/OsaurusCore/Services/Method/MethodSearchService.swift:140 — Packages/OsaurusCore/Services/Method/MethodSearchService.swift:140-157 | Packages/OsaurusCore/Services/Tool/ToolSearchService.swift:357-374 — before extracting anything, compare `Packages/OsaurusCore/Services/Method/MethodSearchService.swift` and `Packages/OsaurusCore/Services/Tool/ToolSearchService.swift` as WHOLE FILES: this scan already matched 7 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 `Packages/OsaurusCore/Services/Method/MethodSearchService.swift:140` 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 (18 lines × 2) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1571 — Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1571-1588 | Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1917-1934 — both copies are in the same file, so extract the 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 (18 lines × 2) Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:834 — Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:834-851 | Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:859-876 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:834` 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) Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:343 — Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:343-360 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:458-475 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/Database/DatabaseTools.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 (18 lines × 2) Packages/OsaurusCore/Views/Plugin/GitHubImportSheet.swift:954 — Packages/OsaurusCore/Views/Plugin/GitHubImportSheet.swift:954-971 | Packages/OsaurusCore/Views/Plugin/GitHubImportSheet.swift:1038-1055 — both copies are in the same file, so extract the 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, `Packages/OsaurusCore/Views/Plugin/GitHubImportSheet.swift:1056` calls `padding` and `Packages/OsaurusCore/Views/Plugin/GitHubImportSheet.swift:974` 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 (18 lines × 2) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:850 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:850-867 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1082-1099 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 680 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 `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:850` 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 (18 lines × 2) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1219 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1219-1236 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1323-1340 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 680 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 `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1219` 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 (18 lines × 2) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1256 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1256-1273 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1360-1377 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 680 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 `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1256` 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 (18 lines × 2) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:1518 — Packages/OsaurusCore/Views/Plugin/PluginsView.swift:1518-1535 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:1666-1683 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Plugin/PluginsView.swift:1518` 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, `Packages/OsaurusCore/Views/Plugin/PluginsView.swift:1517` calls `hasPrefix` and `Packages/OsaurusCore/Views/Plugin/PluginsView.swift:1665` 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 · Edited copy of a member (24 corresponding lines) · ×17
  • Edited copy of a member (24 corresponding lines) Packages/OsaurusCore/Views/Chat/ChatView.swift:11013 — Packages/OsaurusCore/Views/Chat/ChatView.swift:11013-11044 | Packages/OsaurusCore/Views/Chat/RemoteAgentConnectionNotice.swift:10-33 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Packages/OsaurusCore/Services/Search/NativeSearchBackends.swift:213 — Packages/OsaurusCore/Services/Search/NativeSearchBackends.swift:213-236 | Packages/OsaurusCore/Services/Search/NativeSearchBackends.swift:300-324 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Packages/OsaurusCore/Views/Agent/Creation/AgentCreatorIntro.swift:33 — Packages/OsaurusCore/Views/Agent/Creation/AgentCreatorIntro.swift:33-56 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowLibraryKit.swift:302-326 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Packages/OsaurusCore/Services/Event/Feed/RSSEventSource.swift:147 — Packages/OsaurusCore/Services/Event/Feed/RSSEventSource.swift:147-170 | Packages/OsaurusCore/Services/Event/Stream/SSEEventSource.swift:219-244 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Packages/OsaurusCore/Services/Context/ResponsesEvaluationStep.swift:41 — Packages/OsaurusCore/Services/Context/ResponsesEvaluationStep.swift:41-75 | Packages/OsaurusCore/Services/Plugin/PluginResponsesCompatibility.swift:17-40 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:1305 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:1305-1328 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:1330-1355 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift:282 — Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift:282-305 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppHelperInstaller.swift:249-272 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Packages/OsaurusCore/Views/Settings/ServerModelsTabContent.swift:158 — Packages/OsaurusCore/Views/Settings/ServerModelsTabContent.swift:158-183 | Packages/OsaurusCore/Views/Workspaces/WorkspaceSheets.swift:402-425 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Packages/OsaurusCore/Services/Sync/SyncHostedRunMonitor.swift:162 — Packages/OsaurusCore/Services/Sync/SyncHostedRunMonitor.swift:162-185 | Packages/OsaurusCore/Services/Sync/SyncHostedRunMonitor.swift:229-256 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Packages/OsaurusCore/Services/Email/EmailChannelService.swift:40 — Packages/OsaurusCore/Services/Email/EmailChannelService.swift:40-63 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:58-82 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/AgentLoopRegressionLabCLI.swift:13 — Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/AgentLoopRegressionLabCLI.swift:13-36 | Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalReviewReportCLI.swift:13-43 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:121 — Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:121-144 | Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:961-984 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Packages/OsaurusCore/ComputerUse/Driver/Mac/BackgroundDriver.swift:423 — Packages/OsaurusCore/ComputerUse/Driver/Mac/BackgroundDriver.swift:423-446 | Packages/OsaurusCore/ComputerUse/Driver/Mac/InputController.swift:141-175 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:3524 — Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:3524-3547 | Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:4487-4514 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Packages/OsaurusCore/Models/Schedule/ScheduleRunHistory.swift:194 — Packages/OsaurusCore/Models/Schedule/ScheduleRunHistory.swift:194-217 | Packages/OsaurusCore/Models/Schedule/ScheduleRunHistory.swift:219-246 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Packages/OsaurusCore/Models/Chat/ContentBlock.swift:432 — Packages/OsaurusCore/Models/Chat/ContentBlock.swift:432-455 | Packages/OsaurusCore/Models/Chat/ContentBlock.swift:498-523 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Packages/OsaurusCore/Views/Agent/AgentsView.swift:4122 — Packages/OsaurusCore/Views/Agent/AgentsView.swift:4122-4148 | Packages/OsaurusCore/Views/Agent/AgentsView.swift:4150-4173 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×17
  • Duplicated block (11 lines × 3) Packages/OsaurusCore/AppleApps/Calendar/CalendarTools.swift:183 — Packages/OsaurusCore/AppleApps/Calendar/CalendarTools.swift:183-193 | Packages/OsaurusCore/AppleApps/Calendar/CalendarTools.swift:266-276 | Packages/OsaurusCore/AppleApps/Calendar/CalendarTools.swift:355-365 — 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 `Packages/OsaurusCore/AppleApps/Calendar/CalendarTools.swift:183` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/AppleApps/Calendar/CalendarTools.swift:279` calls `date` and `Packages/OsaurusCore/AppleApps/Calendar/CalendarTools.swift:194` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:5726 — Packages/OsaurusCore/Networking/HTTPHandler.swift:5726-5736 | Packages/OsaurusCore/Networking/HTTPHandler.swift:5917-5927 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6559-6569 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:5726` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:6282 — Packages/OsaurusCore/Networking/HTTPHandler.swift:6282-6292 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6359-6369 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8351-8361 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:6282` 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 × 3) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:554 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:554-564 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:869-879 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:653-663 — 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 (11 lines × 3) Packages/OsaurusCore/Storage/MemoryDatabase.swift:2307 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:2307-2317 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2403-2413 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2431-2441 — 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 `Packages/OsaurusCore/Storage/MemoryDatabase.swift:2307` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `limit` to `Int = 200` in one and `Int = 500` 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 (11 lines × 3) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3219 — Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3219-3229 | Packages/OsaurusCore/Tools/SandboxSecretTools.swift:45-55 | Packages/OsaurusCore/Tools/SandboxSecretTools.swift:156-166 — 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.
  • Duplicated block (11 lines × 3) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:284 — Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:284-294 | Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:674-684 | Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:1394-1404 — 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 `Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:284` 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 × 3) Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:314 — Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:314-324 | Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:392-402 | Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:469-479 — 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 `Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:314` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:466` calls `StatusChip`, `L` and `Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:312` 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 (11 lines × 3) Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:334 — Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:334-344 | Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:387-397 | Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:546-556 — 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 `Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:334` 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 `spacing` to `theme.space.s8` in one and `theme.space.s2` 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 (11 lines × 3) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:324 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:324-334 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:374-384 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:404-414 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 260 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 `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:324` 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, `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:320` calls `fixedSize` and `Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:400` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 3) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:560 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:560-570 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:370-380 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:780-790 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 237 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 `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:560` 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 × 3) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerComputerUseLoop.swift:114 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerComputerUseLoop.swift:114-124 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:569-579 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:695-705 — 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 `Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerComputerUseLoop.swift:114` 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 (11 lines × 3) Packages/OsaurusCore/ComputerUse/Driver/MockMacDriver.swift:135 — Packages/OsaurusCore/ComputerUse/Driver/MockMacDriver.swift:135-145 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/FixtureCUDriver.swift:87-97 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ScriptedCUDriver.swift:214-224 — 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 (11 lines × 3) Packages/OsaurusCore/Models/Discord/DiscordConnectionConfiguration.swift:137 — Packages/OsaurusCore/Models/Discord/DiscordConnectionConfiguration.swift:137-147 | Packages/OsaurusCore/Models/Slack/SlackConnectionConfiguration.swift:253-263 | Packages/OsaurusCore/Models/Telegram/TelegramConnectionConfiguration.swift:219-229 — before extracting anything, compare `Packages/OsaurusCore/Models/Discord/DiscordConnectionConfiguration.swift` and `Packages/OsaurusCore/Models/Slack/SlackConnectionConfiguration.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `Packages/OsaurusCore/Models/Discord/DiscordConnectionConfiguration.swift:137` 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 `connectionId` to `String = AgentChannelConnection.nativeDiscordConnectionId` in one and `String = AgentChannelConnection.nativeSlackConnectionId` 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 (11 lines × 3) Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:1034 — Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:1034-1044 | Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:1697-1707 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:1376-1386 — 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 (11 lines × 3) Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1209 — Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1209-1221 | Packages/OsaurusCore/Storage/RouterBillingDatabase.swift:524-534 | Packages/OsaurusCore/Storage/ToolDatabase.swift:435-447 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (11 lines × 3) scripts/live-proof/run-local-family-multiturn-tool-cache-proof.py:287 — scripts/live-proof/run-local-family-multiturn-tool-cache-proof.py:287-297 | scripts/live-proof/run-local-family-multiturn-tool-cache-proof.py:304-326 | scripts/live-proof/run-local-family-multiturn-tool-cache-proof.py:329-343 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Edited copy of a member (25 corresponding lines) · ×16
  • Edited copy of a member (25 corresponding lines) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:1149 — Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:1149-1173 | Packages/OsaurusCore/Models/Template/Template+Agent.swift:116-140 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) Packages/OsaurusCore/Services/FileHistory/FileObjectStore.swift:64 — Packages/OsaurusCore/Services/FileHistory/FileObjectStore.swift:64-95 | Packages/OsaurusCore/Services/FileHistory/FileObjectStore.swift:107-131 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) Packages/OsaurusCore/Views/Chat/ComputerUseConfirmOverlay.swift:208 — Packages/OsaurusCore/Views/Chat/ComputerUseConfirmOverlay.swift:208-232 | Packages/OsaurusCore/Views/Chat/ConfigApprovalModal.swift:211-238 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) Packages/OsaurusCore/Models/Event/ScheduleTiming.swift:109 — Packages/OsaurusCore/Models/Event/ScheduleTiming.swift:109-133 | Packages/OsaurusCore/Models/Schedule/ScheduleRunHistory.swift:309-337 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:247 — Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:247-276 | Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:915-939 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:190 — Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:190-216 | Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:353-377 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) Packages/OsaurusCore/Views/Agent/AgentsView.swift:2585 — Packages/OsaurusCore/Views/Agent/AgentsView.swift:2585-2616 | Packages/OsaurusCore/Views/Agent/BuiltInAgentAvatarPicker.swift:123-147 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:805 — Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:805-829 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:902-935 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) Packages/OsaurusCore/PrivacyFilter/Views/PrivacyCustomRuleEditor.swift:345 — Packages/OsaurusCore/PrivacyFilter/Views/PrivacyCustomRuleEditor.swift:345-375 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:1686-1710 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) Packages/OsaurusCore/Tools/ToolEnvelope.swift:80 — Packages/OsaurusCore/Tools/ToolEnvelope.swift:80-104 | Packages/OsaurusCore/Tools/ToolEnvelope.swift:184-208 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) Packages/OsaurusCore/Models/Configuration/SearchProviderConfiguration.swift:260 — Packages/OsaurusCore/Models/Configuration/SearchProviderConfiguration.swift:260-288 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:1957-1981 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) Packages/OsaurusCore/Views/Voice/VoiceInputOverlay.swift:371 — Packages/OsaurusCore/Views/Voice/VoiceInputOverlay.swift:371-397 | Packages/OsaurusCore/Views/Voice/VoiceInputOverlay.swift:403-427 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) Packages/OsaurusCore/Services/Channels/ChannelReplayNonceStore.swift:66 — Packages/OsaurusCore/Services/Channels/ChannelReplayNonceStore.swift:66-99 | Packages/OsaurusCore/Services/Channels/ChannelReplayNonceStore.swift:101-125 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) Packages/OsaurusCore/Subagent/SubagentCapabilityRegistry.swift:151 — Packages/OsaurusCore/Subagent/SubagentCapabilityRegistry.swift:151-177 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:3346-3370 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) Packages/OsaurusCore/Utils/StorageLocationStandards.swift:103 — Packages/OsaurusCore/Utils/StorageLocationStandards.swift:103-127 | Packages/OsaurusCore/Utils/StorageLocationStandards.swift:157-183 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) Packages/OsaurusCore/PrivacyFilter/Core/PrivacyRulePresets.swift:143 — Packages/OsaurusCore/PrivacyFilter/Core/PrivacyRulePresets.swift:143-169 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReviewReport.swift:100-124 — 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 (18 corresponding lines) · ×16
  • Edited copy of a member (18 corresponding lines) Packages/OsaurusCore/Services/HuggingFaceService.swift:399 — Packages/OsaurusCore/Services/HuggingFaceService.swift:399-418 | Packages/OsaurusCore/Services/HuggingFaceService.swift:423-440 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Packages/OsaurusCore/Views/Chat/AtFileMenuPopup.swift:110 — Packages/OsaurusCore/Views/Chat/AtFileMenuPopup.swift:110-131 | Packages/OsaurusCore/Views/Chat/SlashCommandPopup.swift:92-109 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Packages/OsaurusCore/Views/Chat/SelectableTextView.swift:1014 — Packages/OsaurusCore/Views/Chat/SelectableTextView.swift:1014-1048 | Packages/OsaurusCore/Views/Common/CodeBlockView.swift:500-517 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Packages/OsaurusCore/Services/Workflow/WorkflowRunService.swift:171 — Packages/OsaurusCore/Services/Workflow/WorkflowRunService.swift:171-188 | Packages/OsaurusCore/Services/Workflow/WorkflowRunService.swift:194-212 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Packages/OsaurusCore/Managers/Model/ModelManager.swift:614 — Packages/OsaurusCore/Managers/Model/ModelManager.swift:614-631 | Packages/OsaurusCore/Managers/Model/ModelManager.swift:633-655 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Packages/OsaurusCore/Views/Chat/AgentInlineBlocks.swift:333 — Packages/OsaurusCore/Views/Chat/AgentInlineBlocks.swift:333-355 | Packages/OsaurusCore/Views/Common/SharedHeaderComponents.swift:98-115 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Packages/OsaurusCore/Storage/PersistenceHealth.swift:131 — Packages/OsaurusCore/Storage/PersistenceHealth.swift:131-148 | Packages/OsaurusCore/Storage/PersistenceHealth.swift:152-172 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Packages/OsaurusCore/Services/MCP/MCPAuthFailureProbe.swift:80 — Packages/OsaurusCore/Services/MCP/MCPAuthFailureProbe.swift:80-97 | Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:2686-2703 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Packages/OsaurusCore/Services/MediaGeneration/MediaGenerationCoordinator.swift:116 — Packages/OsaurusCore/Services/MediaGeneration/MediaGenerationCoordinator.swift:116-134 | Packages/OsaurusCore/Services/MediaGeneration/MediaGenerationCoordinator.swift:136-153 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Packages/OsaurusCore/Views/Sandbox/ProvisioningJourneyView.swift:286 — Packages/OsaurusCore/Views/Sandbox/ProvisioningJourneyView.swift:286-307 | Packages/OsaurusCore/Views/Settings/ConfigurationView.swift:576-593 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:227 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:227-244 | Packages/OsaurusCore/Services/HuggingFaceService.swift:943-962 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Packages/OsaurusCore/Views/Approvals/ApprovalsView.swift:173 — Packages/OsaurusCore/Views/Approvals/ApprovalsView.swift:173-192 | Packages/OsaurusCore/Views/Approvals/ApprovalsView.swift:198-215 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Packages/OsaurusCore/Storage/EventRunDatabase.swift:356 — Packages/OsaurusCore/Storage/EventRunDatabase.swift:356-373 | Packages/OsaurusCore/Storage/EventRunDatabase.swift:433-450 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:210 — Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:210-227 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppWatchTransportRuntime.swift:189-206 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:433 — Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:433-450 | Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:580-600 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1177 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1177-1194 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1281-1299 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×16
  • Duplicated block (9 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:15661 — Packages/OsaurusCore/Networking/HTTPHandler.swift:15661-15669 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18095-18104 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18876-18885 — 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) Packages/OsaurusCore/PrivacyFilter/Model/PrivacyFilterModelDownloader.swift:418 — Packages/OsaurusCore/PrivacyFilter/Model/PrivacyFilterModelDownloader.swift:418-426 | Packages/OsaurusCore/Services/ChunkedFileDownloader.swift:681-689 | Packages/OsaurusCore/Services/ModelDownloadService.swift:2073-2081 — 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 `Packages/OsaurusCore/PrivacyFilter/Model/PrivacyFilterModelDownloader.swift:418` 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) Packages/OsaurusCore/PrivacyFilter/Views/PrivacyView.swift:651 — Packages/OsaurusCore/PrivacyFilter/Views/PrivacyView.swift:651-659 | Packages/OsaurusCore/Views/Settings/ProvidersView.swift:2063-2071 | Packages/OsaurusCore/Views/Settings/ProvidersView.swift:2095-2103 — 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 `Packages/OsaurusCore/PrivacyFilter/Views/PrivacyView.swift:651` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) Packages/OsaurusCore/Services/Auth/ConsentPanelPresenter.swift:66 — Packages/OsaurusCore/Services/Auth/ConsentPanelPresenter.swift:66-74 | Packages/OsaurusCore/Services/Provider/ProviderCredentialPromptService.swift:304-313 | Packages/OsaurusCore/Services/ToolPermissionPromptService.swift:862-871 — 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 `Packages/OsaurusCore/Services/Provider/ProviderCredentialPromptService.swift:304` 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 (9 lines × 3) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:403 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:403-411 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:746-754 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:506-514 — 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 `Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:403` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:1221 — Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:1221-1229 | Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:1255-1263 | Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:1278-1286 — 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 `Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:1221` 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) Packages/OsaurusCore/Views/Event/EventsView.swift:67 — Packages/OsaurusCore/Views/Event/EventsView.swift:67-75 | Packages/OsaurusCore/Views/Knowledge/KnowledgeView.swift:190-198 | Packages/OsaurusCore/Views/Skill/SkillsView.swift:159-167 — 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 `Packages/OsaurusCore/Views/Event/EventsView.swift:67` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:628 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:628-636 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:836-844 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:506-514 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 260 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 `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:628` 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 (9 lines × 3) Packages/OsaurusCore/Views/Settings/ProvidersView.swift:2067 — Packages/OsaurusCore/Views/Settings/ProvidersView.swift:2067-2075 | Packages/OsaurusCore/Views/Settings/ProvidersView.swift:2082-2090 | Packages/OsaurusCore/Views/Settings/ProvidersView.swift:2099-2107 — 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 `Packages/OsaurusCore/Views/Settings/ProvidersView.swift:2067` 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) Packages/OsaurusCore/Views/Workflow/Library/WorkflowLibraryKit.swift:115 — Packages/OsaurusCore/Views/Workflow/Library/WorkflowLibraryKit.swift:115-123 | Packages/OsaurusCore/Views/Workflow/WorkflowRunTabView.swift:25-33 | Packages/OsaurusCore/Views/Workflow/WorkflowRunTabView.swift:37-45 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (9 lines × 3) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:330 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:330-338 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalDiff.swift:263-271 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReviewReport.swift:626-634 — 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 `Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:330` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. 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 × 3) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:2006 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:2006-2014 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerAppleScript.swift:269-277 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerScreenContext.swift:189-197 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (9 lines × 3) Packages/OsaurusCore/Storage/FileHistoryDatabase.swift:96 — Packages/OsaurusCore/Storage/FileHistoryDatabase.swift:96-104 | Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:132-140 | Packages/OsaurusCore/Storage/RouterBillingDatabase.swift:214-222 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (9 lines × 3) Packages/OsaurusCore/Subagent/Kinds/BrowserUseKind.swift:120 — Packages/OsaurusCore/Subagent/Kinds/BrowserUseKind.swift:120-128 | Packages/OsaurusCore/Subagent/Kinds/ComputerUseKind.swift:191-199 | Packages/OsaurusCore/Tools/Handoff/HiddenAgentHandoffRunner.swift:244-252 — 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 (9 lines × 3) Packages/OsaurusCore/Models/IMessage/IMessageConnectionConfiguration.swift:119 — Packages/OsaurusCore/Models/IMessage/IMessageConnectionConfiguration.swift:119-127 | Packages/OsaurusCore/Models/Telegram/TelegramConnectionConfiguration.swift:63-71 | Packages/OsaurusCore/Models/WhatsApp/WhatsAppConnectionConfiguration.swift:102-110 — before extracting anything, compare `Packages/OsaurusCore/Models/IMessage/IMessageConnectionConfiguration.swift` and `Packages/OsaurusCore/Models/WhatsApp/WhatsAppConnectionConfiguration.swift` as WHOLE FILES: this scan already matched 6 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 `Packages/OsaurusCore/Models/IMessage/IMessageConnectionConfiguration.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Models/Telegram/TelegramConnectionConfiguration.swift:72` calls `decodeIfPresent` and `Packages/OsaurusCore/Models/IMessage/IMessageConnectionConfiguration.swift:128` 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 × 3) scripts/live-proof/run-local-family-chat-tool-proof.py:40 — scripts/live-proof/run-local-family-chat-tool-proof.py:40-48 | scripts/live-proof/run-local-family-multiturn-tool-cache-proof.py:38-46 | scripts/live-proof/run-local-vl-media-cache-proof.py:41-49 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
D4 · Code Duplication · Edited copies of one member (3 members, 8+ corresponding lines) · ×15
  • Edited copies of one member (3 members, 8+ corresponding lines) Packages/OsaurusCore/Models/Event/OsaurusEvent.swift:192 — Packages/OsaurusCore/Models/Event/OsaurusEvent.swift:192-199 | Packages/OsaurusCore/Services/Harness/HarnessGrantStore.swift:185-195 | Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:1427-1434 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) Packages/OsaurusCore/Managers/Chat/ChatSessionImporter.swift:370 — Packages/OsaurusCore/Managers/Chat/ChatSessionImporter.swift:370-377 | Packages/OsaurusCore/Managers/Chat/ChatSessionImporter.swift:516-526 | Packages/OsaurusCore/Managers/Chat/ChatSessionImporter.swift:641-648 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) Packages/OsaurusCore/Services/Workflow/WorkflowRunService.swift:81 — Packages/OsaurusCore/Services/Workflow/WorkflowRunService.swift:81-89 | Packages/OsaurusCore/Services/Workflow/WorkflowRunService.swift:94-101 | Packages/OsaurusCore/Services/Workflow/WorkflowRunService.swift:304-311 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.swift:39 — Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.swift:39-50 | Packages/OsaurusCore/Tools/AgentLoopTools.swift:311-318 | Packages/OsaurusCore/Tools/AgentLoopTools.swift:619-626 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) Packages/OsaurusCore/Services/Router/OsaurusRouterAPIClient.swift:59 — Packages/OsaurusCore/Services/Router/OsaurusRouterAPIClient.swift:59-66 | Packages/OsaurusCore/Services/Router/OsaurusRouterAPIClient.swift:332-340 | Packages/OsaurusCore/Services/Router/OsaurusRouterAPIClient.swift:471-479 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) Packages/OsaurusCore/Services/Inference/MLXService.swift:676 — Packages/OsaurusCore/Services/Inference/MLXService.swift:676-684 | Packages/OsaurusCore/Services/Inference/MLXService.swift:686-693 | Packages/OsaurusCore/Services/ModelCompatibilityDiagnostics.swift:617-627 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) Packages/OsaurusCore/Services/Keychain/AgentSecretsKeychain.swift:83 — Packages/OsaurusCore/Services/Keychain/AgentSecretsKeychain.swift:83-93 | Packages/OsaurusCore/Services/Keychain/EventSecretsKeychain.swift:44-51 | Packages/OsaurusCore/Services/Keychain/SourceCredentialVault.swift:38-45 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:691 — Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:691-698 | Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:700-707 | Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:709-716 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) Packages/OsaurusCore/Views/Memory/MemoryDiagnosticsViews.swift:126 — Packages/OsaurusCore/Views/Memory/MemoryDiagnosticsViews.swift:126-137 | Packages/OsaurusCore/Views/Plugin/SandboxPluginEditorView.swift:669-676 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowStarterPreviewSheet.swift:178-185 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) Packages/OsaurusCore/Managers/Model/ModelManager.swift:825 — Packages/OsaurusCore/Managers/Model/ModelManager.swift:825-832 | Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalReviewReportCLI.swift:720-727 | Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalScoreboardCLI.swift:148-155 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) Packages/OsaurusCore/Views/Agent/Setup/AgentSetupWizardView.swift:797 — Packages/OsaurusCore/Views/Agent/Setup/AgentSetupWizardView.swift:797-804 | Packages/OsaurusCore/Views/Template/TemplateImportReviewView.swift:363-372 | Packages/OsaurusCore/Views/Workflow/WorkflowAccessViews.swift:169-178 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) Packages/OsaurusCore/Services/Attention/AttentionItem.swift:105 — Packages/OsaurusCore/Services/Attention/AttentionItem.swift:105-113 | Packages/OsaurusCore/Services/Attention/NotificationPreferences.swift:18-25 | Packages/OsaurusCore/Views/Settings/NotificationRoutingSettingsView.swift:83-90 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) Packages/OsaurusCore/Views/Voice/VoiceComponents.swift:603 — Packages/OsaurusCore/Views/Voice/VoiceComponents.swift:603-618 | Packages/OsaurusCore/Views/Voice/VoiceInputOverlay.swift:354-361 | Packages/OsaurusCore/Views/Voice/VoiceSharedComponents.swift:100-112 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) Packages/OsaurusCore/Services/ChatImport/ChatImportModels.swift:355 — Packages/OsaurusCore/Services/ChatImport/ChatImportModels.swift:355-362 | Packages/OsaurusCore/Services/Context/PromptSurfaceEvaluator.swift:104-111 | Packages/OsaurusCore/Services/Context/SessionToolState.swift:163-173 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:2027 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:2027-2034 | Packages/OsaurusCore/Services/Chat/CompactionWatermark.swift:60-68 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:4122-4129 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×15
  • Duplicated block (8–9 lines × 2) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Run.swift:39 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Run.swift:39-46 | Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Show.swift:116-124 — 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 `Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Run.swift:39` 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–9 lines × 2) Packages/OsaurusCore/AppDelegate.swift:2142 — Packages/OsaurusCore/AppDelegate.swift:2142-2149 | Packages/OsaurusCore/AppDelegate.swift:2187-2195 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/AppDelegate.swift:2142` 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–9 lines × 2) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1056 — Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1056-1063 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1088-1096 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1056` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8–9 lines × 2) Packages/OsaurusCore/Models/Configuration/ModelInfo.swift:520 — Packages/OsaurusCore/Models/Configuration/ModelInfo.swift:520-528 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17131-17138 — 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–9 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:867 — Packages/OsaurusCore/Networking/HTTPHandler.swift:867-875 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12844-12851 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:867` 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–9 lines × 2) Packages/OsaurusCore/Services/AgentDelegation/AgentDelegationDispatcher.swift:858 — Packages/OsaurusCore/Services/AgentDelegation/AgentDelegationDispatcher.swift:858-866 | Packages/OsaurusCore/Services/Workflow/AgentNodeExecutor.swift:438-445 — 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 `Packages/OsaurusCore/Services/AgentDelegation/AgentDelegationDispatcher.swift:858` 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–9 lines × 2) Packages/OsaurusCore/Services/Chat/CompactionDeadline.swift:105 — Packages/OsaurusCore/Services/Chat/CompactionDeadline.swift:105-112 | Packages/OsaurusCore/Services/Chat/CompactionDeadline.swift:160-168 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Chat/CompactionDeadline.swift:160` 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.
  • Duplicated block (8–9 lines × 2) Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:1333 — Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:1333-1341 | Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:1360-1367 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:1333` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:1367` calls `localName`, `attribute` and `Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:1341` 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 × 2) Packages/OsaurusCore/Services/ModelRuntime.swift:3577 — Packages/OsaurusCore/Services/ModelRuntime.swift:3577-3584 | Packages/OsaurusCore/Services/ModelRuntime.swift:8094-8102 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/ModelRuntime.swift:3577` 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–9 lines × 2) Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:393 — Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:393-400 | Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:468-476 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:393` 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. 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–9 lines × 2) Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1398 — Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1398-1405 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:1055-1063 — 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 `Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1398` 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–9 lines × 2) Packages/OsaurusCore/Views/Chat/ComputerUseConfirmOverlay.swift:223 — Packages/OsaurusCore/Views/Chat/ComputerUseConfirmOverlay.swift:223-230 | Packages/OsaurusCore/Views/Chat/ConfigApprovalModal.swift:230-238 — 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 `Packages/OsaurusCore/Views/Chat/ComputerUseConfirmOverlay.swift:223` 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.
  • Duplicated block (8–9 lines × 2) Packages/OsaurusCore/Views/Credits/CreditsView.swift:901 — Packages/OsaurusCore/Views/Credits/CreditsView.swift:901-908 | Packages/OsaurusCore/Views/Router/RouterAccountUsageCenterView.swift:623-631 — 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 `Packages/OsaurusCore/Views/Credits/CreditsView.swift:901` 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 (8–9 lines × 2) Packages/OsaurusCore/Views/Onboarding/DesignSystem/OnboardingComponents.swift:561 — Packages/OsaurusCore/Views/Onboarding/DesignSystem/OnboardingComponents.swift:561-568 | Packages/OsaurusCore/Views/Onboarding/OnboardingConfigureAIView.swift:1367-1375 — 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 `Packages/OsaurusCore/Views/Onboarding/DesignSystem/OnboardingComponents.swift:561` 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.
  • Duplicated block (8–9 lines × 2) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:57 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:57-64 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:75-83 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Edited copies of one member (3 members, 15+ corresponding lines) · ×14
  • Edited copies of one member (3 members, 15+ corresponding lines) Packages/OsaurusCore/PrivacyFilter/Views/RedactionReviewSheet.swift:249 — Packages/OsaurusCore/PrivacyFilter/Views/RedactionReviewSheet.swift:249-265 | Packages/OsaurusCore/PrivacyFilter/Views/RedactionReviewSheet.swift:389-403 | Packages/OsaurusCore/Views/Model/HuggingFaceImportSheet.swift:78-95 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 15+ corresponding lines) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:729 — Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:729-743 | Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:762-777 | Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:779-793 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 15+ corresponding lines) Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:1778 — Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:1778-1795 | Packages/OsaurusCore/Services/Email/SMTPClient.swift:279-293 | Packages/OsaurusCore/Services/Event/Email/IMAPClient.swift:580-594 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 15+ corresponding lines) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:137 — Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:137-153 | Packages/OsaurusCore/Services/Router/AnnouncementsService.swift:163-177 | Packages/OsaurusCore/Services/Router/WelcomeCreditService.swift:237-251 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 15+ corresponding lines) Packages/OsaurusCore/Views/Agent/SpawnConfigurationEditor.swift:769 — Packages/OsaurusCore/Views/Agent/SpawnConfigurationEditor.swift:769-787 | Packages/OsaurusCore/Views/Model/HuggingFaceImportSheet.swift:112-126 | Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:1890-1905 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 15+ corresponding lines) Packages/OsaurusCore/Views/Tool/ToolCatalogRows.swift:361 — Packages/OsaurusCore/Views/Tool/ToolCatalogRows.swift:361-375 | Packages/OsaurusCore/Views/Tool/ToolCatalogRows.swift:422-436 | Packages/OsaurusCore/Views/Tool/ToolCatalogRows.swift:492-506 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 15+ corresponding lines) Packages/OsaurusPlugins/StatsPack/Sources/OsaurusStatsPack/DelimitedText.swift:19 — Packages/OsaurusPlugins/StatsPack/Sources/OsaurusStatsPack/DelimitedText.swift:19-35 | Packages/OsaurusPlugins/StatsPack/Sources/OsaurusStatsPack/DelimitedText.swift:65-81 | Packages/OsaurusPlugins/StatsPack/Sources/OsaurusStatsPack/JSONLAdapter.swift:19-33 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 15+ corresponding lines) Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:401 — Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:401-419 | Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:765-779 | Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:908-924 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 15+ corresponding lines) Packages/OsaurusCore/Models/Configuration/ClaudeCodeConfiguration.swift:495 — Packages/OsaurusCore/Models/Configuration/ClaudeCodeConfiguration.swift:495-511 | Packages/OsaurusCore/Models/Configuration/ClaudeCodeConfiguration.swift:515-532 | Packages/OsaurusCore/Models/Configuration/ClaudeCodeConfiguration.swift:564-578 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 15+ corresponding lines) Packages/OsaurusCore/Services/Discord/DiscordPollingTransportRuntime.swift:29 — Packages/OsaurusCore/Services/Discord/DiscordPollingTransportRuntime.swift:29-43 | Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:49-66 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppWatchTransportRuntime.swift:44-59 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 15+ corresponding lines) Packages/OsaurusCore/AppleScript/Exec/MockAppleScriptWorld.swift:45 — Packages/OsaurusCore/AppleScript/Exec/MockAppleScriptWorld.swift:45-59 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:2396-2410 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:3911-3925 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 15+ corresponding lines) Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1496 — Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1496-1518 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1553-1567 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1634-1652 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 15+ corresponding lines) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:249 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:249-267 | Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:799-818 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:252-266 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 15+ corresponding lines) Packages/OsaurusCore/Managers/AgentManager.swift:435 — Packages/OsaurusCore/Managers/AgentManager.swift:435-454 | Packages/OsaurusCore/Managers/AgentManager.swift:485-499 | Packages/OsaurusCore/Managers/SlashCommandRegistry.swift:57-76 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×14
  • Duplicated block (7 lines × 3) Packages/OsaurusCore/Folder/FolderTools.swift:6273 — Packages/OsaurusCore/Folder/FolderTools.swift:6273-6279 | Packages/OsaurusCore/Folder/FolderTools.swift:6375-6381 | Packages/OsaurusCore/Folder/FolderTools.swift:6446-6452 — 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 `Packages/OsaurusCore/Folder/FolderTools.swift:6273` 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) Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1265 — Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1265-1271 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1321-1327 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1840-1846 — 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 `Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1265` 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, `Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1319` calls `writeString` and `Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1264` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:6092 — Packages/OsaurusCore/Networking/HTTPHandler.swift:6092-6098 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7199-7205 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7648-7654 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:6092` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:7064 — Packages/OsaurusCore/Networking/HTTPHandler.swift:7064-7070 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7188-7194 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8068-8074 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:7064` 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 × 3) Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:853 — Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:853-859 | Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:885-891 | Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:906-912 — 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 `Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:853` 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 × 3) Packages/OsaurusCore/Services/Event/Feed/RSSEventSource.swift:193 — Packages/OsaurusCore/Services/Event/Feed/RSSEventSource.swift:193-199 | Packages/OsaurusCore/Services/Event/RunFailedEventSource.swift:56-62 | Packages/OsaurusCore/Services/Event/Stream/SSEEventSource.swift:256-262 — 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 `Packages/OsaurusCore/Services/Event/Feed/RSSEventSource.swift:193` 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) Packages/OsaurusCore/Services/Keychain/EventSecretsKeychain.swift:36 — Packages/OsaurusCore/Services/Keychain/EventSecretsKeychain.swift:36-42 | Packages/OsaurusCore/Services/Keychain/SourceCredentialVault.swift:30-36 | Packages/OsaurusCore/Services/Keychain/WorkflowSecretsKeychain.swift:108-114 — 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 `Packages/OsaurusCore/Services/Keychain/EventSecretsKeychain.swift:36` 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 × 3) Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1884 — Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1884-1890 | Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1900-1906 | Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1921-1927 — 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 register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (7 lines × 3) Packages/OsaurusCore/Views/Skill/SkillEditorSheet.swift:188 — Packages/OsaurusCore/Views/Skill/SkillEditorSheet.swift:188-194 | Packages/OsaurusCore/Views/Skill/SkillEditorSheet.swift:238-244 | Packages/OsaurusCore/Views/Skill/SkillEditorSheet.swift:255-261 — 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 `Packages/OsaurusCore/Views/Skill/SkillEditorSheet.swift:188` 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, `Packages/OsaurusCore/Views/Skill/SkillEditorSheet.swift:234` calls `frame` and `Packages/OsaurusCore/Views/Skill/SkillEditorSheet.swift:184` 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) Packages/OsaurusCore/Services/Router/OsaurusRouterTypes.swift:94 — Packages/OsaurusCore/Services/Router/OsaurusRouterTypes.swift:94-100 | Packages/OsaurusCore/Services/Router/OsaurusRouterTypes.swift:136-142 | Packages/OsaurusCore/Services/Router/OsaurusRouterTypes.swift:154-160 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 3) Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:230 — Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:230-236 | Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:519-525 | Packages/OsaurusCore/Services/Telegram/TelegramAPIClient.swift:390-396 — 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 (7 lines × 3) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1322 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1322-1328 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:1283-1289 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:1488-1494 — 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 (7 lines × 3) Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:2261 — Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:2261-2267 | Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:460-466 | Packages/OsaurusCore/Storage/RouterBillingDatabase.swift:593-599 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:2258` calls `unsafeBitCast` and `Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:458` 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) Packages/OsaurusCore/Storage/MethodDatabase.swift:257 — Packages/OsaurusCore/Storage/MethodDatabase.swift:257-263 | Packages/OsaurusCore/Storage/RouterBillingDatabase.swift:372-378 | Packages/OsaurusCore/Storage/ToolDatabase.swift:340-346 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
D4 · Code Duplication · Edited copy of a member (28 corresponding lines) · ×13
  • Edited copy of a member (28 corresponding lines) Packages/OsaurusCore/Views/Credits/CreditsView.swift:611 — Packages/OsaurusCore/Views/Credits/CreditsView.swift:611-638 | Packages/OsaurusCore/Views/Credits/CreditsView.swift:643-680 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:568 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:568-595 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:667-695 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) Packages/OsaurusCore/Views/Common/SimpleComponents.swift:19 — Packages/OsaurusCore/Views/Common/SimpleComponents.swift:19-62 | Packages/OsaurusCore/Views/Shared/ShareLinkComponents.swift:61-88 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) Packages/OsaurusCore/Views/Agent/Creation/AgentCreatorIntro.swift:172 — Packages/OsaurusCore/Views/Agent/Creation/AgentCreatorIntro.swift:172-200 | Packages/OsaurusCore/Views/Workflow/Architect/ArchitectChatEmptyState.swift:128-155 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:310 — Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:310-337 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppRPCClient.swift:391-418 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) Packages/OsaurusCore/Views/Event/EventFormComponents.swift:516 — Packages/OsaurusCore/Views/Event/EventFormComponents.swift:516-549 | Packages/OsaurusCore/Views/Event/EventFormComponents.swift:1194-1221 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) Packages/OsaurusCore/Services/AgentChannel/AgentChannelPublishService.swift:1040 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelPublishService.swift:1040-1067 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelPublishService.swift:1069-1101 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) Packages/OsaurusCore/Views/Settings/ComputerUseSettingsView.swift:503 — Packages/OsaurusCore/Views/Settings/ComputerUseSettingsView.swift:503-541 | Packages/OsaurusCore/Views/Settings/ComputerUseSettingsView.swift:543-570 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) Packages/OsaurusCore/Services/Context/SubagentJobEvaluator.swift:823 — Packages/OsaurusCore/Services/Context/SubagentJobEvaluator.swift:823-857 | Packages/OsaurusCore/Services/Context/SubagentJobEvaluator.swift:867-894 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) Packages/OsaurusCore/Storage/MemoryDatabase.swift:3013 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:3013-3040 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:3091-3118 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:107 — Packages/OsaurusCore/Views/Plugin/PluginsView.swift:107-134 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:2506-2533 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) Packages/OsaurusCore/Networking/HTTPHandler.swift:9362 — Packages/OsaurusCore/Networking/HTTPHandler.swift:9362-9395 | Packages/OsaurusCore/Networking/HTTPHandler.swift:9398-9425 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) Packages/OsaurusCore/Views/Settings/ProvidersView.swift:321 — Packages/OsaurusCore/Views/Settings/ProvidersView.swift:321-348 | Packages/OsaurusCore/Views/Settings/RemoteProvidersView.swift:289-316 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (22 corresponding lines) · ×13
  • Edited copy of a member (22 corresponding lines) Packages/OsaurusCore/Services/ModelRuntime/ModelCapabilityLedger.swift:136 — Packages/OsaurusCore/Services/ModelRuntime/ModelCapabilityLedger.swift:136-157 | Packages/OsaurusCore/Services/ModelRuntime/ModelPrefillTuningStore.swift:68-90 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) Packages/OsaurusCLI/Sources/OsaurusCLICore/Services/Configuration.swift:24 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Services/Configuration.swift:24-56 | Packages/OsaurusCLI/Sources/OsaurusCLICore/Services/Configuration.swift:60-81 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:962 — Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:962-985 | Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1184-1205 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:583 — Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:583-604 | Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:606-634 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) Packages/OsaurusCore/Services/Auth/OwnerDeviceAccessHost.swift:537 — Packages/OsaurusCore/Services/Auth/OwnerDeviceAccessHost.swift:537-558 | Packages/OsaurusCore/Services/Router/WorkspaceAgentAccessHost.swift:714-736 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3956 — Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3956-3977 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:4144-4165 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) Packages/OsaurusCore/Services/Sync/SyncAttentionFeed.swift:141 — Packages/OsaurusCore/Services/Sync/SyncAttentionFeed.swift:141-162 | Packages/OsaurusCore/Services/Sync/SyncManageFeed.swift:276-311 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) Packages/OsaurusCore/Services/HuggingFaceService.swift:562 — Packages/OsaurusCore/Services/HuggingFaceService.swift:562-583 | Packages/OsaurusCore/Services/HuggingFaceService.swift:624-645 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:446 — Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:446-467 | Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:930-958 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) Packages/OsaurusCore/PrivacyFilter/Core/MessageScrubbing.swift:405 — Packages/OsaurusCore/PrivacyFilter/Core/MessageScrubbing.swift:405-427 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyFilterPipeline.swift:1185-1206 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) Packages/OsaurusCore/Models/Plugin/ExternalPlugin.swift:649 — Packages/OsaurusCore/Models/Plugin/ExternalPlugin.swift:649-670 | Packages/OsaurusCore/Tools/ToolRegistry.swift:116-137 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:216 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:216-240 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:222-243 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) Packages/OsaurusCore/Models/Configuration/MCPProviderTemplate.swift:174 — Packages/OsaurusCore/Models/Configuration/MCPProviderTemplate.swift:174-195 | Packages/OsaurusCore/Models/Configuration/MCPProviderTemplate.swift:198-221 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 10+ corresponding lines) · ×13
  • Edited copies of one member (3 members, 10+ corresponding lines) Packages/OsaurusCore/Services/Event/Feed/RSSEventSource.swift:193 — Packages/OsaurusCore/Services/Event/Feed/RSSEventSource.swift:193-202 | Packages/OsaurusCore/Services/Event/RunFailedEventSource.swift:56-65 | Packages/OsaurusCore/Services/Event/Stream/SSEEventSource.swift:256-265 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) Packages/OsaurusCore/Services/Sync/SyncConversationStore.swift:585 — Packages/OsaurusCore/Services/Sync/SyncConversationStore.swift:585-594 | Packages/OsaurusCore/Services/Sync/SyncConversationStore.swift:628-638 | Packages/OsaurusCore/Services/Sync/SyncConversationStore.swift:640-650 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:738 — Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:738-747 | Packages/OsaurusCore/Tools/ExternalTool.swift:88-115 | Packages/OsaurusCore/Tools/ExternalTool.swift:120-147 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) Packages/OsaurusCore/Services/NotificationService.swift:107 — Packages/OsaurusCore/Services/NotificationService.swift:107-119 | Packages/OsaurusCore/Services/NotificationService.swift:121-137 | Packages/OsaurusCore/Services/NotificationService.swift:234-243 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) Packages/OsaurusCore/Services/Keychain/EventSecretsKeychain.swift:32 — Packages/OsaurusCore/Services/Keychain/EventSecretsKeychain.swift:32-42 | Packages/OsaurusCore/Services/Keychain/SourceCredentialVault.swift:26-36 | Packages/OsaurusCore/Services/Keychain/WorkflowSecretsKeychain.swift:105-114 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:594 — Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:594-603 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:606-615 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:2127-2136 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) Packages/OsaurusCore/Services/Method/MethodSearchService.swift:122 — Packages/OsaurusCore/Services/Method/MethodSearchService.swift:122-131 | Packages/OsaurusCore/Services/Skill/SkillSearchService.swift:151-161 | Packages/OsaurusCore/Services/Tool/ToolSearchService.swift:333-344 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) Packages/OsaurusCore/Models/API/OpenAIAPI.swift:1654 — Packages/OsaurusCore/Models/API/OpenAIAPI.swift:1654-1671 | Packages/OsaurusCore/Tools/SchemaValidator.swift:853-862 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:834-843 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) Packages/OsaurusCore/Models/AgentDelegation/SubagentConfiguration.swift:1196 — Packages/OsaurusCore/Models/AgentDelegation/SubagentConfiguration.swift:1196-1205 | Packages/OsaurusCore/Services/Sandbox/SandboxPackageManifest.swift:133-143 | Packages/OsaurusCore/Tools/AgentLoopTools.swift:468-480 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) Packages/OsaurusCore/Models/Agent/AgentStarterTemplate.swift:29 — Packages/OsaurusCore/Models/Agent/AgentStarterTemplate.swift:29-38 | Packages/OsaurusCore/Models/Agent/AgentStarterTemplate.swift:53-62 | Packages/OsaurusCore/Models/Agent/AgentStarterTemplate.swift:67-82 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) Packages/OsaurusCore/Services/Attention/ConversationMailbox.swift:169 — Packages/OsaurusCore/Services/Attention/ConversationMailbox.swift:169-178 | Packages/OsaurusCore/Services/Attention/OwnerApprovalService.swift:214-223 | Packages/OsaurusCore/Services/Router/InvitePeerIdentityStore.swift:91-100 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) Packages/OsaurusCore/Services/Sync/SyncAgentDirectory.swift:331 — Packages/OsaurusCore/Services/Sync/SyncAgentDirectory.swift:331-342 | Packages/OsaurusCore/Services/Sync/SyncAttentionFeed.swift:276-286 | Packages/OsaurusCore/Services/Sync/SyncManageFeed.swift:770-779 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) Packages/OsaurusCore/Services/Plugin/ClaudeMarketplaceImportabilityCatalog.swift:290 — Packages/OsaurusCore/Services/Plugin/ClaudeMarketplaceImportabilityCatalog.swift:290-299 | Packages/OsaurusCore/Views/Plugin/ClaudeMarketplaceCard.swift:157-166 | Packages/OsaurusCore/Views/Plugin/ClaudeMarketplaceDetailView.swift:150-159 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D17 · Explicit Debt · TodoComment · ×12
  • TodoComment Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:2079 — /// Todo discipline: when true, some `todo` call with at least one — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment Packages/OsaurusCore/Views/Chat/AgentInlineBlocks.swift:42 — /// Todo pill until the user dismisses it. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment Packages/OsaurusCore/Views/Chat/AgentInlineBlocks.swift:123 — /// Todo pill to avoid flicker when the cursor crosses the pill's — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment Packages/OsaurusCore/Views/Chat/ChatView.swift:9021 — // Todo replaces one session-scoped checklist wholesale. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment Packages/OsaurusCore/Views/Chat/ChatView.swift:9631 — // Todo notice disappears. No prose classifier, — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment Packages/OsaurusCore/Views/Agent/AgentsView.swift:3226 — // TODO(mode-merge): the spec (§9.4 / §13) allows per-field overrides — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment Packages/OsaurusCore/Tools/AgentLoopTools.swift:94 — // todo-staleness nudge could never arm (pending == 0), the UI block — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:1920 — /// Todo is model-authored progress metadata, not an execution precondition. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:2517 — // Todo is advisory UI state, not a runtime lock. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:2537 — // Todo forever instead of returning to the actual pending action. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:3568 — // Todo staleness: when the session todo still has unchecked — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment Packages/OsaurusCore/Models/Chat/ContentBlock.swift:1518 — /// (todo banner, completion banner, clarify overlay) rather than — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
D4 · Code Duplication · Edited copies of one member (3 members, 3+ corresponding lines) · ×12
  • Edited copies of one member (3 members, 3+ corresponding lines) Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorAgentProgressStyle.swift:11 — Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorAgentProgressStyle.swift:11-13 | Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorModelPickerStyle.swift:12-14 | Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorThinkingStyle.swift:17-19 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 3+ corresponding lines) Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorActivityStyle.swift:6 — Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorActivityStyle.swift:6-8 | Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorMessageHeaderStyle.swift:7-9 | Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorThinkingStyle.swift:6-8 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 3+ corresponding lines) Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool+History.swift:208 — Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool+History.swift:208-213 | Packages/OsaurusCore/Tools/OsaurusTool.swift:342-350 | Packages/OsaurusCore/Tools/Workflow/WorkflowDiscoverTool.swift:286-288 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 3+ corresponding lines) Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorAgentPickerStyle.swift:17 — Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorAgentPickerStyle.swift:17-19 | Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorAttachmentStyle.swift:57-59 | Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorModelPickerStyle.swift:18-20 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 3+ corresponding lines) Packages/OsaurusCore/Services/Chat/SystemPromptTemplates.swift:1381 — Packages/OsaurusCore/Services/Chat/SystemPromptTemplates.swift:1381-1393 | Packages/OsaurusCore/Services/ModelRuntime/RuntimeProofMatrixReporter.swift:393-397 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalDiff.swift:574-576 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 3+ corresponding lines) Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorComposerChips.swift:43 — Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorComposerChips.swift:43-45 | Packages/OsaurusCore/Views/DesignSystem/SettingsFields.swift:315-317 | Packages/OsaurusCore/Views/Workflow/Architect/ArchitectSidebarPanel.swift:1170-1172 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 3+ corresponding lines) Packages/OsaurusCore/AppleApps/Support/AppleSchema.swift:59 — Packages/OsaurusCore/AppleApps/Support/AppleSchema.swift:59-61 | Packages/OsaurusCore/Browser/Tool/BrowserChildTools.swift:303-305 | Packages/OsaurusCore/Tools/Agent/AgentDraftTool.swift:123-125 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 3+ corresponding lines) Packages/OsaurusCore/Services/FavoriteModelsStore.swift:118 — Packages/OsaurusCore/Services/FavoriteModelsStore.swift:118-120 | Packages/OsaurusCore/Tools/ShellCommandRiskScanner.swift:466-468 | Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:2584-2588 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 3+ corresponding lines) Packages/OsaurusCore/Models/Configuration/ClaudeCodeConfiguration.swift:603 — Packages/OsaurusCore/Models/Configuration/ClaudeCodeConfiguration.swift:603-605 | Packages/OsaurusCore/Services/Sandbox/SandboxPackageRequestNormalizer.swift:111-113 | Packages/OsaurusCore/Services/Workflow/PythonCodeNodeExecutor.swift:217-219 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 3+ corresponding lines) Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorAgentPickerStyle.swift:8 — Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorAgentPickerStyle.swift:8-10 | Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorAttachmentStyle.swift:11-13 | Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorModelPickerStyle.swift:9-11 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 3+ corresponding lines) Packages/OsaurusCore/Services/AgentCreation/AgentDraftStore.swift:20 — Packages/OsaurusCore/Services/AgentCreation/AgentDraftStore.swift:20-22 | Packages/OsaurusCore/Services/Workflow/InstalledWorkflowStore.swift:34-36 | Packages/OsaurusCore/Services/Workflow/WorkflowDraftStore.swift:23-25 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 3+ corresponding lines) scripts/live-proof/run-local-family-chat-tool-proof.py:72 — scripts/live-proof/run-local-family-chat-tool-proof.py:72-74 | scripts/live-proof/run-local-family-multiturn-tool-cache-proof.py:67-69 | scripts/live-proof/run-local-vl-media-cache-proof.py:70-72 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×12
  • Duplicated block (9–10 lines × 2) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Manifest/ManifestExtract.swift:32 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Manifest/ManifestExtract.swift:32-41 | Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Manifest/ManifestValidate.swift:25-33 — 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 `Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Manifest/ManifestExtract.swift:32` 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, `Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Manifest/ManifestExtract.swift:30` calls `extractManifest` and `Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Manifest/ManifestValidate.swift:23` 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–10 lines × 2) Packages/OsaurusCore/Models/Chat/ContentBlock.swift:1347 — Packages/OsaurusCore/Models/Chat/ContentBlock.swift:1347-1356 | Packages/OsaurusCore/Tools/RenderChartTool.swift:882-890 — 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. 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:13993 — Packages/OsaurusCore/Networking/HTTPHandler.swift:13993-14002 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14078-14086 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:13993` 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–10 lines × 2) Packages/OsaurusCore/PrivacyFilter/Core/PrivacyFilterPipeline.swift:1236 — Packages/OsaurusCore/PrivacyFilter/Core/PrivacyFilterPipeline.swift:1236-1244 | Packages/OsaurusCore/PrivacyFilter/Core/StreamingUnscrubber.swift:261-270 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/PrivacyFilter/Core/PrivacyFilterPipeline.swift:1236` 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–10 lines × 2) Packages/OsaurusCore/Services/Chat/ContextCompactionService.swift:713 — Packages/OsaurusCore/Services/Chat/ContextCompactionService.swift:713-722 | Packages/OsaurusCore/Services/Inference/CoreModelService.swift:890-898 — 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 `Packages/OsaurusCore/Services/Chat/ContextCompactionService.swift:713` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–10 lines × 2) Packages/OsaurusCore/Services/ProcessMemoryProbe.swift:26 — Packages/OsaurusCore/Services/ProcessMemoryProbe.swift:26-34 | Packages/OsaurusCore/Services/SystemMonitorService.swift:274-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 (9–10 lines × 2) Packages/OsaurusCore/Tools/ConfigurationTools.swift:825 — Packages/OsaurusCore/Tools/ConfigurationTools.swift:825-834 | Packages/OsaurusCore/Tools/ConfigurationTools.swift:1363-1371 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/ConfigurationTools.swift:825` 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 (9–10 lines × 2) Packages/OsaurusCore/Tools/SchemaValidator.swift:145 — Packages/OsaurusCore/Tools/SchemaValidator.swift:145-154 | Packages/OsaurusCore/Tools/SchemaValidator.swift:302-310 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/SchemaValidator.swift:145` 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–10 lines × 2) Packages/OsaurusCore/Views/Credentials/VaultAccountsView.swift:399 — Packages/OsaurusCore/Views/Credentials/VaultAccountsView.swift:399-407 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowConnectionsSheet.swift:148-157 — 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 `Packages/OsaurusCore/Views/Credentials/VaultAccountsView.swift:399` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–10 lines × 2) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:1546 — Packages/OsaurusCore/Views/Plugin/PluginsView.swift:1546-1554 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:1685-1694 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Plugin/PluginsView.swift:1546` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–10 lines × 2) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:394 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:394-403 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:380-388 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 368 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 `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:394` 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–10 lines × 2) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalDiffMatrixCLI.swift:88 — Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalDiffMatrixCLI.swift:88-97 | Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalDiffMatrixCLI.swift:182-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 `Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalDiffMatrixCLI.swift:88` 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 · Edited copy of a member (27 corresponding lines) · ×11
  • Edited copy of a member (27 corresponding lines) Packages/OsaurusCore/Models/Schedule/Schedule.swift:592 — Packages/OsaurusCore/Models/Schedule/Schedule.swift:592-618 | Packages/OsaurusCore/Models/Watcher/Watcher.swift:184-216 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:2889 — Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:2889-2915 | Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:3856-3885 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) Packages/OsaurusCore/Models/Theme/CustomTheme.swift:338 — Packages/OsaurusCore/Models/Theme/CustomTheme.swift:338-385 | Packages/OsaurusCore/Models/Theme/Theme.swift:811-837 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) Packages/OsaurusCore/Storage/MemoryDatabase.swift:1748 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:1748-1774 | Packages/OsaurusCore/Storage/RouterBillingDatabase.swift:385-423 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:540 — Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:540-575 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1257-1283 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) Packages/OsaurusCore/Models/IMessage/IMessageConnectionConfiguration.swift:85 — Packages/OsaurusCore/Models/IMessage/IMessageConnectionConfiguration.swift:85-117 | Packages/OsaurusCore/Models/WhatsApp/WhatsAppConnectionConfiguration.swift:74-100 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) Packages/OsaurusCore/Networking/HTTPHandler.swift:3984 — Packages/OsaurusCore/Networking/HTTPHandler.swift:3984-4010 | Packages/OsaurusCore/Networking/HTTPHandler.swift:4016-4046 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:43 — Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:43-69 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:78-108 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) Packages/OsaurusCore/Subagent/SpawnDescriptors.swift:225 — Packages/OsaurusCore/Subagent/SpawnDescriptors.swift:225-259 | Packages/OsaurusCore/Subagent/SpawnDescriptors.swift:276-302 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ContextOptimizer.swift:474 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ContextOptimizer.swift:474-500 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ScreenContextFixture.swift:49-77 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) Packages/OsaurusCore/Services/SystemPermissionService.swift:287 — Packages/OsaurusCore/Services/SystemPermissionService.swift:287-313 | Packages/OsaurusCore/Services/SystemPermissionService.swift:328-354 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×11
  • Duplicated block (23 lines × 2) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:203 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:203-225 | Packages/OsaurusCore/Services/HuggingFaceService.swift:919-941 — 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 (23 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:8812 — Packages/OsaurusCore/Networking/HTTPHandler.swift:8812-8834 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8930-8952 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:8812` 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 (23 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:12315 — Packages/OsaurusCore/Networking/HTTPHandler.swift:12315-12337 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12354-12376 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:12315` 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 lines × 2) Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:916 — Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:916-938 | Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:1290-1312 — 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 `Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:916` 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 (23 lines × 2) Packages/OsaurusCore/Services/MobileConnect/RemoteSecretPromptQueue.swift:50 — Packages/OsaurusCore/Services/MobileConnect/RemoteSecretPromptQueue.swift:50-72 | Packages/OsaurusCore/Services/Sync/SyncSecretPromptQueue.swift:75-97 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Services/Sync/SyncSecretPromptQueue.swift:98` calls `post` and `Packages/OsaurusCore/Services/MobileConnect/RemoteSecretPromptQueue.swift:73` 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 (23 lines × 2) Packages/OsaurusCore/Storage/MemoryDatabase.swift:649 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:649-671 | Packages/OsaurusCore/Storage/TaskDatabase.swift:230-253 — 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 `Packages/OsaurusCore/Storage/MemoryDatabase.swift:649` 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 lines × 2) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:252 — Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:252-274 | Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:893-915 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:252` 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 lines × 2) Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:616 — Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:616-638 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:1244-1266 — both copies are in the same file, so extract the 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 (23 lines × 2) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:1983 — Packages/OsaurusCore/Views/Plugin/PluginsView.swift:1983-2005 | Packages/OsaurusCore/Views/Settings/ProvidersView.swift:2870-2892 — 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 (23 lines × 2) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerAppleScript.swift:263 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerAppleScript.swift:263-285 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerScreenContext.swift:183-205 — 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 `Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerAppleScript.swift:263` 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 lines × 2) Packages/OsaurusCore/Views/DesignSystem/SettingsKitGallery.swift:298 — Packages/OsaurusCore/Views/DesignSystem/SettingsKitGallery.swift:298-320 | Packages/OsaurusCore/Views/DesignSystem/SettingsKitGallery.swift:1509-1531 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/DesignSystem/SettingsKitGallery.swift:298` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Edited copies of one member (3 members, 13+ corresponding lines) · ×10
  • Edited copies of one member (3 members, 13+ corresponding lines) Packages/OsaurusCore/ComputerUse/Driver/Mac/ElementCache.swift:127 — Packages/OsaurusCore/ComputerUse/Driver/Mac/ElementCache.swift:127-144 | Packages/OsaurusCore/ComputerUse/Driver/Mac/ElementCache.swift:146-158 | Packages/OsaurusCore/ComputerUse/Driver/Mac/ElementCache.swift:175-193 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) Packages/OsaurusCore/Storage/EventRunDatabase.swift:471 — Packages/OsaurusCore/Storage/EventRunDatabase.swift:471-484 | Packages/OsaurusCore/Storage/TaskDatabase.swift:601-613 | Packages/OsaurusCore/Storage/WorkflowRunDatabase.swift:257-270 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:2452 — Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:2452-2464 | Packages/OsaurusCore/Models/Configuration/RemoteProviderConfiguration.swift:433-450 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:13-29 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:195 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:195-207 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:222-234 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:213-225 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) Packages/OsaurusCore/PrivacyFilter/Views/PrivacyCustomRuleEditor.swift:185 — Packages/OsaurusCore/PrivacyFilter/Views/PrivacyCustomRuleEditor.swift:185-197 | Packages/OsaurusCore/PrivacyFilter/Views/PrivacyCustomRuleEditor.swift:264-281 | Packages/OsaurusCore/PrivacyFilter/Views/PrivacyCustomRuleEditor.swift:305-320 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) Packages/OsaurusCore/Models/Documents/BusinessDocumentSummary.swift:85 — Packages/OsaurusCore/Models/Documents/BusinessDocumentSummary.swift:85-101 | Packages/OsaurusCore/Models/Evidence/EvidenceReportRegistry.swift:47-63 | Packages/OsaurusCore/Services/Documents/CSVTableWorkflowService.swift:18-30 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) Packages/OsaurusCore/Services/CrashReportingService.swift:349 — Packages/OsaurusCore/Services/CrashReportingService.swift:349-362 | Packages/OsaurusCore/Services/ProcessMemoryProbe.swift:25-37 | Packages/OsaurusCore/Services/SystemMonitorService.swift:273-287 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:1972 — Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:1972-1984 | Packages/OsaurusCore/Views/Workflow/FlowViewer/WorkflowFlowInspector.swift:359-371 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowCards.swift:181-194 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1047 — Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1047-1059 | Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1168-1180 | Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:293-305 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1343 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1343-1355 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:303-318 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:1509-1525 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 7+ corresponding lines) · ×10
  • Edited copies of one member (3 members, 7+ corresponding lines) Packages/OsaurusCore/Models/Configuration/ModelOptions.swift:484 — Packages/OsaurusCore/Models/Configuration/ModelOptions.swift:484-493 | Packages/OsaurusCore/Models/Configuration/ModelOptions.swift:1001-1012 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalThinkingControl.swift:33-39 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:131 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:131-137 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ComputerUseScorecard.swift:47-53 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReport.swift:741-747 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) Packages/OsaurusCore/Models/Event/EventPayload.swift:326 — Packages/OsaurusCore/Models/Event/EventPayload.swift:326-334 | Packages/OsaurusCore/Models/Workflow/WorkflowValidator.swift:312-318 | Packages/OsaurusCore/Models/Workflow/WorkflowValidator.swift:328-334 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) Packages/OsaurusCore/Services/Attention/AttentionOpener.swift:39 — Packages/OsaurusCore/Services/Attention/AttentionOpener.swift:39-47 | Packages/OsaurusCore/Services/Task/TaskControl.swift:66-72 | Packages/OsaurusCore/Views/Event/EventDetailView.swift:733-739 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:556 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:556-565 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalDiff.swift:530-536 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReviewReport.swift:898-907 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) Packages/OsaurusCore/Managers/Chat/ChatSessionImporter.swift:713 — Packages/OsaurusCore/Managers/Chat/ChatSessionImporter.swift:713-719 | Packages/OsaurusCore/Services/Router/OsaurusIDSessionStore.swift:102-110 | Packages/OsaurusCore/Services/Router/WorkspaceRosterStore.swift:265-273 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) Packages/OsaurusCore/Models/Discord/DiscordConnectionConfiguration.swift:149 — Packages/OsaurusCore/Models/Discord/DiscordConnectionConfiguration.swift:149-155 | Packages/OsaurusCore/Models/Slack/SlackConnectionConfiguration.swift:265-271 | Packages/OsaurusCore/Models/Telegram/TelegramConnectionConfiguration.swift:231-237 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) Packages/OsaurusCore/Models/AgentChannel/AgentChannelAsyncModels.swift:207 — Packages/OsaurusCore/Models/AgentChannel/AgentChannelAsyncModels.swift:207-213 | Packages/OsaurusCore/Models/AgentChannel/AgentChannelConfiguration.swift:561-569 | Packages/OsaurusCore/Models/Event/OsaurusEvent.swift:281-287 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) Packages/OsaurusCore/Views/Chat/ChatHistoryPane.swift:469 — Packages/OsaurusCore/Views/Chat/ChatHistoryPane.swift:469-477 | Packages/OsaurusCore/Views/Chat/ChatHistoryPane.swift:479-485 | Packages/OsaurusCore/Views/Chat/ChatHistoryPane.swift:487-493 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) Packages/OsaurusCore/Folder/FolderTools.swift:659 — Packages/OsaurusCore/Folder/FolderTools.swift:659-669 | Packages/OsaurusCore/Tools/ToolRegistry.swift:844-850 | Packages/OsaurusCore/Tools/Workflow/WorkflowTools.swift:69-75 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 4+ corresponding lines) · ×10
  • Edited copies of one member (3 members, 4+ corresponding lines) Packages/OsaurusCore/Models/Event/EventPayload.swift:318 — Packages/OsaurusCore/Models/Event/EventPayload.swift:318-323 | Packages/OsaurusCore/Models/Workflow/BindingRenderer.swift:83-88 | Packages/OsaurusCore/Services/ChatImport/ChatImportVerifier.swift:152-155 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 4+ corresponding lines) Packages/OsaurusCore/Models/Channels/ChannelIdentity.swift:126 — Packages/OsaurusCore/Models/Channels/ChannelIdentity.swift:126-132 | Packages/OsaurusCore/Models/Email/EmailChannelConfiguration.swift:283-286 | Packages/OsaurusCore/Models/Telegram/TelegramConnectionConfiguration.swift:137-143 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 4+ corresponding lines) Packages/OsaurusCore/Services/MCP/MCPProviderKeychain.swift:160 — Packages/OsaurusCore/Services/MCP/MCPProviderKeychain.swift:160-163 | Packages/OsaurusCore/Services/Provider/RemoteProviderKeychain.swift:183-186 | Packages/OsaurusCore/Services/Search/SearchProviderKeychain.swift:26-30 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 4+ corresponding lines) Packages/OsaurusCore/Views/Agent/BuiltInAgentAvatarPicker.swift:51 — Packages/OsaurusCore/Views/Agent/BuiltInAgentAvatarPicker.swift:51-56 | Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:6717-6724 | Packages/OsaurusCore/Views/Template/WorkflowShareCardView.swift:145-148 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 4+ corresponding lines) Packages/OsaurusCore/Services/Chat/PromptManifest.swift:270 — Packages/OsaurusCore/Services/Chat/PromptManifest.swift:270-273 | Packages/OsaurusCore/Services/Knowledge/KnowledgeIndexService.swift:440-443 | Packages/OsaurusCore/Storage/AttachmentBlobStore.swift:66-69 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 4+ corresponding lines) Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:934 — Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:934-937 | Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1469-1472 | Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:468-471 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 4+ corresponding lines) Packages/OsaurusCore/Models/Theme/DesignLibrary/InspectorAssignedTextEditor.swift:107 — Packages/OsaurusCore/Models/Theme/DesignLibrary/InspectorAssignedTextEditor.swift:107-110 | Packages/OsaurusCore/Views/Chat/EditableTextView.swift:408-415 | Packages/OsaurusCore/Views/Common/IMEAwareTextField.swift:176-181 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 4+ corresponding lines) Packages/OsaurusCore/Models/Tool/ToolApprovalPresentation.swift:421 — Packages/OsaurusCore/Models/Tool/ToolApprovalPresentation.swift:421-424 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelAuditWorkbenchService.swift:184-187 | Packages/OsaurusCore/Views/Agent/AgentsView.swift:4917-4920 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 4+ corresponding lines) Packages/OsaurusCore/AppleApps/AppleAppsPluginMigration.swift:89 — Packages/OsaurusCore/AppleApps/AppleAppsPluginMigration.swift:89-92 | Packages/OsaurusCore/Browser/Runtime/BrowserSessionCatalog.swift:202-207 | Packages/OsaurusCore/Models/Configuration/ModelExposureStore.swift:125-130 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 4+ corresponding lines) scripts/live-proof/run-local-family-chat-tool-proof.py:56 — scripts/live-proof/run-local-family-chat-tool-proof.py:56-59 | scripts/live-proof/run-local-family-multiturn-tool-cache-proof.py:51-54 | scripts/live-proof/run-local-vl-media-cache-proof.py:54-57 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×10
  • Duplicated block (8 lines × 3) Packages/OsaurusCore/Models/API/AnthropicAPI.swift:103 — Packages/OsaurusCore/Models/API/AnthropicAPI.swift:103-110 | Packages/OsaurusCore/Models/API/AnthropicAPI.swift:157-164 | Packages/OsaurusCore/Models/API/AnthropicAPI.swift:367-374 — 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 `Packages/OsaurusCore/Models/API/AnthropicAPI.swift:103` 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) Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:282 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:282-289 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:292-299 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:302-309 — 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 `Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:282` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) Packages/OsaurusCore/Views/Chat/ChatImportReviewView.swift:48 — Packages/OsaurusCore/Views/Chat/ChatImportReviewView.swift:48-55 | Packages/OsaurusCore/Views/Chat/ComputerUseConfirmOverlay.swift:223-230 | Packages/OsaurusCore/Views/Chat/ConfigApprovalModal.swift:230-237 — 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 `Packages/OsaurusCore/Views/Chat/ChatImportReviewView.swift:48` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) Packages/OsaurusCore/Views/Chat/ConversationEventRow.swift:36 — Packages/OsaurusCore/Views/Chat/ConversationEventRow.swift:36-43 | Packages/OsaurusCore/Views/Chat/HostedSecretCard.swift:61-68 | Packages/OsaurusCore/Views/Chat/SecretPromptOverlay.swift:155-162 — 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 `Packages/OsaurusCore/Views/Chat/ConversationEventRow.swift:36` 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) Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:655 — Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:655-662 | Packages/OsaurusCore/Views/Chat/NativeCompactionMarkerView.swift:233-240 | Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift:341-348 — before extracting anything, compare `Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift` and `Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 146 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 `Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:655` 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) Packages/OsaurusCore/Views/Settings/BrowserSettingsView.swift:150 — Packages/OsaurusCore/Views/Settings/BrowserSettingsView.swift:150-157 | Packages/OsaurusCore/Views/Settings/ComputerUseSettingsView.swift:206-213 | Packages/OsaurusCore/Views/Settings/StorageSettingsView.swift:351-358 — 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 `Packages/OsaurusCore/Views/Settings/BrowserSettingsView.swift:150` 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) Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:839 — Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:839-846 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:856-863 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:992-999 — 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 `Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:839` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) Packages/OsaurusCore/Services/Chat/GroundedConfigClaimCheck.swift:289 — Packages/OsaurusCore/Services/Chat/GroundedConfigClaimCheck.swift:289-296 | Packages/OsaurusCore/Services/Chat/GroundedFileSideEffectCheck.swift:116-123 | Packages/OsaurusCore/Services/Chat/GroundedKnowledgeClaimCheck.swift:165-172 — 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 `Packages/OsaurusCore/Services/Chat/GroundedConfigClaimCheck.swift:289` 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 (8 lines × 3) Packages/OsaurusCore/Services/Provider/OpenAICodexOAuthService.swift:502 — Packages/OsaurusCore/Services/Provider/OpenAICodexOAuthService.swift:502-509 | Packages/OsaurusCore/Services/Provider/OpenRouterOAuthService.swift:147-154 | Packages/OsaurusCore/Services/Provider/XAIOAuthService.swift:210-217 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (8 lines × 3) helpers/osaurus-wa/bridge.go:871 — helpers/osaurus-wa/bridge.go:871-878 | helpers/osaurus-wa/bridge.go:905-912 | helpers/osaurus-wa/bridge.go:968-975 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×9
  • Members sharing a duplicated core (5 members, 50+ identical tokens) Packages/OsaurusCore/AppleScript/Loop/AppleScriptTraceLog.swift:146 — Packages/OsaurusCore/AppleScript/Loop/AppleScriptTraceLog.swift:146-158 | Packages/OsaurusCore/ComputerUse/Loop/ComputerUseTraceLog.swift:138-150 | Packages/OsaurusCore/Managers/TTSService.swift:777-794 | Packages/OsaurusCore/Services/ModelRuntime/PrefillDebugLog.swift:92-109 | Packages/OsaurusCore/Utils/KnowledgeLogger.swift:60-77 — 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.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1471 — Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1471-1579 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1828-1869 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1871-1915 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2115-2252 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2306-2418 — 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.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:62 — Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:62-92 | Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:230-258 | Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:302-337 | Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:371-398 | Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:475-499 — 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.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) Packages/OsaurusCore/Models/Discord/DiscordConnectionConfiguration.swift:134 — Packages/OsaurusCore/Models/Discord/DiscordConnectionConfiguration.swift:134-147 | Packages/OsaurusCore/Models/IMessage/IMessageConnectionConfiguration.swift:307-316 | Packages/OsaurusCore/Models/Slack/SlackConnectionConfiguration.swift:250-263 | Packages/OsaurusCore/Models/Telegram/TelegramConnectionConfiguration.swift:216-229 | Packages/OsaurusCore/Models/WhatsApp/WhatsAppConnectionConfiguration.swift:263-272 — 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.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) Packages/OsaurusCore/Networking/HTTPHandler.swift:15297 — Packages/OsaurusCore/Networking/HTTPHandler.swift:15297-15811 | Packages/OsaurusCore/Networking/HTTPHandler.swift:15863-16045 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16160-16331 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17931-18081 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18604-18792 — 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.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) Packages/OsaurusCore/Views/Agent/Setup/AgentSetupWizardView.swift:148 — Packages/OsaurusCore/Views/Agent/Setup/AgentSetupWizardView.swift:148-215 | Packages/OsaurusCore/Views/Agent/Templates/AgentTemplateSheets.swift:49-78 | Packages/OsaurusCore/Views/Template/TemplateImportSheet.swift:47-92 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowBundleSetupView.swift:126-183 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowSetupWizardView.swift:208-281 — 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.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) Packages/OsaurusCore/Views/Event/EventFormComponents.swift:111 — Packages/OsaurusCore/Views/Event/EventFormComponents.swift:111-139 | Packages/OsaurusCore/Views/Event/EventFormComponents.swift:148-172 | Packages/OsaurusCore/Views/Event/EventFormComponents.swift:269-281 | Packages/OsaurusCore/Views/Event/EventFormComponents.swift:289-301 | Packages/OsaurusCore/Views/Event/EventFormComponents.swift:366-395 — 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.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:543 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:543-590 | Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:703-741 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:713-768 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:420-458 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:904-942 — 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.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:488 — Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:488-545 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:627-682 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:875-920 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:1730-1805 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:1809-1865 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Edited copies of one member (3 members, 17+ corresponding lines) · ×9
  • Edited copies of one member (3 members, 17+ corresponding lines) Packages/OsaurusCore/AppleApps/Mail/MailService.swift:359 — Packages/OsaurusCore/AppleApps/Mail/MailService.swift:359-382 | Packages/OsaurusCore/AppleApps/Music/MusicService.swift:76-92 | Packages/OsaurusCore/AppleApps/Notes/NotesService.swift:62-82 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 17+ corresponding lines) Packages/OsaurusCore/Configuration/Declarative/ConfigManifest.swift:963 — Packages/OsaurusCore/Configuration/Declarative/ConfigManifest.swift:963-980 | Packages/OsaurusCore/Configuration/Declarative/ConfigManifest.swift:994-1010 | Packages/OsaurusCore/Configuration/Declarative/ConfigManifest.swift:1022-1041 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 17+ corresponding lines) Packages/OsaurusCore/Services/Documents/PDFAdapter.swift:491 — Packages/OsaurusCore/Services/Documents/PDFAdapter.swift:491-509 | Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:948-964 | Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:966-984 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 17+ corresponding lines) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1054 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1054-1071 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:748-765 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1151-1167 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 17+ corresponding lines) Packages/OsaurusCore/Models/Configuration/ModelExposureStore.swift:143 — Packages/OsaurusCore/Models/Configuration/ModelExposureStore.swift:143-159 | Packages/OsaurusCore/Models/Configuration/RemoteProviderConfiguration.swift:598-618 | Packages/OsaurusCore/Models/Configuration/ServerConfigurationStore.swift:83-102 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 17+ corresponding lines) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:2095 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:2095-2111 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:2385-2404 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:2438-2457 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 17+ corresponding lines) Packages/OsaurusCore/Views/Agent/Database/DatabaseTablesView.swift:887 — Packages/OsaurusCore/Views/Agent/Database/DatabaseTablesView.swift:887-909 | Packages/OsaurusCore/Views/Agent/Database/DatabaseTablesView.swift:911-927 | Packages/OsaurusCore/Views/Agent/Database/DatabaseTablesView.swift:960-976 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 17+ corresponding lines) Packages/OsaurusCore/Models/Configuration/EmbeddingDetection.swift:49 — Packages/OsaurusCore/Models/Configuration/EmbeddingDetection.swift:49-65 | Packages/OsaurusCore/Models/Configuration/ModelFormatDetection.swift:50-66 | Packages/OsaurusCore/Models/Configuration/ModelInfo.swift:246-262 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 17+ corresponding lines) Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:144 — Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:144-160 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:672-688 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:693-709 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 6+ corresponding lines) · ×9
  • Edited copies of one member (4 members, 6+ corresponding lines) Packages/OsaurusCore/Services/Credentials/CredentialBinding.swift:166 — Packages/OsaurusCore/Services/Credentials/CredentialBinding.swift:166-171 | Packages/OsaurusCore/Services/Credentials/CredentialBinding.swift:189-194 | Packages/OsaurusCore/Services/Credentials/CredentialBinding.swift:196-204 | Packages/OsaurusCore/Services/Credentials/CredentialBinding.swift:214-219 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 6+ corresponding lines) Packages/OsaurusCore/Services/Chat/AgentTaskState.swift:1281 — Packages/OsaurusCore/Services/Chat/AgentTaskState.swift:1281-1286 | Packages/OsaurusCore/Services/Chat/AgentTaskState.swift:1289-1294 | Packages/OsaurusCore/Tools/ToolEnvelope.swift:560-566 | Packages/OsaurusCore/Tools/ToolEnvelope.swift:584-590 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 6+ corresponding lines) Packages/OsaurusCore/Models/Channels/ChannelIdentity.swift:209 — Packages/OsaurusCore/Models/Channels/ChannelIdentity.swift:209-214 | Packages/OsaurusCore/Services/Auth/PKCE.swift:55-60 | Packages/OsaurusCore/Services/Channels/ChannelSecurityEncoding.swift:11-16 | Packages/OsaurusCore/Services/Sandbox/SandboxManager.swift:1933-1940 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 6+ corresponding lines) Packages/OsaurusCore/Networking/HostAPIBridgeServer.swift:794 — Packages/OsaurusCore/Networking/HostAPIBridgeServer.swift:794-799 | Packages/OsaurusCore/Subagent/SpawnResultCompaction.swift:175-180 | Packages/OsaurusCore/Tools/OsaurusTool.swift:172-177 | Packages/OsaurusCore/Tools/SubagentApprovalArguments.swift:25-32 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 6+ corresponding lines) Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:307 — Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:307-312 | Packages/OsaurusCore/Services/Chat/AgentTaskState.swift:1503-1508 | Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:1564-1569 | Packages/OsaurusCore/Tools/SandboxSecretTools.swift:112-117 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 6+ corresponding lines) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Bench.swift:320 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Bench.swift:320-325 | Packages/OsaurusCore/Models/Configuration/LocalVisionEvidence.swift:129-134 | Packages/OsaurusCore/Services/ModelCompatibilityDiagnostics.swift:909-916 | Packages/OsaurusCore/Services/ModelRuntime.swift:8362-8367 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 6+ corresponding lines) Packages/OsaurusCore/Services/Context/SubagentJobEvaluator.swift:1200 — Packages/OsaurusCore/Services/Context/SubagentJobEvaluator.swift:1200-1205 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:495-500 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1143-1148 | Packages/OsaurusCore/Tools/SandboxSecretTools.swift:304-309 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 6+ corresponding lines) Packages/OsaurusCore/Models/AgentCollaboration/AgentCollaborationProtocol.swift:27 — Packages/OsaurusCore/Models/AgentCollaboration/AgentCollaborationProtocol.swift:27-39 | Packages/OsaurusCore/Models/Configuration/SearchProviderConfiguration.swift:55-60 | Packages/OsaurusCore/Services/Inference/ModelService.swift:254-259 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:567-579 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 6+ corresponding lines) Packages/OsaurusCore/ComputerUse/Telemetry/AxResolvableSweep.swift:37 — Packages/OsaurusCore/ComputerUse/Telemetry/AxResolvableSweep.swift:37-42 | Packages/OsaurusCore/Services/Context/ContextAttribution.swift:55-65 | Packages/OsaurusCore/Services/Skill/ClaudePluginManifestStore.swift:56-61 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ComputerUseScorecard.swift:131-141 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 6+ corresponding lines) · ×9
  • Edited copies of one member (3 members, 6+ corresponding lines) Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigDocument.swift:510 — Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigDocument.swift:510-515 | Packages/OsaurusCore/Models/API/EmbeddingAPI.swift:56-61 | Packages/OsaurusCore/Models/Agent/ConfiguratorConfigurationStore.swift:29-34 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 6+ corresponding lines) Packages/OsaurusCore/Models/API/AnthropicAPI.swift:276 — Packages/OsaurusCore/Models/API/AnthropicAPI.swift:276-282 | Packages/OsaurusCore/Models/API/AnthropicAPI.swift:297-302 | Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:502-508 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 6+ corresponding lines) Packages/OsaurusCore/Services/Provider/RemoteProviderKeychain.swift:50 — Packages/OsaurusCore/Services/Provider/RemoteProviderKeychain.swift:50-55 | Packages/OsaurusCore/Services/Provider/RemoteProviderKeychain.swift:86-91 | Packages/OsaurusCore/Services/Provider/RemoteProviderKeychain.swift:175-180 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 6+ corresponding lines) Packages/OsaurusCore/Utils/CronParser.swift:115 — Packages/OsaurusCore/Utils/CronParser.swift:115-122 | Packages/OsaurusCore/Utils/CronParser.swift:124-130 | Packages/OsaurusCore/Utils/CronParser.swift:132-137 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 6+ corresponding lines) Packages/OsaurusCore/Services/Documents/DocumentFileInspector.swift:152 — Packages/OsaurusCore/Services/Documents/DocumentFileInspector.swift:152-158 | Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:1068-1074 | Packages/OsaurusCore/Tools/ToolRegistry.swift:3518-3523 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 6+ corresponding lines) Packages/OsaurusCore/Models/Plugin/ExternalPlugin.swift:459 — Packages/OsaurusCore/Models/Plugin/ExternalPlugin.swift:459-464 | Packages/OsaurusCore/Services/Chat/AgentTaskState.swift:1454-1461 | Packages/OsaurusCore/Utils/KnowledgeGlob.swift:46-51 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 6+ corresponding lines) Packages/OsaurusCore/Views/DesignSystem/SettingsCodeBlock.swift:44 — Packages/OsaurusCore/Views/DesignSystem/SettingsCodeBlock.swift:44-49 | Packages/OsaurusCore/Views/DesignSystem/SettingsRow.swift:744-750 | Packages/OsaurusCore/Views/Plugin/ToolPermissionView.swift:495-500 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 6+ corresponding lines) Packages/OsaurusCore/Models/Configuration/ServerConfigurationStore.swift:116 — Packages/OsaurusCore/Models/Configuration/ServerConfigurationStore.swift:116-121 | Packages/OsaurusCore/Models/Configuration/ServerRuntimeSettingsStore.swift:971-976 | Packages/OsaurusCore/Models/Tool/ToolConfigurationStore.swift:54-59 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 6+ corresponding lines) Packages/OsaurusCore/Managers/Chat/ChatSessionExporter.swift:309 — Packages/OsaurusCore/Managers/Chat/ChatSessionExporter.swift:309-314 | Packages/OsaurusCore/Services/Event/SelfScheduleAutomations.swift:282-287 | Packages/OsaurusCore/Views/Event/EventFormComponents.swift:141-146 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 3+ corresponding lines) · ×9
  • Edited copies of one member (4 members, 3+ corresponding lines) Packages/OsaurusCore/Configuration/Declarative/ConfigSnapshot.swift:117 — Packages/OsaurusCore/Configuration/Declarative/ConfigSnapshot.swift:117-119 | Packages/OsaurusCore/Folder/WorkspaceWriteSafety.swift:399-403 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelAsyncSubstrate.swift:204-206 | Packages/OsaurusCore/Services/Knowledge/KnowledgeWriteService.swift:552-554 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 3+ corresponding lines) Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:922 — Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:922-926 | Packages/OsaurusCore/Views/Event/EventSourceEditors.swift:372-374 | Packages/OsaurusCore/Views/Settings/AgentChannelCustomConnectionSheet.swift:1103-1107 | Packages/OsaurusCore/Views/Skill/SkillEditorSheet.swift:84-88 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 3+ corresponding lines) Packages/OsaurusCore/Storage/ActivityLogStore.swift:1150 — Packages/OsaurusCore/Storage/ActivityLogStore.swift:1150-1156 | Packages/OsaurusCore/Storage/ConfigHistoryDatabase.swift:448-450 | Packages/OsaurusCore/Storage/EventRunDatabase.swift:529-531 | Packages/OsaurusCore/Storage/TaskDatabase.swift:697-699 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 3+ corresponding lines) Packages/OsaurusCore/Services/Router/OsaurusRouterAuthSigner.swift:112 — Packages/OsaurusCore/Services/Router/OsaurusRouterAuthSigner.swift:112-114 | Packages/OsaurusCore/Services/Sync/SyncConversationMapper.swift:578-580 | Packages/OsaurusCore/Services/Template/WorkflowShareService.swift:1248-1250 | Packages/OsaurusCore/Services/Workflow/InstalledWorkflowStore.swift:86-88 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 3+ corresponding lines) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsInstall.swift:454 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsInstall.swift:454-456 | Packages/OsaurusCore/Models/AgentChannel/LegacyInboundDispatchCarryOver.swift:62-64 | Packages/OsaurusCore/Services/Harness/HarnessAdapter.swift:217-219 | Packages/OsaurusCore/Services/Sandbox/SandboxInteractiveActivity.swift:35-37 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 3+ corresponding lines) Packages/OsaurusCore/Services/Documents/PDFEditor.swift:237 — Packages/OsaurusCore/Services/Documents/PDFEditor.swift:237-239 | Packages/OsaurusCore/Services/Template/MCPServerResolution.swift:72-74 | Packages/OsaurusCore/Tools/KnowledgeTools.swift:185-187 | Packages/OsaurusCore/Tools/SchemaValidator.swift:723-725 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 3+ corresponding lines) Packages/OsaurusCore/Storage/ConfigHistoryDatabase.swift:444 — Packages/OsaurusCore/Storage/ConfigHistoryDatabase.swift:444-446 | Packages/OsaurusCore/Storage/EventRunDatabase.swift:525-527 | Packages/OsaurusCore/Storage/TaskDatabase.swift:693-695 | Packages/OsaurusCore/Storage/WorkflowRunDatabase.swift:310-312 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 3+ corresponding lines) Packages/OsaurusCore/Services/Workflow/AgentNodeExecutor.swift:192 — Packages/OsaurusCore/Services/Workflow/AgentNodeExecutor.swift:192-194 | Packages/OsaurusCore/Services/Workflow/HTTPNodeExecutor.swift:109-111 | Packages/OsaurusCore/Services/Workflow/PythonCodeNodeExecutor.swift:86-88 | Packages/OsaurusCore/Services/Workflow/ToolNodeExecutor.swift:84-86 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 3+ corresponding lines) Packages/OsaurusCore/Services/Chat/ChatErrorMessages.swift:86 — Packages/OsaurusCore/Services/Chat/ChatErrorMessages.swift:86-88 | Packages/OsaurusCore/Services/ChatImport/ChatImportVerifier.swift:386-388 | Packages/OsaurusCore/Services/Router/OsaurusRouterIDTypes.swift:29-34 | Packages/OsaurusCore/Services/Router/OsaurusRouterTypes.swift:216-219 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×9
  • Duplicated block (21 lines × 2) Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:748 — Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:748-768 | Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:1629-1649 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:748` 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 (21 lines × 2) Packages/OsaurusCore/Managers/SkillManager.swift:1035 — Packages/OsaurusCore/Managers/SkillManager.swift:1035-1055 | Packages/OsaurusCore/Managers/SkillManager.swift:1067-1087 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Managers/SkillManager.swift:1035` 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, `Packages/OsaurusCore/Managers/SkillManager.swift:1066` calls `deletingLastPathComponent` and `Packages/OsaurusCore/Managers/SkillManager.swift:1034` 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 (21 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:5727 — Packages/OsaurusCore/Networking/HTTPHandler.swift:5727-5747 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6560-6580 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:5727` 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 (21 lines × 2) Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1552 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1552-1572 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1610-1630 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1552` 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 (21 lines × 2) Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:357 — Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:357-377 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppRPCClient.swift:439-459 — before extracting anything, compare `Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift` and `Packages/OsaurusCore/Services/WhatsApp/WhatsAppRPCClient.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 116 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 `Packages/OsaurusCore/Services/WhatsApp/WhatsAppRPCClient.swift:439` 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 (21 lines × 2) Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:188 — Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:188-208 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppWatchTransportRuntime.swift:167-187 — before extracting anything, compare `Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift` and `Packages/OsaurusCore/Services/WhatsApp/WhatsAppWatchTransportRuntime.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 88 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 `Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:188` 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 (21 lines × 2) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:103 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:103-123 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:121-141 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 368 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 `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:103` 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 (21 lines × 2) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:566 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:566-586 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:736-756 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 260 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 `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:566` 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 (21 lines × 2) Packages/OsaurusCore/Views/Settings/ServerView.swift:1572 — Packages/OsaurusCore/Views/Settings/ServerView.swift:1572-1592 | Packages/OsaurusCore/Views/Settings/ServerView.swift:1713-1733 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Settings/ServerView.swift:1572` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `spacing` to `theme.space.s8` in one and `theme.space.s6` 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 (19 lines × 2) · ×9
  • Duplicated block (19 lines × 2) Packages/OsaurusCore/Models/Plugin/ExternalPlugin.swift:650 — Packages/OsaurusCore/Models/Plugin/ExternalPlugin.swift:650-668 | Packages/OsaurusCore/Tools/ToolRegistry.swift:117-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 (19 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:3169 — Packages/OsaurusCore/Networking/HTTPHandler.swift:3169-3187 | Packages/OsaurusCore/Networking/HTTPHandler.swift:3209-3227 — both copies are in the same file, so extract the 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 (19 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:4749 — Packages/OsaurusCore/Networking/HTTPHandler.swift:4749-4767 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17469-17487 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:17469` 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 (19 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:17231 — Packages/OsaurusCore/Networking/HTTPHandler.swift:17231-17249 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17260-17278 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:17231` 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 (19 lines × 2) Packages/OsaurusCore/Services/Chat/ChatEngine.swift:1943 — Packages/OsaurusCore/Services/Chat/ChatEngine.swift:1943-1961 | Packages/OsaurusCore/Services/Chat/ChatEngine.swift:2125-2143 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Chat/ChatEngine.swift:1943` 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 (19 lines × 2) Packages/OsaurusCore/Services/Chat/GroundedFileSideEffectCheck.swift:117 — Packages/OsaurusCore/Services/Chat/GroundedFileSideEffectCheck.swift:117-135 | Packages/OsaurusCore/Services/Chat/GroundedKnowledgeClaimCheck.swift:166-184 — 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 `Packages/OsaurusCore/Services/Chat/GroundedFileSideEffectCheck.swift:117` 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 (19 lines × 2) Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift:266 — Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift:266-284 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppRuntimeAssets.swift:161-179 — before extracting anything, compare `Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift` and `Packages/OsaurusCore/Services/WhatsApp/WhatsAppRuntimeAssets.swift` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 92 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 `Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift:266` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Services/WhatsApp/WhatsAppRuntimeAssets.swift:182` calls `sameTeamTrust`, `verified` and `Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift:285` 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 (19 lines × 2) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1605 — Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1605-1623 | Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:2008-2026 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1605` 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 (19 lines × 2) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3809 — Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3809-3827 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3894-3912 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3914` calls `agentNodeWorkdir` and `Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3829` 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 lines × 4) · ×9
  • Duplicated block (7 lines × 4) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1832 — Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1832-1838 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1876-1882 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2119-2125 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2313-2319 — 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 `Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1832` 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) Packages/OsaurusCore/Networking/HTTPHandler.swift:5693 — Packages/OsaurusCore/Networking/HTTPHandler.swift:5693-5700 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6987-6993 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7128-7134 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7885-7891 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:5693` 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 × 4) Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:345 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:345-351 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:360-366 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:373-379 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:386-392 — 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 `Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:345` 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 × 4) Packages/OsaurusCore/Services/Email/EmailChannelService.swift:722 — Packages/OsaurusCore/Services/Email/EmailChannelService.swift:722-728 | Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1361-1367 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:1421-1427 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:1531-1537 — 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 `Packages/OsaurusCore/Services/Email/EmailChannelService.swift:722` 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 × 4) Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift:301 — Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift:301-307 | Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift:1101-1107 | Packages/OsaurusCore/Tools/Workflow/WorkflowDiscoverTool.swift:144-150 | Packages/OsaurusCore/Tools/Workflow/WorkflowRunsTool.swift:78-84 — 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 `Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift:301` 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) Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:313 — Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:313-319 | Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:391-397 | Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:468-474 | Packages/OsaurusCore/Views/Memory/MemoryManagementConsoleView.swift:626-632 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:466` calls `StatusChip`, `L` and `Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:312` 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 (7 lines × 4) Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:518 — Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:518-528 | Packages/OsaurusCore/Storage/FileHistoryDatabase.swift:88-94 | Packages/OsaurusCore/Storage/MethodDatabase.swift:90-100 | Packages/OsaurusCore/Storage/ToolDatabase.swift:145-155 — 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) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:22 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:22-28 | Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:27-33 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:26-32 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:22-28 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `connectionId` to `String = DiscordConnectionService.nativeConnectionId` in one and `String = AgentChannelConnection.nativeEmailConnectionId` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (7 lines × 4) helpers/osaurus-wa/bridge.go:768 — helpers/osaurus-wa/bridge.go:768-774 | helpers/osaurus-wa/bridge.go:779-785 | helpers/osaurus-wa/bridge.go:790-796 | helpers/osaurus-wa/bridge.go:800-806 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `helpers/osaurus-wa/bridge.go:807` calls `String`, `Base` and `helpers/osaurus-wa/bridge.go:775` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×9
  • Duplicated block (5 lines × 4) Packages/OsaurusCore/Browser/Runtime/BrowserSession.swift:661 — Packages/OsaurusCore/Browser/Runtime/BrowserSession.swift:661-665 | Packages/OsaurusCore/Browser/Runtime/BrowserSession.swift:686-690 | Packages/OsaurusCore/Browser/Runtime/BrowserSession.swift:729-733 | Packages/OsaurusCore/Browser/Runtime/BrowserSession.swift:762-766 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `selector` to `String?) async -> (success: Bool` in one and `String?` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Browser/Runtime/BrowserSession.swift:691` calls `replacingOccurrences` and `Packages/OsaurusCore/Browser/Runtime/BrowserSession.swift:666` 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 × 4) Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:134 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:134-138 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:149-153 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:344-348 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:361-365 — 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 `Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:134` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 4) Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2816 — Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2816-2820 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2862-2866 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2966-2970 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:3470-3474 — 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 `Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2816` 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 × 4) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ComputerUseScorecard.swift:439 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ComputerUseScorecard.swift:439-443 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCompat.swift:814-818 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalDiff.swift:578-582 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalMatrix.swift:1076-1080 — 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 (5 lines × 4) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalDiffMatrixCLI.swift:105 — Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalDiffMatrixCLI.swift:105-109 | Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalDiffMatrixCLI.swift:202-206 | Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalDiffMatrixCLI.swift:323-327 | Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/OsaurusEvalsCaptureScreenCLI.swift:404-408 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (5 lines × 4) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalReviewReportCLI.swift:730 — Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalReviewReportCLI.swift:730-734 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:630-634 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReviewReport.swift:988-992 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalScoreboard.swift:889-893 — 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) Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:237 — Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:237-241 | Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:815-819 | Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:869-873 | Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:983-987 — 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 `Packages/OsaurusCore/Models/API/OpenResponsesAPI.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:820` calls `decodeIfPresent` and `Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:242` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 4) Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:246 — Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:246-250 | Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:825-829 | Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:880-884 | Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:994-998 — 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 `Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:246` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:831` calls `encode` and `Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:252` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 4) Packages/OsaurusCore/Services/Documents/CSVAdapter.swift:86 — Packages/OsaurusCore/Services/Documents/CSVAdapter.swift:86-90 | Packages/OsaurusCore/Services/Documents/PlainTextAdapter.swift:25-29 | Packages/OsaurusCore/Services/Documents/RichDocumentAdapter.swift:26-30 | Packages/OsaurusCore/Services/Documents/XLSXAdapter.swift:28-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 all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Documents/CSVAdapter.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Services/Documents/RichDocumentAdapter.swift:32` calls `lowercased`, `RichDocumentSourceFormat`, `documentType` and `Packages/OsaurusCore/Services/Documents/PlainTextAdapter.swift:31` 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.
D30 · Dependency Vulnerabilities · Medium CVE · ×8
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (26 corresponding lines) · ×8
  • Edited copy of a member (26 corresponding lines) Packages/OsaurusCore/Services/Documents/WorkbookWorkflowService.swift:588 — Packages/OsaurusCore/Services/Documents/WorkbookWorkflowService.swift:588-620 | Packages/OsaurusCore/Services/Documents/XLSXEmitter.swift:325-354 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) Packages/OsaurusCore/Managers/RemoteProviderManager.swift:1682 — Packages/OsaurusCore/Managers/RemoteProviderManager.swift:1682-1911 | Packages/OsaurusCore/Models/Configuration/RemoteProviderConfiguration.swift:336-399 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:963 — Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:963-988 | Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:990-1019 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) Packages/OsaurusCore/Services/Router/WorkspaceAuditLog.swift:649 — Packages/OsaurusCore/Services/Router/WorkspaceAuditLog.swift:649-679 | Packages/OsaurusCore/Services/Router/WorkspaceAuditLog.swift:684-709 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:229 — Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:229-257 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppWatchTransportRuntime.swift:208-233 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) Packages/OsaurusCore/AppleApps/Mail/MailService.swift:592 — Packages/OsaurusCore/AppleApps/Mail/MailService.swift:592-624 | Packages/OsaurusCore/AppleApps/Notes/NotesService.swift:126-151 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) Packages/OsaurusCore/Services/ModelRuntime.swift:6548 — Packages/OsaurusCore/Services/ModelRuntime.swift:6548-6574 | Packages/OsaurusCore/Services/ModelRuntime.swift:6711-6736 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) App/osaurus/osaurusApp.swift:395 — App/osaurus/osaurusApp.swift:395-420 | Packages/OsaurusCore/Views/Settings/StatusPanelView.swift:417-444 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (36 corresponding lines) · ×8
  • Edited copy of a member (36 corresponding lines) Packages/OsaurusCore/AppleScript/Exec/AppleScriptExecutor.swift:375 — Packages/OsaurusCore/AppleScript/Exec/AppleScriptExecutor.swift:375-425 | Packages/OsaurusCore/AppleScript/Exec/AppleScriptExecutor.swift:432-483 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (36 corresponding lines) Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:608 — Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:608-648 | Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:650-685 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (36 corresponding lines) Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:351 — Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:351-386 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppRPCClient.swift:431-468 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (36 corresponding lines) helpers/osaurus-wa/bridge.go:1053 — helpers/osaurus-wa/bridge.go:1053-1091 | helpers/osaurus-wa/bridge.go:1097-1132 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (36 corresponding lines) Packages/OsaurusCore/Services/ToolPermissionPromptService.swift:486 — Packages/OsaurusCore/Services/ToolPermissionPromptService.swift:486-521 | Packages/OsaurusCore/Services/ToolPermissionPromptService.swift:527-568 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (36 corresponding lines) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:795 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:795-830 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:1087-1122 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (36 corresponding lines) Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:808 — Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:808-843 | Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:1683-1722 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (36 corresponding lines) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Config.swift:336 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Config.swift:336-371 | Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Import/ImportCommand.swift:800-850 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (29 corresponding lines) · ×8
  • Edited copy of a member (29 corresponding lines) Packages/OsaurusCore/Views/Agent/Templates/AgentTemplateSheets.swift:377 — Packages/OsaurusCore/Views/Agent/Templates/AgentTemplateSheets.swift:377-405 | Packages/OsaurusCore/Views/Workflow/Library/RenameInstalledWorkflowSheet.swift:26-77 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:1123 — Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:1123-1151 | Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:1184-1215 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:2459 — Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:2459-2487 | Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:1740-1772 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:675 — Packages/OsaurusCore/Views/Plugin/PluginsView.swift:675-703 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:2250-2281 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:80 — Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:80-108 | Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:97-128 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift:157 — Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift:157-185 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppHelperInstaller.swift:158-186 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) Packages/OsaurusCore/Models/Agent/SkillStore.swift:73 — Packages/OsaurusCore/Models/Agent/SkillStore.swift:73-101 | Packages/OsaurusCore/Models/Agent/SkillStore.swift:147-181 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) Packages/OsaurusCore/Views/Management/SharedSidebarComponents.swift:69 — Packages/OsaurusCore/Views/Management/SharedSidebarComponents.swift:69-100 | Packages/OsaurusCore/Views/Management/SharedSidebarComponents.swift:136-164 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (32 corresponding lines) · ×8
  • Edited copy of a member (32 corresponding lines) Packages/OsaurusCore/Views/Settings/ProvidersView.swift:856 — Packages/OsaurusCore/Views/Settings/ProvidersView.swift:856-887 | Packages/OsaurusCore/Views/Settings/ProvidersView.swift:894-941 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) Packages/OsaurusCore/Managers/RemoteProviderManager.swift:1914 — Packages/OsaurusCore/Managers/RemoteProviderManager.swift:1914-1945 | Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:7765-7807 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) Packages/OsaurusCore/Models/Configuration/ServerRuntimeSettingsStore.swift:611 — Packages/OsaurusCore/Models/Configuration/ServerRuntimeSettingsStore.swift:611-642 | Packages/OsaurusCore/Models/Configuration/ServerRuntimeSettingsStore.swift:650-681 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1203 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1203-1236 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1309-1340 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:1217 — Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:1217-1250 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:930-961 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) Packages/OsaurusCore/Services/Router/AnnouncementsService.swift:125 — Packages/OsaurusCore/Services/Router/AnnouncementsService.swift:125-159 | Packages/OsaurusCore/Services/Router/SupportService.swift:172-203 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:398 — Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:398-429 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:431-463 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) Packages/OsaurusCore/Models/API/OpenAIAPI.swift:964 — Packages/OsaurusCore/Models/API/OpenAIAPI.swift:964-995 | Packages/OsaurusCore/Models/API/OpenAIAPI.swift:997-1032 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 12+ corresponding lines) · ×8
  • Edited copies of one member (3 members, 12+ corresponding lines) Packages/OsaurusCore/Folder/FolderTools.swift:3185 — Packages/OsaurusCore/Folder/FolderTools.swift:3185-3200 | Packages/OsaurusCore/Tools/ConfigurationTools.swift:436-447 | Packages/OsaurusCore/Tools/ConfigurationTools.swift:733-747 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) Packages/OsaurusCore/Services/Memory/MemorySearchService.swift:248 — Packages/OsaurusCore/Services/Memory/MemorySearchService.swift:248-259 | Packages/OsaurusCore/Services/Memory/MemorySearchService.swift:261-274 | Packages/OsaurusCore/Services/Memory/MemorySearchService.swift:276-288 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) Packages/OsaurusCore/Browser/Runtime/BrowserSessionCatalog.swift:181 — Packages/OsaurusCore/Browser/Runtime/BrowserSessionCatalog.swift:181-195 | Packages/OsaurusCore/Models/Agent/AgentInviteStore.swift:236-247 | Packages/OsaurusCore/Models/Agent/RemoteAgentStore.swift:40-53 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) Packages/OsaurusCore/Services/DirectoryPickerService.swift:212 — Packages/OsaurusCore/Services/DirectoryPickerService.swift:212-228 | Packages/OsaurusCore/Views/Credits/CreditsView.swift:900-911 | Packages/OsaurusCore/Views/Router/RouterAccountUsageCenterView.swift:622-634 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) Packages/OsaurusCore/Models/Credentials/SignInSession.swift:91 — Packages/OsaurusCore/Models/Credentials/SignInSession.swift:91-102 | Packages/OsaurusCore/Models/Method/Method.swift:94-110 | Packages/OsaurusCore/Models/Task/TaskModels.swift:595-606 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) Packages/OsaurusCore/Storage/StorageMaintenance.swift:90 — Packages/OsaurusCore/Storage/StorageMaintenance.swift:90-101 | Packages/OsaurusCore/Storage/StorageMaintenance.swift:103-118 | Packages/OsaurusCore/Storage/StorageMaintenance.swift:120-135 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) Packages/OsaurusCore/Models/Workflow/WorkflowRun.swift:614 — Packages/OsaurusCore/Models/Workflow/WorkflowRun.swift:614-625 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:633-647 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ExperimentProfile.swift:44-58 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1313 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1313-1324 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:1157-1168 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1417-1428 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 11+ corresponding lines) · ×8
  • Edited copies of one member (3 members, 11+ corresponding lines) Packages/OsaurusCore/Views/Event/EventDetailView.swift:328 — Packages/OsaurusCore/Views/Event/EventDetailView.swift:328-341 | Packages/OsaurusCore/Views/Settings/ProvidersView.swift:1724-1737 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:861-871 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:940 — Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:940-950 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:963-979 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:1025-1035 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) Packages/OsaurusCore/Managers/Model/SpeechModelManager.swift:269 — Packages/OsaurusCore/Managers/Model/SpeechModelManager.swift:269-287 | Packages/OsaurusCore/Services/AgentDelegation/ChatResidencyHandoff.swift:275-289 | Packages/OsaurusCore/Utils/OsaurusPaths.swift:941-951 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) Packages/OsaurusCore/Views/Agent/CapabilitiesTableRepresentable.swift:163 — Packages/OsaurusCore/Views/Agent/CapabilitiesTableRepresentable.swift:163-173 | Packages/OsaurusCore/Views/Chat/MessageTableRepresentable.swift:497-510 | Packages/OsaurusCore/Views/Model/ModelPickerTableRepresentable.swift:211-221 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) Packages/OsaurusCore/Services/Sync/SyncHostRunner.swift:64 — Packages/OsaurusCore/Services/Sync/SyncHostRunner.swift:64-74 | Packages/OsaurusCore/Services/Sync/SyncManageFeed.swift:59-69 | Packages/OsaurusCore/Services/Sync/SyncServedChats.swift:186-196 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) Packages/OsaurusCore/Models/Task/TaskModels.swift:562 — Packages/OsaurusCore/Models/Task/TaskModels.swift:562-573 | Packages/OsaurusCore/Services/Context/SessionToolState.swift:71-87 | Packages/OsaurusCore/Services/Task/Workers/TaskWorker.swift:19-29 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) Packages/OsaurusCore/Views/Identity/AgentKeyManagement.swift:143 — Packages/OsaurusCore/Views/Identity/AgentKeyManagement.swift:143-153 | Packages/OsaurusCore/Views/Provider/ProviderCredentialPromptSheet.swift:463-473 | Packages/OsaurusCore/Views/Voice/VoiceSetupTab.swift:388-398 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) Packages/OsaurusCore/Models/Channels/ChannelIdentity.swift:90 — Packages/OsaurusCore/Models/Channels/ChannelIdentity.swift:90-104 | Packages/OsaurusCore/Models/Channels/ChannelIdentity.swift:171-183 | Packages/OsaurusCore/Models/Channels/ChannelIdentity.swift:250-260 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 5+ corresponding lines) · ×8
  • Edited copies of one member (3 members, 5+ corresponding lines) Packages/OsaurusCore/AppleApps/Support/AppleSchema.swift:37 — Packages/OsaurusCore/AppleApps/Support/AppleSchema.swift:37-41 | Packages/OsaurusCore/Tools/ToolOutputSchema.swift:34-38 | Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift:295-299 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 5+ corresponding lines) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Doctor.swift:149 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Doctor.swift:149-153 | Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:928-932 | Packages/OsaurusCore/Views/Settings/Shared/ChatModelRolePicker.swift:87-91 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 5+ corresponding lines) Packages/OsaurusCore/JSHost/main.swift:139 — Packages/OsaurusCore/JSHost/main.swift:139-144 | Packages/OsaurusCore/Services/Event/EventWebhookIngress.swift:141-146 | Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:3525-3529 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 5+ corresponding lines) Packages/OsaurusCore/Models/Chat/SharedArtifact.swift:938 — Packages/OsaurusCore/Models/Chat/SharedArtifact.swift:938-942 | Packages/OsaurusCore/Services/ExternalModelLocator.swift:1052-1058 | Packages/OsaurusCore/Tools/Database/DatabaseFilePathResolver.swift:341-345 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 5+ corresponding lines) Packages/OsaurusCore/Folder/DocumentTextExtractionCache.swift:198 — Packages/OsaurusCore/Folder/DocumentTextExtractionCache.swift:198-202 | Packages/OsaurusCore/Services/Chat/FollowUpSuggestionService.swift:208-213 | Packages/OsaurusCore/Services/Documents/OOXML/DOCXEditor.swift:483-487 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 5+ corresponding lines) Packages/OsaurusCore/Views/Sandbox/SandboxView.swift:368 — Packages/OsaurusCore/Views/Sandbox/SandboxView.swift:368-372 | Packages/OsaurusCore/Views/Settings/ComputerUseSettingsView.swift:739-744 | Packages/OsaurusCore/Views/Settings/ScreenContextPreview.swift:148-153 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 5+ corresponding lines) Packages/OsaurusCore/PrivacyFilter/Model/PrivacyFilterModelBundle.swift:53 — Packages/OsaurusCore/PrivacyFilter/Model/PrivacyFilterModelBundle.swift:53-57 | Packages/OsaurusCore/PrivacyFilter/Rampart/RampartModelManager.swift:57-61 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppRuntimeAssets.swift:92-96 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 5+ corresponding lines) Packages/OsaurusCore/Services/Context/CapabilityClaimsEvaluator.swift:45 — Packages/OsaurusCore/Services/Context/CapabilityClaimsEvaluator.swift:45-49 | Packages/OsaurusCore/Services/Router/OsaurusRouterWorkspaceTypes.swift:1004-1008 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:658-662 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×8
  • Duplicated block (22 lines × 2) Packages/OsaurusCore/Folder/FolderTools.swift:2834 — Packages/OsaurusCore/Folder/FolderTools.swift:2834-2855 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2299-2320 — 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 (22 lines × 2) Packages/OsaurusCore/Managers/RemoteProviderManager.swift:1744 — Packages/OsaurusCore/Managers/RemoteProviderManager.swift:1744-1765 | Packages/OsaurusCore/Models/Configuration/RemoteProviderConfiguration.swift:349-370 — 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 `Packages/OsaurusCore/Managers/RemoteProviderManager.swift:1744` 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 (22 lines × 2) Packages/OsaurusCore/Models/Agent/AgentStore.swift:636 — Packages/OsaurusCore/Models/Agent/AgentStore.swift:636-657 | Packages/OsaurusCore/Models/Agent/AgentStore.swift:672-693 — both copies are in the same file, so extract the 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 (22 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:12539 — Packages/OsaurusCore/Networking/HTTPHandler.swift:12539-12560 | Packages/OsaurusCore/Networking/HTTPHandler.swift:13042-13063 — both copies are in the same file, so extract the 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 (22 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:14854 — Packages/OsaurusCore/Networking/HTTPHandler.swift:14854-14875 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14902-14923 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:14854` 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 (22 lines × 2) Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1767 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1767-1788 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1794-1815 — both copies are in the same file, so extract the 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 (22 lines × 2) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:643 — Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:643-664 | Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:836-857 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:666` calls `validateCompleteOutput` and `Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:859` 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 (22 lines × 2) Packages/OsaurusCore/Views/Workflow/FlowViewer/WorkflowFlowStyle.swift:12 — Packages/OsaurusCore/Views/Workflow/FlowViewer/WorkflowFlowStyle.swift:12-33 | Packages/OsaurusCore/Views/Workflow/WorkflowSummary.swift:123-144 — 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 (17–18 lines × 2) · ×8
  • Duplicated block (17–18 lines × 2) Packages/OsaurusCore/Identity/MasterKey.swift:405 — Packages/OsaurusCore/Identity/MasterKey.swift:405-421 | Packages/OsaurusCore/Identity/MasterMnemonicStore.swift:82-99 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (17–18 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:12606 — Packages/OsaurusCore/Networking/HTTPHandler.swift:12606-12623 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12654-12670 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:12606` 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 (17–18 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:16916 — Packages/OsaurusCore/Networking/HTTPHandler.swift:16916-16933 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16987-17003 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:16916` 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–18 lines × 2) Packages/OsaurusCore/Services/Documents/PDFAdapter.swift:801 — Packages/OsaurusCore/Services/Documents/PDFAdapter.swift:801-817 | Packages/OsaurusCore/Services/Documents/RichDocumentAdapter.swift:386-403 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (17–18 lines × 2) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1276 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1276-1293 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:1443-1459 — 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 `Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1276` 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 (17–18 lines × 2) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:710 — Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:710-727 | Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:909-925 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:710` 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 (17–18 lines × 2) Packages/OsaurusCore/Views/Model/ModelCacheInspectorView.swift:248 — Packages/OsaurusCore/Views/Model/ModelCacheInspectorView.swift:248-265 | Packages/OsaurusCore/Views/Model/ModelCacheInspectorView.swift:307-323 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Model/ModelCacheInspectorView.swift:248` 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 (17–18 lines × 2) Packages/OsaurusCore/Views/Plugin/ClaudePluginUserConfigSheet.swift:67 — Packages/OsaurusCore/Views/Plugin/ClaudePluginUserConfigSheet.swift:67-83 | Packages/OsaurusCore/Views/Plugin/ToolSecretsSheet.swift:96-113 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (14–16 lines × 2) · ×8
  • Duplicated block (14–16 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:16023 — Packages/OsaurusCore/Networking/HTTPHandler.swift:16023-16038 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16311-16324 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:16023` 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–16 lines × 2) Packages/OsaurusCore/Services/Context/ResponsesEvaluationStep.swift:60 — Packages/OsaurusCore/Services/Context/ResponsesEvaluationStep.swift:60-75 | Packages/OsaurusCore/Services/Plugin/PluginResponsesCompatibility.swift:27-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 `Packages/OsaurusCore/Services/Context/ResponsesEvaluationStep.swift:60` 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–16 lines × 2) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1675 — Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1675-1688 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2089-2104 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1675` 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–16 lines × 2) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5117 — Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5117-5132 | Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5145-5158 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5117` 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 (14–16 lines × 2) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5302 — Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5302-5317 | Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5325-5338 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14–16 lines × 2) Packages/OsaurusCore/Views/Chat/SelectableTextView.swift:114 — Packages/OsaurusCore/Views/Chat/SelectableTextView.swift:114-129 | Packages/OsaurusCore/Views/Chat/SelectableTextView.swift:151-164 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14–16 lines × 2) Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:356 — Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:356-369 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:621-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. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:621` 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–16 lines × 2) Packages/OsaurusCore/Views/Workflow/Library/WorkflowBundleSetupView.swift:169 — Packages/OsaurusCore/Views/Workflow/Library/WorkflowBundleSetupView.swift:169-182 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowSetupWizardView.swift:255-270 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Workflow/Library/WorkflowBundleSetupView.swift:169` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×8
  • Duplicated block (11–12 lines × 2) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:1795 — Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:1795-1805 | Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:1884-1895 — both copies are in the same file, so extract the 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–12 lines × 2) Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift:1443 — Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift:1443-1454 | Packages/OsaurusCore/Services/Context/CapabilityClaimsEvaluator.swift:661-671 — 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 `Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift:1443` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11–12 lines × 2) Packages/OsaurusCore/Services/ModelRuntime/ModelCapabilityLedger.swift:136 — Packages/OsaurusCore/Services/ModelRuntime/ModelCapabilityLedger.swift:136-147 | Packages/OsaurusCore/Services/ModelRuntime/ModelPrefillTuningStore.swift:69-79 — 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 `Packages/OsaurusCore/Services/ModelRuntime/ModelCapabilityLedger.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. 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–12 lines × 2) Packages/OsaurusCore/Views/DesignSystem/SettingsAbilityRow.swift:39 — Packages/OsaurusCore/Views/DesignSystem/SettingsAbilityRow.swift:39-49 | Packages/OsaurusCore/Views/DesignSystem/SettingsAbilityRow.swift:155-166 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/DesignSystem/SettingsAbilityRow.swift:39` 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 (11–12 lines × 2) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:681 — Packages/OsaurusCore/Views/Plugin/PluginsView.swift:681-692 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:2260-2270 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Plugin/PluginsView.swift:681` 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 (11–12 lines × 2) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:284 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:284-295 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:268-278 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 680 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 `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:284` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11–12 lines × 2) Packages/OsaurusCore/Views/Settings/ServerView.swift:1486 — Packages/OsaurusCore/Views/Settings/ServerView.swift:1486-1497 | Packages/OsaurusCore/Views/Settings/ServerView.swift:1610-1620 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Settings/ServerView.swift:1486` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11–12 lines × 2) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReviewReport.swift:525 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReviewReport.swift:525-535 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalScoreboard.swift:228-239 — 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 `Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReviewReport.swift:525` 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 (10 lines × 3) · ×8
  • Duplicated block (10 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:12895 — Packages/OsaurusCore/Networking/HTTPHandler.swift:12895-12904 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12972-12981 | Packages/OsaurusCore/Networking/HTTPHandler.swift:13063-13072 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:12895` 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 × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:13727 — Packages/OsaurusCore/Networking/HTTPHandler.swift:13727-13736 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14446-14455 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14509-14518 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:13727` 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 `path` to `"/images/generations"` in one and `"/images/edits"` 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 (10 lines × 3) Packages/OsaurusCore/Storage/MemoryDatabase.swift:1565 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:1565-1574 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:1980-1989 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2465-2474 — 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 `Packages/OsaurusCore/Storage/MemoryDatabase.swift:1565` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 3) Packages/OsaurusCore/Views/Event/ChannelRoutingSection.swift:120 — Packages/OsaurusCore/Views/Event/ChannelRoutingSection.swift:120-129 | Packages/OsaurusCore/Views/Plugin/GitHubTokenViews.swift:165-174 | Packages/OsaurusCore/Views/Plugin/GitHubTokenViews.swift:198-207 — 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 `Packages/OsaurusCore/Views/Event/ChannelRoutingSection.swift:120` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Views/Event/ChannelRoutingSection.swift:130` calls `fixedSize` and `Packages/OsaurusCore/Views/Plugin/GitHubTokenViews.swift:208` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 3) Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:310 — Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:310-319 | Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:388-397 | Packages/OsaurusCore/Views/Memory/MemoryManagementConsoleView.swift:623-632 — 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 `Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:310` 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 × 3) Packages/OsaurusCore/Views/Plugin/ClaudePluginUserConfigSheet.swift:72 — Packages/OsaurusCore/Views/Plugin/ClaudePluginUserConfigSheet.swift:72-81 | Packages/OsaurusCore/Views/Plugin/ToolSecretsSheet.swift:102-111 | Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:415-424 — 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 `Packages/OsaurusCore/Views/Plugin/ClaudePluginUserConfigSheet.swift:72` 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) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCompat.swift:722 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCompat.swift:722-731 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCompat.swift:765-774 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalMatrix.swift:789-798 — 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 (10 lines × 3) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1297 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1297-1306 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:1299-1308 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:1463-1472 — 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 `config` to `IMessageConnectionConfiguration` in one and `TelegramConnectionConfiguration` 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 (5 lines × 3) · ×8
  • Duplicated block (5 lines × 3) Packages/OsaurusCore/PrivacyFilter/Views/PrivacyCustomRuleEditor.swift:211 — Packages/OsaurusCore/PrivacyFilter/Views/PrivacyCustomRuleEditor.swift:211-218 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:1047-1051 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:1998-2002 — 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 `Packages/OsaurusCore/PrivacyFilter/Views/PrivacyCustomRuleEditor.swift:211` 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) Packages/OsaurusCore/Services/Import/PendingImportProcessor.swift:610 — Packages/OsaurusCore/Services/Import/PendingImportProcessor.swift:610-614 | Packages/OsaurusCore/Services/Import/PendingImportProcessor.swift:630-634 | Packages/OsaurusCore/Services/Import/PendingImportProcessor.swift:657-661 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 3) Packages/OsaurusCore/Services/Method/MethodSearchService.swift:260 — Packages/OsaurusCore/Services/Method/MethodSearchService.swift:260-264 | Packages/OsaurusCore/Services/Skill/SkillSearchService.swift:356-360 | Packages/OsaurusCore/Services/Tool/ToolSearchService.swift:896-900 — before extracting anything, compare `Packages/OsaurusCore/Services/Method/MethodSearchService.swift` and `Packages/OsaurusCore/Services/Skill/SkillSearchService.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 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 `Packages/OsaurusCore/Services/Method/MethodSearchService.swift:260` 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) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:390 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:390-394 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReviewReport.swift:649-653 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalScoreboard.swift:255-259 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (5 lines × 3) Packages/OsaurusCore/Browser/Runtime/BrowserSupport.swift:40 — Packages/OsaurusCore/Browser/Runtime/BrowserSupport.swift:40-44 | Packages/OsaurusCore/Browser/Runtime/BrowserSupport.swift:50-54 | Packages/OsaurusCore/Storage/PluginDatabase.swift:430-434 — 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 `Packages/OsaurusCore/Browser/Runtime/BrowserSupport.swift:40` 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) Packages/OsaurusCore/Configuration/Declarative/ConfigChannelDetails.swift:111 — Packages/OsaurusCore/Configuration/Declarative/ConfigChannelDetails.swift:111-115 | Packages/OsaurusCore/Configuration/Declarative/ConfigChannelDetails.swift:119-123 | Packages/OsaurusCore/Configuration/Declarative/ConfigChannelDetails.swift:127-131 — 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 (5 lines × 3) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2175 — Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2175-2179 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2181-2185 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2208-2212 — 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 `Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2175` 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) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1056 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1056-1060 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:750-754 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1153-1157 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 237 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.
D10 · Test Quality · Skipped test · ×7
  • Skipped test: testModelSearchFunctionality App/osaurusUITests/osaurusUITests.swift:34 — Skipped — throws XCTSkip
  • Skipped test: testExtractFromDylibWithoutEntryPointThrowsMissingEntryPoint Packages/OsaurusCLI/Tests/OsaurusCLITests/ManifestExtractTests.swift:63 — Skipped — throws XCTSkip
  • Skipped test: testLiveDiscoveryAgainstRealServer Packages/OsaurusCore/Tests/MCPOAuth/MCPOAuthDiscoveryTests.swift:260 — Skipped — throws XCTSkip
  • Skipped test: testRealTypePathInsertsTextOnce Packages/OsaurusCore/Tests/ComputerUse/Driver/BackgroundDriverLiveInputTests.swift:23 — Skipped — throws XCTSkip
  • Skipped test: testSlackEmptyAXEscalatesToVision Packages/OsaurusCore/Tests/ComputerUse/Driver/NativeMacDriverLiveTests.swift:171 — Skipped — throws XCTSkip
  • Skipped test: testIgnoresSelf Packages/OsaurusCore/Tests/ComputerUse/Perception/FrontmostAppTrackerTests.swift:25 — Skipped — throws XCTSkip
  • Skipped test: testRecordsNonSelfAppNameAndPid Packages/OsaurusCore/Tests/ComputerUse/Perception/FrontmostAppTrackerTests.swift:40 — Skipped — throws XCTSkip
D4 · Code Duplication · Edited copy of a member (33 corresponding lines) · ×7
  • Edited copy of a member (33 corresponding lines) Packages/OsaurusCore/Views/Template/PublishedWorkflowDashboard.swift:708 — Packages/OsaurusCore/Views/Template/PublishedWorkflowDashboard.swift:708-743 | Packages/OsaurusCore/Views/Template/ShareWorkflowSheet.swift:463-495 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) Packages/OsaurusCore/Services/ModelRuntime.swift:1520 — Packages/OsaurusCore/Services/ModelRuntime.swift:1520-1552 | Packages/OsaurusCore/Services/ModelRuntime.swift:1573-1607 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) Packages/OsaurusCore/Views/Agent/AgentsView.swift:3912 — Packages/OsaurusCore/Views/Agent/AgentsView.swift:3912-3951 | Packages/OsaurusCore/Views/Agent/AgentsView.swift:3954-3986 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) Packages/OsaurusCore/Views/Project/ProjectsView.swift:364 — Packages/OsaurusCore/Views/Project/ProjectsView.swift:364-396 | Packages/OsaurusCore/Views/Settings/OrchestratorSupportSections.swift:148-186 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) Packages/OsaurusCore/Services/Inference/CoreModelService.swift:312 — Packages/OsaurusCore/Services/Inference/CoreModelService.swift:312-349 | Packages/OsaurusCore/Services/Inference/CoreModelService.swift:358-390 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) Packages/OsaurusCore/Views/Event/EventFormComponents.swift:317 — Packages/OsaurusCore/Views/Event/EventFormComponents.swift:317-349 | Packages/OsaurusCore/Views/Event/EventFormComponents.swift:421-453 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:774 — Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:774-806 | Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:816-850 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 14+ corresponding lines) · ×7
  • Edited copies of one member (3 members, 14+ corresponding lines) Packages/OsaurusCore/Views/Model/Catalog/AppleScriptCatalogSource.swift:30 — Packages/OsaurusCore/Views/Model/Catalog/AppleScriptCatalogSource.swift:30-43 | Packages/OsaurusCore/Views/Model/Catalog/ImageCatalogSource.swift:44-62 | Packages/OsaurusCore/Views/Model/Catalog/PrivacyDetectionCatalogSource.swift:35-51 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) Packages/OsaurusCore/Managers/Chat/ChatSessionsManager.swift:259 — Packages/OsaurusCore/Managers/Chat/ChatSessionsManager.swift:259-279 | Packages/OsaurusCore/Managers/Chat/ChatSessionsManager.swift:337-351 | Packages/OsaurusCore/Managers/Chat/ChatSessionsManager.swift:356-369 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) Packages/OsaurusCore/Views/Agent/RemoteAgentViews.swift:525 — Packages/OsaurusCore/Views/Agent/RemoteAgentViews.swift:525-538 | Packages/OsaurusCore/Views/Memory/MemoryManagementConsoleView.swift:374-391 | Packages/OsaurusCore/Views/Memory/MemoryManagementConsoleView.swift:720-734 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) Packages/OsaurusCore/Views/Event/EventFormComponents.swift:351 — Packages/OsaurusCore/Views/Event/EventFormComponents.swift:351-364 | Packages/OsaurusCore/Views/Event/EventFormComponents.swift:397-410 | Packages/OsaurusCore/Views/Event/EventFormComponents.swift:455-469 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) Packages/OsaurusCore/Storage/AgentDatabase.swift:2633 — Packages/OsaurusCore/Storage/AgentDatabase.swift:2633-2660 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:1183-1197 | Packages/OsaurusCore/Storage/SchedulerDatabase.swift:652-665 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:648 — Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:648-661 | Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:337-350 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2677-2693 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:599 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:599-614 | Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:616-631 | Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:633-646 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 9+ corresponding lines) · ×7
  • Edited copies of one member (3 members, 9+ corresponding lines) Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:315 — Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:315-332 | Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:344-352 | Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:354-362 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) Packages/OsaurusCore/Identity/CryptoHelpers.swift:314 — Packages/OsaurusCore/Identity/CryptoHelpers.swift:314-324 | Packages/OsaurusCore/Services/Auth/PKCE.swift:63-71 | Packages/OsaurusCore/Services/Channels/ChannelSecurityEncoding.swift:18-28 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) Packages/OsaurusCore/Views/Chat/OnboardingPanelView.swift:112 — Packages/OsaurusCore/Views/Chat/OnboardingPanelView.swift:112-122 | Packages/OsaurusCore/Views/Workflow/Architect/ArchitectSidebarPanel.swift:453-461 | Packages/OsaurusCore/Views/Workflow/FlowViewer/WorkflowFlowCanvas.swift:1104-1114 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) Packages/OsaurusCore/Storage/AgentDatabase.swift:2263 — Packages/OsaurusCore/Storage/AgentDatabase.swift:2263-2278 | Packages/OsaurusCore/Storage/RouterBillingDatabase.swift:344-352 | Packages/OsaurusCore/Storage/TaskDatabase.swift:683-691 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) Packages/OsaurusCore/Views/Settings/AgentChannelSettingsComponents.swift:934 — Packages/OsaurusCore/Views/Settings/AgentChannelSettingsComponents.swift:934-945 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowsPaneView.swift:374-382 | Packages/OsaurusCore/Views/Workflow/WorkflowRunHistoryList.swift:385-393 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5820 — Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5820-5830 | Packages/OsaurusCore/Views/Chat/MarkdownImageView.swift:271-279 | Packages/OsaurusCore/Views/Memory/MemoryManagementConsoleView.swift:589-603 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) Packages/OsaurusCore/Models/Configuration/ModelFamilyNames.swift:111 — Packages/OsaurusCore/Models/Configuration/ModelFamilyNames.swift:111-120 | Packages/OsaurusCore/Services/ModelRuntime.swift:8502-8510 | Packages/OsaurusCore/Services/ModelRuntime.swift:8512-8520 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×7
  • Duplicated block (12 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:14008 — Packages/OsaurusCore/Networking/HTTPHandler.swift:14008-14019 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14108-14119 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14539-14550 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:14008` 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) Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1008 — Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1008-1019 | Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1151-1162 | Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:275-286 — 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 `Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1008` 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, `Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:289` calls `pruneToRetentionLimit` and `Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1022` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 3) Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:301 — Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:301-312 | Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:379-390 | Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:453-464 — 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 `Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:301` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:466` calls `StatusChip`, `L` and `Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:313` 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 (12 lines × 3) Packages/OsaurusCore/Views/Settings/AgentChannelCustomConnectionSheet.swift:735 — Packages/OsaurusCore/Views/Settings/AgentChannelCustomConnectionSheet.swift:735-746 | Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:635-646 | Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:756-767 — 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 `Packages/OsaurusCore/Views/Settings/AgentChannelCustomConnectionSheet.swift:735` 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, `Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:634` calls `padding` and `Packages/OsaurusCore/Views/Settings/AgentChannelCustomConnectionSheet.swift:734` 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 (12 lines × 3) Packages/OsaurusCore/Views/Skill/SkillEditorSheet.swift:182 — Packages/OsaurusCore/Views/Skill/SkillEditorSheet.swift:182-193 | Packages/OsaurusCore/Views/Skill/SkillEditorSheet.swift:216-227 | Packages/OsaurusCore/Views/Skill/SkillEditorSheet.swift:246-260 — 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 `Packages/OsaurusCore/Views/Skill/SkillEditorSheet.swift:182` 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) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReport.swift:975 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReport.swift:975-986 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReport.swift:988-999 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReport.swift:1001-1012 — 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 (12 lines × 3) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:1784 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:1784-1795 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerComputerUseLoop.swift:118-129 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:573-584 — 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 `Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:1784` 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 (10–11 lines × 2) · ×7
  • Duplicated block (10–11 lines × 2) Packages/OsaurusCore/AppleScript/Loop/AppleScriptTraceLog.swift:80 — Packages/OsaurusCore/AppleScript/Loop/AppleScriptTraceLog.swift:80-90 | Packages/OsaurusCore/ComputerUse/Loop/ComputerUseTraceLog.swift:72-81 — before extracting anything, compare `Packages/OsaurusCore/AppleScript/Loop/AppleScriptTraceLog.swift` and `Packages/OsaurusCore/ComputerUse/Loop/ComputerUseTraceLog.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 45 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 `Packages/OsaurusCore/AppleScript/Loop/AppleScriptTraceLog.swift:80` 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–11 lines × 2) Packages/OsaurusCore/Services/Auth/ConsentPanelPresenter.swift:65 — Packages/OsaurusCore/Services/Auth/ConsentPanelPresenter.swift:65-74 | Packages/OsaurusCore/Services/ToolPermissionPromptService.swift:861-871 — 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 `Packages/OsaurusCore/Services/ToolPermissionPromptService.swift:861` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Packages/OsaurusCore/Services/ToolPermissionPromptService.swift:858` calls `NSAppearance` and `Packages/OsaurusCore/Services/Auth/ConsentPanelPresenter.swift:64` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10–11 lines × 2) Packages/OsaurusCore/Services/MCP/MCPServerHub.swift:157 — Packages/OsaurusCore/Services/MCP/MCPServerHub.swift:157-167 | Packages/OsaurusCore/Services/Provider/ProviderConnectivityCenter.swift:226-235 — before extracting anything, compare `Packages/OsaurusCore/Services/MCP/MCPServerHub.swift` and `Packages/OsaurusCore/Services/Provider/ProviderConnectivityCenter.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `Packages/OsaurusCore/Services/MCP/MCPServerHub.swift:157` 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–11 lines × 2) Packages/OsaurusCore/Views/Agent/AgentsView.swift:5618 — Packages/OsaurusCore/Views/Agent/AgentsView.swift:5618-5628 | Packages/OsaurusCore/Views/Settings/OrchestratorSupportSections.swift:198-207 — 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 (10–11 lines × 2) Packages/OsaurusCore/Views/Knowledge/KnowledgeView.swift:1545 — Packages/OsaurusCore/Views/Knowledge/KnowledgeView.swift:1545-1554 | Packages/OsaurusCore/Views/Knowledge/KnowledgeView.swift:1833-1843 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Knowledge/KnowledgeView.swift:1833` 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) Packages/OsaurusCore/Views/Voice/TranscriptionSettingsTab.swift:361 — Packages/OsaurusCore/Views/Voice/TranscriptionSettingsTab.swift:361-370 | Packages/OsaurusCore/Views/Voice/VADModeSettingsTab.swift:358-368 — 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 `Packages/OsaurusCore/Views/Voice/TranscriptionSettingsTab.swift:361` 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) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:256 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:256-266 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalDiff.swift:221-230 — 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 `Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:256` 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 lines × 4) · ×7
  • Duplicated block (9 lines × 4) Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:181 — Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:181-189 | Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:214-222 | Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:241-249 | Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:276-284 — 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 `Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:181` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:191` calls `boolean` and `Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:224` 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 × 4) Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:479 — Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:479-487 | Packages/OsaurusCore/Tools/Workflow/WorkflowDiscoverTool.swift:497-505 | Packages/OsaurusCore/Views/Workflow/FlowViewer/WorkflowFlowStyle.swift:15-23 | Packages/OsaurusCore/Views/Workflow/WorkflowSummary.swift:126-134 — 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 `Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:479` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 4) Packages/OsaurusCore/Networking/HTTPHandler.swift:10159 — Packages/OsaurusCore/Networking/HTTPHandler.swift:10159-10167 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16912-16920 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16983-16991 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17329-17337 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:10159` 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 × 4) Packages/OsaurusCore/Views/Agent/AgentsView.swift:5613 — Packages/OsaurusCore/Views/Agent/AgentsView.swift:5613-5621 | Packages/OsaurusCore/Views/Agent/Setup/AgentSetupWizardView.swift:556-564 | Packages/OsaurusCore/Views/Project/ProjectsView.swift:399-407 | Packages/OsaurusCore/Views/Settings/OrchestratorSupportSections.swift:193-201 — 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 `Packages/OsaurusCore/Views/Agent/AgentsView.swift:5613` 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 × 4) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:693 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:693-701 | Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1359-1367 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:1182-1190 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1463-1471 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 138 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 (9 lines × 4) Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:260 — Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:260-268 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:281-289 | Packages/OsaurusCore/Storage/MethodDatabase.swift:131-139 | Packages/OsaurusCore/Storage/ToolDatabase.swift:187-195 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Packages/OsaurusCore/Storage/ToolDatabase.swift:184` calls `migrateToV2` and `Packages/OsaurusCore/Storage/MethodDatabase.swift:128` 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 × 4) Packages/OsaurusCore/Views/Settings/ArchitectSettingsView.swift:235 — Packages/OsaurusCore/Views/Settings/ArchitectSettingsView.swift:235-243 | Packages/OsaurusCore/Views/Settings/ChatSettingsView.swift:360-368 | Packages/OsaurusCore/Views/Settings/ConfigurationView.swift:359-367 | Packages/OsaurusCore/Views/Settings/OrchestratorSettingsView.swift:257-265 — 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.
PF3 · Async & latency hygiene · Sync-over-async blocking · ×7
  • Sync-over-async blocking Packages/OsaurusCLI/Sources/OsaurusCLICore/Services/AppControl.swift:23 — `launchAppIfNeeded` is async and calls .waitUntilExit() — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs.
  • Sync-over-async blocking Packages/OsaurusCore/Models/Plugin/ExternalPlugin.swift:865 — `shutdown` is async and calls .wait() — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs.
  • Sync-over-async blocking Packages/OsaurusCore/Services/AgentChannel/AgentChannelTransportRuntime.swift:80 — `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.
  • Sync-over-async blocking Packages/OsaurusCore/Services/Workflow/CodeNodeExecutor.swift:423 — `readUntilDone` is async and calls .waitUntilExit() — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs.
  • Sync-over-async blocking Packages/OsaurusCore/Services/Workflow/WorkflowNodeExecutor.swift:247 — `execute` is async and calls .wait() — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs.
  • Sync-over-async blocking Packages/OsaurusCore/Views/Onboarding/Stage/OnboardingScene.swift:69 — `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.
  • Sync-over-async blocking docs/examples/login-with-osaurus/server.ts:119 — `readFileSync` in `callback to createServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×6
  • Members sharing a duplicated core (6 members, 50+ identical tokens) Packages/OsaurusCore/Models/Chat/RequestLog.swift:183 — Packages/OsaurusCore/Models/Chat/RequestLog.swift:183-202 | Packages/OsaurusCore/Models/Chat/RequestLog.swift:204-223 | Packages/OsaurusCore/Models/Chat/SessionSource.swift:83-115 | Packages/OsaurusCore/Models/Chat/SessionSource.swift:129-145 | Packages/OsaurusCore/Models/Chat/SessionSource.swift:148-164 | Packages/OsaurusCore/Services/FeatureTelemetry.swift:1094-1113 — These 6 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 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.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) Packages/OsaurusCore/Networking/HTTPHandler.swift:1572 — Packages/OsaurusCore/Networking/HTTPHandler.swift:1572-1860 | Packages/OsaurusCore/Networking/HTTPHandler.swift:1866-1931 | Packages/OsaurusCore/Networking/HTTPHandler.swift:1939-2005 | Packages/OsaurusCore/Networking/HTTPHandler.swift:2013-2271 | Packages/OsaurusCore/Networking/HTTPHandler.swift:2307-2630 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16724-16907 — These 6 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 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.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) Packages/OsaurusCore/Services/Chat/Routing/AgentWrapperCatalog.swift:83 — Packages/OsaurusCore/Services/Chat/Routing/AgentWrapperCatalog.swift:83-94 | Packages/OsaurusCore/Services/Method/MethodSearchService.swift:258-271 | Packages/OsaurusCore/Services/Skill/SkillSearchService.swift:354-367 | Packages/OsaurusCore/Services/Sync/SyncConversationMapper.swift:167-178 | Packages/OsaurusCore/Services/Tool/ToolSearchService.swift:894-907 | Packages/OsaurusCore/Utils/TextSimilarity.swift:61-74 — These 6 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 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.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:96 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:96-177 | Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:97-186 | Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:112-183 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:109-204 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:114-195 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:121-191 — These 6 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 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.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:453 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:453-491 | Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:605-659 | Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1011-1049 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:531-571 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:616-654 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1108-1146 — These 6 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 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.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:973 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:973-990 | Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:884-901 | Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1328-1345 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:1294-1311 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:1017-1034 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1432-1449 — These 6 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 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 · Edited copy of a member (39 corresponding lines) · ×6
  • Edited copy of a member (39 corresponding lines) Packages/OsaurusCore/Views/Router/RouterAccountUsageCenterView.swift:387 — Packages/OsaurusCore/Views/Router/RouterAccountUsageCenterView.swift:387-425 | Packages/OsaurusCore/Views/Workspaces/WorkspacePoolActivityView.swift:172-216 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (39 corresponding lines) Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:557 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:557-595 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:674-733 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (39 corresponding lines) Packages/OsaurusCore/Models/Chat/ChatTurnData.swift:310 — Packages/OsaurusCore/Models/Chat/ChatTurnData.swift:310-348 | Packages/OsaurusCore/Models/Chat/ChatTurnData.swift:353-395 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (39 corresponding lines) Packages/OsaurusCore/Services/MCP/MCPServerHub.swift:197 — Packages/OsaurusCore/Services/MCP/MCPServerHub.swift:197-239 | Packages/OsaurusCore/Services/Provider/ProviderConnectivityCenter.swift:322-360 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (39 corresponding lines) Packages/OsaurusCore/Views/Workflow/SavedAnswersSection.swift:46 — Packages/OsaurusCore/Views/Workflow/SavedAnswersSection.swift:46-84 | Packages/OsaurusCore/Views/Workflow/WorkflowStoredDataSection.swift:37-75 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (39 corresponding lines) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:2918 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:2918-2956 | Packages/OsaurusRepository/ImportQueue.swift:190-230 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (34 corresponding lines) · ×6
  • Edited copy of a member (34 corresponding lines) Packages/OsaurusCore/Views/Agent/Database/DatabaseSavedViewsView.swift:116 — Packages/OsaurusCore/Views/Agent/Database/DatabaseSavedViewsView.swift:116-149 | Packages/OsaurusCore/Views/Agent/Database/DatabaseTablesView.swift:254-287 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (34 corresponding lines) Packages/OsaurusCore/Services/Context/MemoryRecallEvaluator.swift:149 — Packages/OsaurusCore/Services/Context/MemoryRecallEvaluator.swift:149-188 | Packages/OsaurusCore/Services/Context/ReasoningChannelEvaluator.swift:111-144 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (34 corresponding lines) Packages/OsaurusCore/Views/Agent/AgentReorderSheet.swift:18 — Packages/OsaurusCore/Views/Agent/AgentReorderSheet.swift:18-51 | Packages/OsaurusCore/Views/Settings/RemoteProviderReorderSheet.swift:18-51 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (34 corresponding lines) Packages/OsaurusCore/Views/Agent/AgentsView.swift:3482 — Packages/OsaurusCore/Views/Agent/AgentsView.swift:3482-3515 | Packages/OsaurusCore/Views/Knowledge/KnowledgeView.swift:1532-1566 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (34 corresponding lines) Packages/OsaurusCore/Models/Schedule/Schedule.swift:544 — Packages/OsaurusCore/Models/Schedule/Schedule.swift:544-577 | Packages/OsaurusCore/Models/Watcher/Watcher.swift:135-168 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (34 corresponding lines) Packages/OsaurusCore/Services/AgentBridge/LocalAgentBridge.swift:108 — Packages/OsaurusCore/Services/AgentBridge/LocalAgentBridge.swift:108-141 | Packages/OsaurusCore/Services/AgentBridge/LocalAgentBridge.swift:143-178 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (35 corresponding lines) · ×6
  • Edited copy of a member (35 corresponding lines) Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift:266 — Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift:266-300 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppRuntimeAssets.swift:161-197 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) Packages/OsaurusCore/Views/Settings/ServerView.swift:1572 — Packages/OsaurusCore/Views/Settings/ServerView.swift:1572-1608 | Packages/OsaurusCore/Views/Settings/ServerView.swift:1713-1747 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) Packages/OsaurusCore/Views/Event/EventFormComponents.swift:563 — Packages/OsaurusCore/Views/Event/EventFormComponents.swift:563-602 | Packages/OsaurusCore/Views/Event/EventFormComponents.swift:1241-1275 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift:121 — Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift:121-155 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppHelperInstaller.swift:116-156 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) Packages/OsaurusCore/Services/Provider/OpenAICodexOAuthService.swift:692 — Packages/OsaurusCore/Services/Provider/OpenAICodexOAuthService.swift:692-726 | Packages/OsaurusCore/Services/Provider/XAIOAuthService.swift:417-452 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) Packages/OsaurusCore/Models/Agent/AgentStore.swift:632 — Packages/OsaurusCore/Models/Agent/AgentStore.swift:632-666 | Packages/OsaurusCore/Models/Agent/AgentStore.swift:668-702 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 10+ corresponding lines) · ×6
  • Edited copies of one member (4 members, 10+ corresponding lines) Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1446 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1446-1455 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1515-1524 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1574-1585 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1632-1644 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 10+ corresponding lines) Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1883 — Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1883-1892 | Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1328-1337 | Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1397-1411 | Packages/OsaurusCore/Storage/RouterBillingDatabase.swift:331-340 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 10+ corresponding lines) Packages/OsaurusCore/Models/Configuration/ServerHealth.swift:20 — Packages/OsaurusCore/Models/Configuration/ServerHealth.swift:20-29 | Packages/OsaurusCore/Models/Configuration/ServerHealth.swift:32-41 | Packages/OsaurusCore/Views/Settings/StatusPanelView.swift:65-80 | Packages/OsaurusCore/Views/Settings/StatusPanelView.swift:82-91 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 10+ corresponding lines) Packages/OsaurusCore/ComputerUse/Perception/ScreenContextDistiller.swift:910 — Packages/OsaurusCore/ComputerUse/Perception/ScreenContextDistiller.swift:910-921 | Packages/OsaurusCore/Models/Chat/DispatchEnvelope.swift:419-430 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6028-6037 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ScreenContextFixture.swift:635-645 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 10+ corresponding lines) Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:223 — Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:223-237 | Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:248-258 | Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:152-164 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:270-279 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 10+ corresponding lines) Packages/OsaurusCore/Models/Chat/ContentBlock.swift:337 — Packages/OsaurusCore/Models/Chat/ContentBlock.swift:337-350 | Packages/OsaurusCore/Models/Chat/ContentBlock.swift:457-470 | Packages/OsaurusCore/Models/Chat/ContentBlock.swift:474-487 | Packages/OsaurusCore/Models/Chat/ContentBlock.swift:530-539 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×6
  • Duplicated block (20 lines × 2) Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:1013 — Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:1013-1032 | Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:1676-1695 — 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 `Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:1013` 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 (20 lines × 2) Packages/OsaurusCore/Subagent/SubagentSession.swift:397 — Packages/OsaurusCore/Subagent/SubagentSession.swift:397-416 | Packages/OsaurusCore/Subagent/SubagentSession.swift:482-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 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) Packages/OsaurusCore/Views/Agent/CapabilitiesTableRepresentable.swift:142 — Packages/OsaurusCore/Views/Agent/CapabilitiesTableRepresentable.swift:142-161 | Packages/OsaurusCore/Views/Model/ModelPickerTableRepresentable.swift:190-209 — 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) Packages/OsaurusCore/Views/Model/HuggingFaceTokenViews.swift:64 — Packages/OsaurusCore/Views/Model/HuggingFaceTokenViews.swift:64-83 | Packages/OsaurusCore/Views/Plugin/GitHubTokenViews.swift:67-86 — before extracting anything, compare `Packages/OsaurusCore/Views/Model/HuggingFaceTokenViews.swift` and `Packages/OsaurusCore/Views/Plugin/GitHubTokenViews.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 72 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 `Packages/OsaurusCore/Views/Model/HuggingFaceTokenViews.swift:64` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20 lines × 2) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:312 — Packages/OsaurusCore/Views/Plugin/PluginsView.swift:312-331 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:2586-2605 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Plugin/PluginsView.swift:312` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20 lines × 2) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:1674 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:1674-1693 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:2032-2051 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:1674` 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 (13–14 lines × 2) · ×6
  • Duplicated block (13–14 lines × 2) Packages/OsaurusCore/AppleScript/Exec/AppleScriptExecutor.swift:355 — Packages/OsaurusCore/AppleScript/Exec/AppleScriptExecutor.swift:355-367 | Packages/OsaurusCore/AppleScript/Exec/AppleScriptExecutor.swift:444-457 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/AppleScript/Exec/AppleScriptExecutor.swift:355` 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–14 lines × 2) Packages/OsaurusCore/ComputerUse/Driver/Mac/Screenshot.swift:458 — Packages/OsaurusCore/ComputerUse/Driver/Mac/Screenshot.swift:458-471 | Packages/OsaurusCore/ComputerUse/Perception/FrameScrubber.swift:322-334 — 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 (13–14 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:8650 — Packages/OsaurusCore/Networking/HTTPHandler.swift:8650-8662 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12631-12644 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:8650` 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–14 lines × 2) Packages/OsaurusCore/Services/Chat/ComposeRequest.swift:56 — Packages/OsaurusCore/Services/Chat/ComposeRequest.swift:56-68 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:108-121 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note 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 (13–14 lines × 2) Packages/OsaurusCore/Views/Chat/NativeCompactionMarkerView.swift:68 — Packages/OsaurusCore/Views/Chat/NativeCompactionMarkerView.swift:68-80 | Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift:82-95 — 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 (13–14 lines × 2) Packages/OsaurusCore/Views/Model/ModelPickerView.swift:1071 — Packages/OsaurusCore/Views/Model/ModelPickerView.swift:1071-1083 | Packages/OsaurusCore/Views/Model/ModelPickerView.swift:1112-1125 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Model/ModelPickerView.swift:1071` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `spacing` to `theme.catalogLayoutMetric("component.library.26.elements.layout.modelPickerView.content.horizontalGap", inheriting: ModelPickerInspectionStyle.metric("gap", theme.space.s6, theme))` in one and `theme.catalogLayoutMetric("component.library.26.elements.layout.modelPickerView.content.horizontalGap2", inheriting: ModelPickerInspectionStyle.metric("gap", theme.space.s6, theme))` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Packages/OsaurusCore/Views/Model/ModelPickerView.swift:1069` calls `effectiveToggleValue` and `Packages/OsaurusCore/Views/Model/ModelPickerView.swift:1111` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10–11 lines × 3) · ×6
  • Duplicated block (10–11 lines × 3) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:648 — Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:648-658 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:737-746 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:855-864 — 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 `Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:648` 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–11 lines × 3) Packages/OsaurusCore/Models/Configuration/LocalVisionEvidence.swift:166 — Packages/OsaurusCore/Models/Configuration/LocalVisionEvidence.swift:166-176 | Packages/OsaurusCore/Models/Configuration/LocalVisionEvidence.swift:206-216 | Packages/OsaurusCore/Models/Configuration/LocalVisionEvidence.swift:259-268 — 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 `Packages/OsaurusCore/Models/Configuration/LocalVisionEvidence.swift:166` 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–11 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:13944 — Packages/OsaurusCore/Networking/HTTPHandler.swift:13944-13954 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14028-14038 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14131-14140 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:13944` 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, `Packages/OsaurusCore/Networking/HTTPHandler.swift:14130` calls `VideoJobResponseDTO`, `String` and `Packages/OsaurusCore/Networking/HTTPHandler.swift:13944` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10–11 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:15467 — Packages/OsaurusCore/Networking/HTTPHandler.swift:15467-15477 | Packages/OsaurusCore/Networking/HTTPHandler.swift:15938-15947 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16253-16262 — 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 (10–11 lines × 3) Packages/OsaurusCore/Services/Sandbox/SandboxManager.swift:2233 — Packages/OsaurusCore/Services/Sandbox/SandboxManager.swift:2233-2242 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1249-1259 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1335-1345 — 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 `Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1249` 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–11 lines × 3) Packages/OsaurusCore/Views/Settings/AgentChannelCustomConnectionSheet.swift:548 — Packages/OsaurusCore/Views/Settings/AgentChannelCustomConnectionSheet.swift:548-558 | Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:1117-1126 | Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:1149-1159 — 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 `Packages/OsaurusCore/Views/Settings/AgentChannelCustomConnectionSheet.swift:548` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×6
  • Duplicated block (10 lines × 4) Packages/OsaurusCore/PrivacyFilter/Views/PrivacyPresetRulesSection.swift:35 — Packages/OsaurusCore/PrivacyFilter/Views/PrivacyPresetRulesSection.swift:35-44 | Packages/OsaurusCore/PrivacyFilter/Views/PrivacyView.swift:753-762 | Packages/OsaurusCore/PrivacyFilter/Views/PrivacyView.swift:813-822 | Packages/OsaurusCore/PrivacyFilter/Views/PrivacyView.swift:916-925 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/PrivacyFilter/Views/PrivacyPresetRulesSection.swift:35` 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 × 4) Packages/OsaurusCore/Services/SystemPermissionService.swift:912 — Packages/OsaurusCore/Services/SystemPermissionService.swift:912-921 | Packages/OsaurusCore/Services/SystemPermissionService.swift:946-955 | Packages/OsaurusCore/Services/SystemPermissionService.swift:978-987 | Packages/OsaurusCore/Services/SystemPermissionService.swift:1033-1042 — 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 `Packages/OsaurusCore/Services/SystemPermissionService.swift:912` 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 × 4) Packages/OsaurusCore/Views/Agent/AgentsView.swift:169 — Packages/OsaurusCore/Views/Agent/AgentsView.swift:169-178 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:166-175 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:2537-2546 | Packages/OsaurusCore/Views/Workspaces/WorkspacesView.swift:94-103 — 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 `Packages/OsaurusCore/Views/Agent/AgentsView.swift:169` 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 (10 lines × 4) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:675 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:675-684 | Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:633-642 | Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:754-763 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:892-901 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 680 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 `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:675` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 4) Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:184 — Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:184-193 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:725-734 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1026-1035 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1370-1379 — 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 `Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:184` 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, `Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:182` calls `add` and `Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:723` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 4) Packages/OsaurusCore/Storage/MemoryDatabase.swift:184 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:184-193 | Packages/OsaurusCore/Storage/MethodDatabase.swift:102-111 | Packages/OsaurusCore/Storage/SchedulerDatabase.swift:241-250 | Packages/OsaurusCore/Storage/ToolDatabase.swift:157-166 — 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.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×6
  • Duplicated block (6–7 lines × 2) Packages/OsaurusCore/Services/Documents/BusinessDocumentStudioService.swift:648 — Packages/OsaurusCore/Services/Documents/BusinessDocumentStudioService.swift:648-653 | Packages/OsaurusCore/Services/Documents/WorkbookWorkflowService.swift:301-307 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note 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) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1369 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1369-1375 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:1546-1551 — 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 `Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:1546` 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) Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:117 — Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:117-122 | Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift:126-132 — before extracting anything, compare `Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift` and `Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 146 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–7 lines × 2) Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:351 — Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:351-357 | Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:428-433 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:351` 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.
  • Duplicated block (6–7 lines × 2) Packages/OsaurusCore/Views/Settings/ServerModelsTabContent.swift:274 — Packages/OsaurusCore/Views/Settings/ServerModelsTabContent.swift:274-280 | Packages/OsaurusCore/Views/Settings/ServerView.swift:606-611 — 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 `Packages/OsaurusCore/Views/Settings/ServerModelsTabContent.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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (6–7 lines × 2) Packages/OsaurusCore/Views/Template/PublishedWorkflowDashboard.swift:545 — Packages/OsaurusCore/Views/Template/PublishedWorkflowDashboard.swift:545-551 | Packages/OsaurusCore/Views/Template/PublishedWorkflowDashboard.swift:751-756 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Template/PublishedWorkflowDashboard.swift:545` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (6 lines × 4) · ×6
  • Duplicated block (6 lines × 4) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:305 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:305-310 | Packages/OsaurusCore/PrivacyFilter/Model/PrivacyFilterModelDownloader.swift:450-455 | Packages/OsaurusCore/Services/HuggingFaceService.swift:374-379 | Packages/OsaurusCore/Services/HuggingFaceService.swift:772-777 — 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 `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 (6 lines × 4) Packages/OsaurusCore/Models/Chat/RequestLog.swift:1229 — Packages/OsaurusCore/Models/Chat/RequestLog.swift:1229-1234 | Packages/OsaurusCore/Models/Chat/RequestLog.swift:1240-1245 | Packages/OsaurusCore/Models/Chat/RequestLog.swift:1258-1266 | Packages/OsaurusCore/Models/Chat/RequestLog.swift:1279-1287 — 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 `Packages/OsaurusCore/Models/Chat/RequestLog.swift:1229` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 4) Packages/OsaurusCore/Networking/HTTPHandler.swift:15467 — Packages/OsaurusCore/Networking/HTTPHandler.swift:15467-15472 | Packages/OsaurusCore/Networking/HTTPHandler.swift:15938-15943 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16253-16258 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18618-18623 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (6 lines × 4) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3572 — Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3572-3579 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3672-3677 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2107-2116 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3183-3188 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3572` 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 × 4) Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2817 — Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2817-2822 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2863-2868 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2932-2937 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2967-2972 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2871` calls `contains` and `Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2940` 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) Packages/OsaurusCore/Views/Event/ChannelRoutingSection.swift:159 — Packages/OsaurusCore/Views/Event/ChannelRoutingSection.swift:159-164 | Packages/OsaurusCore/Views/Event/ChannelRoutingSection.swift:841-846 | Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:347-352 | Packages/OsaurusCore/Views/Settings/ChannelsOverviewTable.swift:76-81 — 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 `Packages/OsaurusCore/Views/Event/ChannelRoutingSection.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Packages/OsaurusCore/Views/Event/ChannelRoutingSection.swift:839` calls `settingsLandingAnchor` and `Packages/OsaurusCore/Views/Event/ChannelRoutingSection.swift:157` 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.
D35 · Change Coupling · Change coupling · ×5
  • Change coupling: SystemPermission.swift ↔ ConfigurationView.swift Packages/OsaurusCore/Models/SystemPermission.swift:1 — `Packages/OsaurusCore/Models/SystemPermission.swift` and `Packages/OsaurusCore/Views/Settings/ConfigurationView.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 `b9dfd795` mic configurations (at that commit the file was still `Packages/OsaurusCore/Views/ConfigurationView.swift`); `ac495606` added whisper support (at that commit the file was still `Packages/OsaurusCore/Views/ConfigurationView.swift`); `29f43307` added location, notes, reminders permissions (at that commit the file was still `Packages/OsaurusCore/Views/ConfigurationView.swift`) — run `git show` on any of them.
  • Change coupling: ChatConfiguration.swift ↔ ChatView.swift Packages/OsaurusCore/Models/Chat/ChatConfiguration.swift:1 — `Packages/OsaurusCore/Models/Chat/ChatConfiguration.swift` and `Packages/OsaurusCore/Views/Chat/ChatView.swift` change together 57% of the time (23 of the 40 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). 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 23 shared commits counted here, the most recent 3 are `a4eb0bb4` Lazy chat model loading: selecting a model records the choice; the fi…; `5523962d` revamped settings (#2517); `64f54a67` Delete the persisted global Disable Tools switch; tool availability i… — run `git show` on any of them.
  • Change coupling: NativeBlockViews.swift ↔ NativeThinkingView.swift Packages/OsaurusCore/Views/Chat/NativeBlockViews.swift:1 — `Packages/OsaurusCore/Views/Chat/NativeBlockViews.swift` and `Packages/OsaurusCore/Views/Chat/NativeThinkingView.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 `03ea4c93` resolved crashes and hangs (#1575); `10dd0e91` chat improvements (#1259); `d011207d` performance improvements (#914) — run `git show` on any of them.
  • Change coupling: MemoryConfiguration.swift ↔ MemorySearchService.swift Packages/OsaurusCore/Models/Memory/MemoryConfiguration.swift:1 — `Packages/OsaurusCore/Models/Memory/MemoryConfiguration.swift` and `Packages/OsaurusCore/Services/Memory/MemorySearchService.swift` change together 50% of the time (7 of the 14 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 `0f26f944` updated memory results (at that commit the files were still `Packages/OsaurusCore/Models/MemoryConfiguration.swift` and `Packages/OsaurusCore/Services/MemorySearchService.swift`); `af37b227` tuning optimization for locomo benchmark (at that commit the files were still `Packages/OsaurusCore/Models/MemoryConfiguration.swift` and `Packages/OsaurusCore/Services/MemorySearchService.swift`); `e99759f5` updated memory implementation (at that commit the files were still `Packages/OsaurusCore/Models/MemoryConfiguration.swift` and `Packages/OsaurusCore/Services/MemorySearchService.swift`) — run `git show` on any of them.
  • Change coupling: SettingsSearchIndex.swift ↔ AgentChannelConnectionCenterView.swift Packages/OsaurusCore/Models/Configuration/SettingsSearchIndex.swift:1 — `Packages/OsaurusCore/Models/Configuration/SettingsSearchIndex.swift` and `Packages/OsaurusCore/Views/Settings/AgentChannelConnectionCenterView.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 `a2dd43d3` Keep channel chat tab live across follow-ups; add Focus Chat on Incom…; `33842593` Guide n8n setup so pairing codes only issue when they can work (#2775); `2fa86dbb` Redesign channels UX: name-first destinations, DM identity, intent-ba… — run `git show` on any of them.
D4 · Code Duplication · Edited copies of one member (3 members, 16+ corresponding lines) · ×5
  • Edited copies of one member (3 members, 16+ corresponding lines) Packages/OsaurusCore/Configuration/Declarative/ConfigYAML.swift:343 — Packages/OsaurusCore/Configuration/Declarative/ConfigYAML.swift:343-358 | Packages/OsaurusCore/Models/Configuration/SettingsSearchIndex.swift:258-275 | Packages/OsaurusCore/Services/Documents/PDFEditor.swift:329-344 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 16+ corresponding lines) Packages/OsaurusCore/Services/Method/MethodSearchService.swift:183 — Packages/OsaurusCore/Services/Method/MethodSearchService.swift:183-198 | Packages/OsaurusCore/Services/Skill/SkillSearchService.swift:229-244 | Packages/OsaurusCore/Services/Tool/ToolSearchService.swift:408-423 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 16+ corresponding lines) Packages/OsaurusCore/Views/Agent/Database/DatabaseTablesView.swift:509 — Packages/OsaurusCore/Views/Agent/Database/DatabaseTablesView.swift:509-526 | Packages/OsaurusCore/Views/Agent/Database/DatabaseTablesView.swift:528-544 | Packages/OsaurusCore/Views/Agent/Database/DatabaseTablesView.swift:547-562 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 16+ corresponding lines) Packages/OsaurusCore/Models/Channels/ChannelIdentity.swift:142 — Packages/OsaurusCore/Models/Channels/ChannelIdentity.swift:142-161 | Packages/OsaurusCore/Models/Channels/ChannelIdentity.swift:225-241 | Packages/OsaurusCore/Models/Channels/ChannelIdentity.swift:275-290 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 16+ corresponding lines) Packages/OsaurusCore/Tools/OsaurusTool.swift:214 — Packages/OsaurusCore/Tools/OsaurusTool.swift:214-233 | Packages/OsaurusCore/Tools/OsaurusTool.swift:237-252 | Packages/OsaurusCore/Tools/OsaurusTool.swift:257-282 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (31 corresponding lines) · ×5
  • Edited copy of a member (31 corresponding lines) Packages/OsaurusCore/Models/Method/Method.swift:29 — Packages/OsaurusCore/Models/Method/Method.swift:29-59 | Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:371-405 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) Packages/OsaurusCore/Models/Event/EventRun.swift:84 — Packages/OsaurusCore/Models/Event/EventRun.swift:84-118 | Packages/OsaurusCore/Models/Schedule/ScheduleRunHistory.swift:57-87 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:1074 — Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:1074-1104 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:2025-2056 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) Packages/OsaurusCore/Services/ModelRuntime/ImageGenerationTypes.swift:110 — Packages/OsaurusCore/Services/ModelRuntime/ImageGenerationTypes.swift:110-140 | Packages/OsaurusCore/Services/Router/OsaurusRouterTypes.swift:647-677 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:362 — Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:362-401 | Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:190-220 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 6+ corresponding lines) · ×5
  • Edited copies of one member (5 members, 6+ corresponding lines) Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:292 — Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:292-298 | Packages/OsaurusCore/AppleApps/Maps/MapsTools.swift:169-174 | Packages/OsaurusCore/AppleApps/Maps/MapsTools.swift:218-224 | Packages/OsaurusCore/AppleApps/Maps/MapsTools.swift:245-253 | Packages/OsaurusCore/AppleApps/Messages/MessagesTools.swift:103-108 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 6+ corresponding lines) Packages/OsaurusCore/Services/Inference/ModelService.swift:382 — Packages/OsaurusCore/Services/Inference/ModelService.swift:382-387 | Packages/OsaurusCore/Services/Inference/ModelService.swift:531-536 | Packages/OsaurusCore/Services/Inference/ModelService.swift:552-557 | Packages/OsaurusCore/Services/Inference/ModelService.swift:771-776 | Packages/OsaurusCore/Services/Router/RemoteRunArtifacts.swift:69-74 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 6+ corresponding lines) Packages/OsaurusCore/Services/Sync/SyncDeviceFeedContract.swift:123 — Packages/OsaurusCore/Services/Sync/SyncDeviceFeedContract.swift:123-128 | Packages/OsaurusCore/Services/Sync/SyncDeviceFeedContract.swift:305-310 | Packages/OsaurusCore/Services/Sync/SyncHostedRunContract.swift:153-158 | Packages/OsaurusCore/Services/Sync/SyncHostedRunContract.swift:201-206 | Packages/OsaurusCore/Services/Sync/SyncServedChats.swift:87-92 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 6+ corresponding lines) Packages/OsaurusCore/Models/AgentChannel/AgentChannelAsyncModels.swift:215 — Packages/OsaurusCore/Models/AgentChannel/AgentChannelAsyncModels.swift:215-221 | Packages/OsaurusCore/Models/AgentChannel/AgentChannelAsyncModels.swift:354-359 | Packages/OsaurusCore/Models/Event/OsaurusEvent.swift:525-531 | Packages/OsaurusCore/Models/IMessage/IMessageConnectionConfiguration.swift:246-252 | Packages/OsaurusCore/Models/WhatsApp/WhatsAppConnectionConfiguration.swift:185-191 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 6+ corresponding lines) Packages/OsaurusCore/Services/Channels/ChannelRemoteSafetyGate.swift:475 — Packages/OsaurusCore/Services/Channels/ChannelRemoteSafetyGate.swift:475-482 | Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:1075-1082 | Packages/OsaurusCore/Services/Inference/ModelService.swift:545-550 | Packages/OsaurusCore/Services/Router/RemoteRunArtifacts.swift:62-67 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:320-327 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (33 lines × 2) · ×5
  • Duplicated block (33 lines × 2) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:890 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:890-922 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:1078-1110 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 368 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 (33 lines × 2) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:743 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:743-775 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:944-976 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 680 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 (33 lines × 2) Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:992 — Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:992-1024 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:1943-1975 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:992` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `spacing` to `theme.space.s16` in one and `theme.space.s0` 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 (33 lines × 2) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:636 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:636-668 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:773-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 `Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:636` 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 (33 lines × 2) Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift:257 — Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift:257-289 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalTranscript.swift:152-184 — 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 `Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift:257` 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 (29 lines × 2) · ×5
  • Duplicated block (29 lines × 2) Packages/OsaurusCore/Models/Chat/DispatchRequest.swift:194 — Packages/OsaurusCore/Models/Chat/DispatchRequest.swift:194-222 | Packages/OsaurusCore/Models/Chat/DispatchRequest.swift:239-267 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Models/Chat/DispatchRequest.swift:239` 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 (29 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:16071 — Packages/OsaurusCore/Networking/HTTPHandler.swift:16071-16099 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16356-16384 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:16071` 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 (29 lines × 2) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1038 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1038-1066 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:1145-1173 — 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 `Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1038` 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 (29 lines × 2) Packages/OsaurusCore/Views/Chat/ChatView.swift:13144 — Packages/OsaurusCore/Views/Chat/ChatView.swift:13144-13172 | Packages/OsaurusCore/Views/Chat/MessageThreadView.swift:124-152 — 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 `Packages/OsaurusCore/Views/Chat/ChatView.swift:13144` 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 (29 lines × 2) Packages/OsaurusCore/Views/Model/HuggingFaceTokenViews.swift:32 — Packages/OsaurusCore/Views/Model/HuggingFaceTokenViews.swift:32-60 | Packages/OsaurusCore/Views/Plugin/GitHubTokenViews.swift:35-63 — before extracting anything, compare `Packages/OsaurusCore/Views/Model/HuggingFaceTokenViews.swift` and `Packages/OsaurusCore/Views/Plugin/GitHubTokenViews.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 72 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 `Packages/OsaurusCore/Views/Model/HuggingFaceTokenViews.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.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×5
  • Duplicated block (12–13 lines × 2) Packages/OsaurusCore/Models/Knowledge/KnowledgeCollectionStore.swift:78 — Packages/OsaurusCore/Models/Knowledge/KnowledgeCollectionStore.swift:78-90 | Packages/OsaurusCore/Models/Project/ProjectStore.swift:41-52 — before extracting anything, compare `Packages/OsaurusCore/Models/Knowledge/KnowledgeCollectionStore.swift` and `Packages/OsaurusCore/Models/Project/ProjectStore.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 51 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 (12–13 lines × 2) Packages/OsaurusCore/Services/Auth/OwnerDeviceAccessHost.swift:353 — Packages/OsaurusCore/Services/Auth/OwnerDeviceAccessHost.swift:353-365 | Packages/OsaurusCore/Services/Router/WorkspaceAgentAccessHost.swift:338-349 — 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 `Packages/OsaurusCore/Services/Auth/OwnerDeviceAccessHost.swift:353` 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–13 lines × 2) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:4503 — Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:4503-4514 | Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:4706-4718 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:4503` 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 (12–13 lines × 2) Packages/OsaurusCore/Views/Settings/ProvidersView.swift:2065 — Packages/OsaurusCore/Views/Settings/ProvidersView.swift:2065-2076 | Packages/OsaurusCore/Views/Settings/ProvidersView.swift:2097-2109 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Settings/ProvidersView.swift:2065` 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.
  • Duplicated block (12–13 lines × 2) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:405 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:405-416 | Packages/OsaurusCore/Services/HuggingFaceService.swift:1062-1074 — 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 `Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:405` 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–11 lines × 2) · ×5
  • Duplicated block (9–11 lines × 2) Packages/OsaurusCore/Managers/RemoteProviderManager.swift:1843 — Packages/OsaurusCore/Managers/RemoteProviderManager.swift:1843-1853 | Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:7574-7582 — 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 `Packages/OsaurusCore/Managers/RemoteProviderManager.swift:1843` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–11 lines × 2) Packages/OsaurusCore/PrivacyFilter/Core/PrivacyFilterPipeline.swift:755 — Packages/OsaurusCore/PrivacyFilter/Core/PrivacyFilterPipeline.swift:755-765 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyFilterPipeline.swift:767-775 — both copies are in the same file, so extract the 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–11 lines × 2) Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:668 — Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:668-676 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:730-740 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:730` 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–11 lines × 2) Packages/OsaurusCore/Subagent/Kinds/BrowserUseKind.swift:241 — Packages/OsaurusCore/Subagent/Kinds/BrowserUseKind.swift:241-249 | Packages/OsaurusCore/Subagent/Kinds/TextSubagentKind.swift:1075-1085 — 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 `Packages/OsaurusCore/Subagent/Kinds/BrowserUseKind.swift:241` 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–11 lines × 2) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5371 — Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5371-5381 | Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5386-5394 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5384` calls `hasItemConformingToTypeIdentifier` and `Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5369` 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 · Edited copy of a member (41 corresponding lines) · ×4
  • Edited copy of a member (41 corresponding lines) Packages/OsaurusCore/AppleScript/Loop/AppleScriptTraceLog.swift:94 — Packages/OsaurusCore/AppleScript/Loop/AppleScriptTraceLog.swift:94-144 | Packages/OsaurusCore/ComputerUse/Loop/ComputerUseTraceLog.swift:20-60 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (41 corresponding lines) Packages/OsaurusCore/Views/Settings/AgentChannelAuditRows.swift:19 — Packages/OsaurusCore/Views/Settings/AgentChannelAuditRows.swift:19-64 | Packages/OsaurusCore/Views/Settings/AgentChannelAuditRows.swift:97-137 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (41 corresponding lines) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCompat.swift:713 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCompat.swift:713-753 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCompat.swift:759-805 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (41 corresponding lines) Packages/OsaurusCore/Views/Chat/ChatView.swift:13132 — Packages/OsaurusCore/Views/Chat/ChatView.swift:13132-13172 | Packages/OsaurusCore/Views/Chat/MessageThreadView.swift:111-152 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (47 corresponding lines) · ×4
  • Edited copy of a member (47 corresponding lines) Packages/OsaurusCore/Services/Chat/ContextCompactionService.swift:701 — Packages/OsaurusCore/Services/Chat/ContextCompactionService.swift:701-747 | Packages/OsaurusCore/Services/Inference/CoreModelService.swift:875-927 — These two members are one piece of code written twice and then edited apart: 47 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (47 corresponding lines) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:7604 — Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:7604-7650 | Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:7705-7752 — These two members are one piece of code written twice and then edited apart: 47 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (47 corresponding lines) Packages/OsaurusCore/Services/Knowledge/KnowledgeWriteService.swift:85 — Packages/OsaurusCore/Services/Knowledge/KnowledgeWriteService.swift:85-132 | Packages/OsaurusCore/Services/Knowledge/KnowledgeWriteService.swift:135-181 — These two members are one piece of code written twice and then edited apart: 47 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (47 corresponding lines) Packages/OsaurusCore/Services/GitHubSkillService.swift:447 — Packages/OsaurusCore/Services/GitHubSkillService.swift:447-497 | Packages/OsaurusCore/Services/Skill/ClaudePluginManifestStore.swift:133-179 — These two members are one piece of code written twice and then edited apart: 47 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (44 corresponding lines) · ×4
  • Edited copy of a member (44 corresponding lines) Packages/OsaurusCore/Services/MobileConnect/RemoteSecretPromptQueue.swift:36 — Packages/OsaurusCore/Services/MobileConnect/RemoteSecretPromptQueue.swift:36-79 | Packages/OsaurusCore/Services/Sync/SyncSecretPromptQueue.swift:50-105 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (44 corresponding lines) Packages/OsaurusCore/Storage/AgentDatabase.swift:1597 — Packages/OsaurusCore/Storage/AgentDatabase.swift:1597-1658 | Packages/OsaurusCore/Storage/AgentDatabase.swift:1682-1725 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (44 corresponding lines) Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:432 — Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:432-484 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:363-406 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (44 corresponding lines) Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:583 — Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:583-636 | Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:638-681 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (30 corresponding lines) · ×4
  • Edited copy of a member (30 corresponding lines) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:436 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:436-465 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:522-560 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) Packages/OsaurusCore/Services/MediaGeneration/OsaurusCloudMediaClient.swift:290 — Packages/OsaurusCore/Services/MediaGeneration/OsaurusCloudMediaClient.swift:290-320 | Packages/OsaurusCore/Services/MediaGeneration/VeniceMediaClient.swift:256-285 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) Packages/OsaurusCore/Services/Provider/ProviderCredentialPromptService.swift:88 — Packages/OsaurusCore/Services/Provider/ProviderCredentialPromptService.swift:88-117 | Packages/OsaurusCore/Services/Provider/ProviderCredentialPromptService.swift:124-156 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) Packages/OsaurusCore/Services/AgentChannel/AgentChannelPublishService.swift:1294 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelPublishService.swift:1294-1325 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelPublishService.swift:1329-1358 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 26+ corresponding lines) · ×4
  • Edited copies of one member (3 members, 26+ corresponding lines) helpers/osaurus-wa/bridge.go:861 — helpers/osaurus-wa/bridge.go:861-886 | helpers/osaurus-wa/bridge.go:895-921 | helpers/osaurus-wa/bridge.go:958-986 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 26+ corresponding lines) Packages/OsaurusCore/Managers/Chat/ChatSessionImporter.swift:336 — Packages/OsaurusCore/Managers/Chat/ChatSessionImporter.swift:336-368 | Packages/OsaurusCore/Managers/Chat/ChatSessionImporter.swift:486-514 | Packages/OsaurusCore/Managers/Chat/ChatSessionImporter.swift:614-639 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 26+ corresponding lines) Packages/OsaurusCore/Services/Method/MethodSearchService.swift:202 — Packages/OsaurusCore/Services/Method/MethodSearchService.swift:202-229 | Packages/OsaurusCore/Services/Skill/SkillSearchService.swift:248-273 | Packages/OsaurusCore/Services/Tool/ToolSearchService.swift:827-866 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 26+ corresponding lines) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:592 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:592-618 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:873-903 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:535-560 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 12+ corresponding lines) · ×4
  • Edited copies of one member (4 members, 12+ corresponding lines) Packages/OsaurusCore/Models/Knowledge/KnowledgeCollection.swift:75 — Packages/OsaurusCore/Models/Knowledge/KnowledgeCollection.swift:75-87 | Packages/OsaurusCore/Models/Project/Project.swift:61-73 | Packages/OsaurusCore/Models/SlashCommand/SlashCommand.swift:72-84 | Packages/OsaurusCore/Services/Workflow/WorkflowConnections.swift:76-87 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 12+ corresponding lines) Packages/OsaurusCore/Storage/EventRunDatabase.swift:508 — Packages/OsaurusCore/Storage/EventRunDatabase.swift:508-523 | Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:439-458 | Packages/OsaurusCore/Storage/TaskDatabase.swift:650-661 | Packages/OsaurusCore/Storage/WorkflowRunDatabase.swift:294-308 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 12+ corresponding lines) Packages/OsaurusCore/Services/Documents/CSVEmitter.swift:29 — Packages/OsaurusCore/Services/Documents/CSVEmitter.swift:29-50 | Packages/OsaurusCore/Services/Documents/DOCXEmitter.swift:23-34 | Packages/OsaurusCore/Services/Documents/PPTXEmitter.swift:25-37 | Packages/OsaurusCore/Services/Documents/XLSXEmitter.swift:25-38 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 12+ corresponding lines) Packages/OsaurusCore/Models/API/AnthropicAPI.swift:1230 — Packages/OsaurusCore/Models/API/AnthropicAPI.swift:1230-1248 | Packages/OsaurusCore/Models/Template/ListingEdits.swift:67-78 | Packages/OsaurusCore/Services/Router/OsaurusRouterTypes.swift:1093-1111 | Packages/OsaurusCore/Services/Router/OsaurusRouterWorkspaceTypes.swift:112-130 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 21+ corresponding lines) · ×4
  • Edited copies of one member (3 members, 21+ corresponding lines) Packages/OsaurusCore/Models/API/AnthropicAPI.swift:953 — Packages/OsaurusCore/Models/API/AnthropicAPI.swift:953-975 | Packages/OsaurusCore/Models/API/OpenAIAPI.swift:1560-1580 | Packages/OsaurusCore/Models/Configuration/ModelInfo.swift:580-602 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 21+ corresponding lines) Packages/OsaurusCore/Models/Knowledge/KnowledgeCollection.swift:51 — Packages/OsaurusCore/Models/Knowledge/KnowledgeCollection.swift:51-73 | Packages/OsaurusCore/Models/Project/Project.swift:39-59 | Packages/OsaurusCore/Models/SlashCommand/SlashCommand.swift:42-64 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 21+ corresponding lines) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:429 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:429-450 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:486-507 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:562-582 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 21+ corresponding lines) Packages/OsaurusCore/Services/Spaces/SpaceActions.swift:103 — Packages/OsaurusCore/Services/Spaces/SpaceActions.swift:103-124 | Packages/OsaurusCore/Services/Spaces/SpaceActions.swift:145-165 | Packages/OsaurusCore/Services/Spaces/SpaceActions.swift:167-189 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 20+ corresponding lines) · ×4
  • Edited copies of one member (3 members, 20+ corresponding lines) Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:366 — Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:366-385 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:584-613 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:735-760 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 20+ corresponding lines) Packages/OsaurusCore/Services/AgentCollaboration/AgentCollaborationService.swift:89 — Packages/OsaurusCore/Services/AgentCollaboration/AgentCollaborationService.swift:89-108 | Packages/OsaurusCore/Services/AgentCollaboration/AgentCollaborationService.swift:110-129 | Packages/OsaurusCore/Services/AgentCollaboration/AgentCollaborationService.swift:166-185 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 20+ corresponding lines) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:260 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:260-279 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:287-308 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:278-297 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 20+ corresponding lines) Packages/OsaurusCore/Views/DesignSystem/SettingsRow.swift:118 — Packages/OsaurusCore/Views/DesignSystem/SettingsRow.swift:118-137 | Packages/OsaurusCore/Views/DesignSystem/SettingsRow.swift:141-160 | Packages/OsaurusCore/Views/DesignSystem/SettingsSection.swift:278-301 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 8+ corresponding lines) · ×4
  • Edited copies of one member (5 members, 8+ corresponding lines) Packages/OsaurusCore/Views/Chat/MarkdownImageView.swift:540 — Packages/OsaurusCore/Views/Chat/MarkdownImageView.swift:540-551 | Packages/OsaurusCore/Views/Chat/NativeBlockViews.swift:1120-1137 | Packages/OsaurusCore/Views/Common/CodeBlockView.swift:485-498 | Packages/OsaurusCore/Views/Common/PopoverHoverTracking.swift:46-57 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowLibraryKit.swift:998-1005 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 8+ corresponding lines) Packages/OsaurusCore/ComputerUse/Driver/MacDriver.swift:203 — Packages/OsaurusCore/ComputerUse/Driver/MacDriver.swift:203-217 | Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:57-64 | Packages/OsaurusCore/Models/Template/TemplateRequirements.swift:103-113 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:1863-1875 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:3266-3278 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 8+ corresponding lines) Packages/OsaurusCore/Views/Identity/IdentityView.swift:762 — Packages/OsaurusCore/Views/Identity/IdentityView.swift:762-769 | Packages/OsaurusCore/Views/Identity/MasterMnemonicCard.swift:81-88 | Packages/OsaurusCore/Views/Identity/OsaurusIDSection.swift:473-480 | Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:2215-2222 | Packages/OsaurusCore/Views/Workflow/WorkflowRunTabView.swift:134-141 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 8+ corresponding lines) Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:1386 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:1386-1393 | Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:992-1005 | Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1330-1341 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:1324-1337 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:1496-1507 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×4
  • Duplicated block (28 lines × 2) Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:134 — Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:134-161 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppWatchTransportRuntime.swift:116-143 — before extracting anything, compare `Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift` and `Packages/OsaurusCore/Services/WhatsApp/WhatsAppWatchTransportRuntime.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 88 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 `Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:134` 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 (28 lines × 2) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:3917 — Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:3917-3944 | Packages/OsaurusCore/Views/Chat/ChatTabStripView.swift:1262-1289 — 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 `Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:3917` 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 (28 lines × 2) Packages/OsaurusCore/Views/Plugin/GitHubImportSheet.swift:238 — Packages/OsaurusCore/Views/Plugin/GitHubImportSheet.swift:238-265 | Packages/OsaurusCore/Views/Plugin/GitHubImportSheet.swift:340-367 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Plugin/GitHubImportSheet.swift:238` 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 (28 lines × 2) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:300 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:300-327 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:282-309 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 680 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.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×4
  • Duplicated block (25 lines × 2) Packages/OsaurusCore/Services/LocalGenerationDefaults.swift:549 — Packages/OsaurusCore/Services/LocalGenerationDefaults.swift:549-573 | Packages/OsaurusCore/Services/LocalReasoningCapability.swift:725-749 — 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 (25 lines × 2) Packages/OsaurusCore/Views/Plugin/ToolsManagerView.swift:781 — Packages/OsaurusCore/Views/Plugin/ToolsManagerView.swift:781-805 | Packages/OsaurusCore/Views/Plugin/ToolsManagerView.swift:868-892 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Plugin/ToolsManagerView.swift:781` 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 (25 lines × 2) Packages/OsaurusCore/AppleScript/Loop/AppleScriptTraceLog.swift:120 — Packages/OsaurusCore/AppleScript/Loop/AppleScriptTraceLog.swift:120-144 | Packages/OsaurusCore/ComputerUse/Loop/ComputerUseTraceLog.swift:36-60 — before extracting anything, compare `Packages/OsaurusCore/AppleScript/Loop/AppleScriptTraceLog.swift` and `Packages/OsaurusCore/ComputerUse/Loop/ComputerUseTraceLog.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 45 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 `Packages/OsaurusCore/AppleScript/Loop/AppleScriptTraceLog.swift:120` 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 (25 lines × 2) Packages/OsaurusCore/Models/Knowledge/KnowledgeCollectionStore.swift:31 — Packages/OsaurusCore/Models/Knowledge/KnowledgeCollectionStore.swift:31-58 | Packages/OsaurusCore/Models/Project/ProjectStore.swift:13-37 — before extracting anything, compare `Packages/OsaurusCore/Models/Knowledge/KnowledgeCollectionStore.swift` and `Packages/OsaurusCore/Models/Project/ProjectStore.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 51 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 (24 lines × 2) · ×4
  • Duplicated block (24 lines × 2) Packages/OsaurusCore/Managers/RemoteProviderManager.swift:1922 — Packages/OsaurusCore/Managers/RemoteProviderManager.swift:1922-1945 | Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:7784-7807 — 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 `Packages/OsaurusCore/Managers/RemoteProviderManager.swift:1922` 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 (24 lines × 2) Packages/OsaurusCore/Models/Chat/ChatTurnData.swift:325 — Packages/OsaurusCore/Models/Chat/ChatTurnData.swift:325-348 | Packages/OsaurusCore/Models/Chat/ChatTurnData.swift:372-395 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Models/Chat/ChatTurnData.swift:325` 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 (24 lines × 2) Packages/OsaurusCore/Storage/AgentDatabase.swift:1611 — Packages/OsaurusCore/Storage/AgentDatabase.swift:1611-1634 | Packages/OsaurusCore/Storage/AgentDatabase.swift:1688-1711 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Storage/AgentDatabase.swift:1611` 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. 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 (24 lines × 2) Packages/OsaurusCore/Views/Settings/AgentChannelCustomConnectionSheet.swift:119 — Packages/OsaurusCore/Views/Settings/AgentChannelCustomConnectionSheet.swift:119-142 | Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:110-133 — 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 `Packages/OsaurusCore/Views/Settings/AgentChannelCustomConnectionSheet.swift:119` 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 (18–19 lines × 2) · ×4
  • Duplicated block (18–19 lines × 2) Packages/OsaurusCore/AppleScript/Exec/AppleScriptExecutor.swift:325 — Packages/OsaurusCore/AppleScript/Exec/AppleScriptExecutor.swift:325-342 | Packages/OsaurusCore/AppleScript/Exec/AppleScriptExecutor.swift:376-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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18–19 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:10636 — Packages/OsaurusCore/Networking/HTTPHandler.swift:10636-10654 | Packages/OsaurusCore/Networking/HTTPHandler.swift:10659-10676 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:10659` 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–19 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:16048 — Packages/OsaurusCore/Networking/HTTPHandler.swift:16048-16066 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16334-16351 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:16048` 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. 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 (18–19 lines × 2) Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift:199 — Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift:199-216 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalTranscript.swift:109-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 `Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.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.
D4 · Code Duplication · Duplicated block (16 lines × 3) · ×4
  • Duplicated block (16 lines × 3) Packages/OsaurusCore/ComputerUse/Model/AgentAction.swift:476 — Packages/OsaurusCore/ComputerUse/Model/AgentAction.swift:476-491 | Packages/OsaurusCore/Managers/InsightsService.swift:888-903 | Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/OsaurusEvalsCLI.swift:1026-1041 — 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 `Packages/OsaurusCore/ComputerUse/Model/AgentAction.swift:476` 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, `Packages/OsaurusCore/Managers/InsightsService.swift:904` calls `log` and `Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/OsaurusEvalsCLI.swift:1042` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (16 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:17206 — Packages/OsaurusCore/Networking/HTTPHandler.swift:17206-17221 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17288-17303 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17627-17642 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:17206` 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 (16 lines × 3) Packages/OsaurusCore/Services/LocalGenerationDefaults.swift:168 — Packages/OsaurusCore/Services/LocalGenerationDefaults.swift:168-183 | Packages/OsaurusCore/Services/LocalGenerationDefaults.swift:256-271 | Packages/OsaurusCore/Services/LocalGenerationDefaults.swift:393-408 — 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 `Packages/OsaurusCore/Services/LocalGenerationDefaults.swift:168` 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 (16 lines × 3) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:526 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:526-541 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:655-670 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:993-1008 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 260 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 `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:526` 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 lines × 3) · ×4
  • Duplicated block (15 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:14857 — Packages/OsaurusCore/Networking/HTTPHandler.swift:14857-14871 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14881-14895 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14905-14919 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:14857` 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 (15 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:14885 — Packages/OsaurusCore/Networking/HTTPHandler.swift:14885-14899 | Packages/OsaurusCore/Networking/HTTPHandler.swift:15331-15345 | Packages/OsaurusCore/Networking/HTTPHandler.swift:15358-15372 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:14885` 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 (15 lines × 3) Packages/OsaurusCore/Tools/AgentChannelTools.swift:134 — Packages/OsaurusCore/Tools/AgentChannelTools.swift:134-148 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:206-220 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:301-315 — 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 `Packages/OsaurusCore/Tools/AgentChannelTools.swift:134` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 3) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:858 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:858-872 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:568-582 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1090-1104 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 237 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 `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:858` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×4
  • Duplicated block (14–15 lines × 2) Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:2474 — Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:2474-2487 | Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:1758-1772 — 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 `Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:2474` 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, `Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:1755` calls `isMissingRequiredAgentActionError` and `Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:2473` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14–15 lines × 2) Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:640 — Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:640-653 | Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:667-681 — both copies are in the same file, so extract the 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.
  • Duplicated block (14–15 lines × 2) Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift:677 — Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift:677-691 | Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift:716-729 — both copies are in the same file, so extract the 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.
  • Duplicated block (14–15 lines × 2) Packages/OsaurusCore/Services/Tool/ToolSearchService.swift:784 — Packages/OsaurusCore/Services/Tool/ToolSearchService.swift:784-798 | Packages/OsaurusCore/Services/Tool/ToolSearchService.swift:879-892 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (11–13 lines × 2) · ×4
  • Duplicated block (11–13 lines × 2) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3550 — Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3550-3562 | Packages/OsaurusCore/Tools/SandboxSecretTools.swift:133-143 — 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 `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3550` 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–13 lines × 2) Packages/OsaurusCore/Storage/RouterBillingDatabase.swift:470 — Packages/OsaurusCore/Storage/RouterBillingDatabase.swift:470-482 | Packages/OsaurusCore/Storage/ToolDatabase.swift:389-399 — 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 `Packages/OsaurusCore/Storage/RouterBillingDatabase.swift:470` 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 (11–13 lines × 2) Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:580 — Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:580-592 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:1200-1210 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:580` 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, `Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:1216` calls `NSPoint` and `Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:598` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11–13 lines × 2) Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift:963 — Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift:963-973 | Packages/OsaurusCore/Managers/WindowManager.swift:441-453 — 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 `Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift:963` 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 (11–12 lines × 3) · ×4
  • Duplicated block (11–12 lines × 3) Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift:538 — Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift:538-548 | Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift:555-565 | Packages/OsaurusCore/Managers/Chat/ChatWindowManager.swift:605-616 — 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 `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 (11–12 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:4819 — Packages/OsaurusCore/Networking/HTTPHandler.swift:4819-4829 | Packages/OsaurusCore/Networking/HTTPHandler.swift:4916-4926 | Packages/OsaurusCore/Networking/HTTPHandler.swift:4983-4994 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:4819` 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 (11–12 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:12183 — Packages/OsaurusCore/Networking/HTTPHandler.swift:12183-12193 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12202-12212 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12272-12283 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:12183` 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 (11–12 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:16913 — Packages/OsaurusCore/Networking/HTTPHandler.swift:16913-16923 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16984-16994 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17330-17341 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:16913` 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–11 lines × 2) · ×4
  • Duplicated block (8–11 lines × 2) Packages/OsaurusCore/Folder/FolderTools.swift:6274 — Packages/OsaurusCore/Folder/FolderTools.swift:6274-6284 | Packages/OsaurusCore/Folder/FolderTools.swift:6376-6383 — both copies are in the same file, so extract the 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 (8–11 lines × 2) Packages/OsaurusCore/Services/Context/ResponsesEvaluationStep.swift:41 — Packages/OsaurusCore/Services/Context/ResponsesEvaluationStep.swift:41-51 | Packages/OsaurusCore/Services/Plugin/PluginResponsesCompatibility.swift:17-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 `Packages/OsaurusCore/Services/Context/ResponsesEvaluationStep.swift:41` 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–11 lines × 2) Packages/OsaurusCore/Services/Sandbox/SandboxPackageManifest.swift:134 — Packages/OsaurusCore/Services/Sandbox/SandboxPackageManifest.swift:134-141 | Packages/OsaurusCore/Tools/AgentLoopTools.swift:469-479 — 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. 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–11 lines × 2) Packages/OsaurusCore/Views/Agent/Database/DatabaseSharedUI.swift:227 — Packages/OsaurusCore/Views/Agent/Database/DatabaseSharedUI.swift:227-237 | Packages/OsaurusCore/Views/Event/EventDetailView.swift:169-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 `Packages/OsaurusCore/Views/Agent/Database/DatabaseSharedUI.swift:227` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8–10 lines × 2) · ×4
  • Duplicated block (8–10 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:15588 — Packages/OsaurusCore/Networking/HTTPHandler.swift:15588-15595 | Packages/OsaurusCore/Networking/HTTPHandler.swift:15694-15703 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:15588` 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–10 lines × 2) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:5451 — Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:5451-5460 | Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:5697-5704 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:5451` 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–10 lines × 2) Packages/OsaurusCore/Storage/TaskDatabase.swift:474 — Packages/OsaurusCore/Storage/TaskDatabase.swift:474-483 | Packages/OsaurusCore/Storage/TaskDatabase.swift:485-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 (8–10 lines × 2) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:786 — Packages/OsaurusCore/Views/Plugin/PluginsView.swift:786-795 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:2450-2457 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Plugin/PluginsView.swift:786` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×4
  • Duplicated block (8 lines × 4) Packages/OsaurusCore/Services/Email/EmailChannelService.swift:229 — Packages/OsaurusCore/Services/Email/EmailChannelService.swift:229-236 | Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:401-408 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:744-751 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:504-511 — 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 `Packages/OsaurusCore/Services/Email/EmailChannelService.swift:229` 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 × 4) Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:671 — Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:671-678 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:770-777 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:928-935 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:1855-1862 — 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 `Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:671` 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, `Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:680` calls `padding`, `settingsChrome` and `Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:779` 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 × 4) Packages/OsaurusCore/Views/Event/EventFormComponents.swift:645 — Packages/OsaurusCore/Views/Event/EventFormComponents.swift:645-652 | Packages/OsaurusCore/Views/Event/EventFormComponents.swift:682-689 | Packages/OsaurusCore/Views/Event/EventFormComponents.swift:1054-1061 | Packages/OsaurusCore/Views/Event/EventFormComponents.swift:1091-1098 — 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 `Packages/OsaurusCore/Views/Event/EventFormComponents.swift:645` 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 × 4) Packages/OsaurusCore/Storage/ConfigHistoryDatabase.swift:112 — Packages/OsaurusCore/Storage/ConfigHistoryDatabase.swift:112-119 | Packages/OsaurusCore/Storage/EventRunDatabase.swift:101-108 | Packages/OsaurusCore/Storage/TaskDatabase.swift:172-179 | Packages/OsaurusCore/Storage/WorkflowRunDatabase.swift:95-102 — 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.
D4 · Code Duplication · Duplicated block (7 lines × 6) · ×4
  • Duplicated block (7 lines × 6) Packages/OsaurusCore/Models/Chat/RequestLog.swift:192 — Packages/OsaurusCore/Models/Chat/RequestLog.swift:192-198 | Packages/OsaurusCore/Models/Chat/RequestLog.swift:213-219 | Packages/OsaurusCore/Models/Chat/SessionSource.swift:93-107 | Packages/OsaurusCore/Models/Chat/SessionSource.swift:134-140 | Packages/OsaurusCore/Models/Chat/SessionSource.swift:153-159 | Packages/OsaurusCore/Services/FeatureTelemetry.swift:1103-1109 — there are 6 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 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 `Packages/OsaurusCore/Models/Chat/RequestLog.swift:192` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7 lines × 6) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3485 — Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3485-3491 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3548-3556 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3593-3599 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3639-3645 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3660-3666 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3692-3698 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3485` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3492` calls `object`, `number`, `Double` and `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3600` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 6) Packages/OsaurusCore/Services/Sandbox/SandboxManager.swift:2213 — Packages/OsaurusCore/Services/Sandbox/SandboxManager.swift:2213-2219 | Packages/OsaurusCore/Services/Sandbox/SandboxManager.swift:2237-2243 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1208-1214 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1254-1260 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1294-1300 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1340-1346 — 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 `Packages/OsaurusCore/Services/Sandbox/SandboxManager.swift:2213` 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 × 6) Packages/OsaurusCore/Storage/ConfigHistoryDatabase.swift:94 — Packages/OsaurusCore/Storage/ConfigHistoryDatabase.swift:94-100 | Packages/OsaurusCore/Storage/EventRunDatabase.swift:93-99 | Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:120-130 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:172-182 | Packages/OsaurusCore/Storage/SchedulerDatabase.swift:229-239 | Packages/OsaurusCore/Storage/WorkflowRunDatabase.swift:87-93 — 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 6 call sites, so a change lands once.
D1 · Cyclomatic Complexity · ChatSession.dispatchSend · ×3
  • ChatSession.dispatchSend::runTurn (cyclomatic 144) Packages/OsaurusCore/Views/Chat/ChatView.swift:7829 — ChatSession.dispatchSend::runTurn has cyclomatic complexity 144 (threshold 15). To reduce it, separate the cases: extract each independent 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: 3 other methods here (ChatSession.dispatchSend, ChatSession.dispatchSend::runTurn::postProcessToolResult, ChatSession.dispatchSend::runTurn::executeToolBatch) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 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.
  • ChatSession.dispatchSend::runTurn::postProcessToolResult (cyclomatic 58) Packages/OsaurusCore/Views/Chat/ChatView.swift:8519 — ChatSession.dispatchSend::runTurn::postProcessToolResult has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent 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: 3 other methods here (ChatSession.dispatchSend, ChatSession.dispatchSend::runTurn, ChatSession.dispatchSend::runTurn::executeToolBatch) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 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.
  • ChatSession.dispatchSend::runTurn::executeToolBatch (cyclomatic 32) Packages/OsaurusCore/Views/Chat/ChatView.swift:8993 — ChatSession.dispatchSend::runTurn::executeToolBatch 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. This shape REPEATS in the file: 3 other methods here (ChatSession.dispatchSend, ChatSession.dispatchSend::runTurn, ChatSession.dispatchSend::runTurn::postProcessToolResult) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 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 · ChatSession.dispatchSend · ×3
  • ChatSession.dispatchSend::runTurn (cognitive 288) Packages/OsaurusCore/Views/Chat/ChatView.swift:7829 — ChatSession.dispatchSend::runTurn has cognitive complexity 288 (threshold 15). Drivers by points: if/else 78 (168 pts), ternaries 26 (66 pts), boolean chains 34, loops 5 (13 pts), error handling 5 (7 pts) (nesting depth added 140). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: 3 other methods here (ChatSession.dispatchSend, ChatSession.dispatchSend::runTurn::postProcessToolResult, ChatSession.dispatchSend::runTurn::executeToolBatch) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 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.
  • ChatSession.dispatchSend::runTurn::postProcessToolResult (cognitive 70) Packages/OsaurusCore/Views/Chat/ChatView.swift:8519 — ChatSession.dispatchSend::runTurn::postProcessToolResult has cognitive complexity 70 (threshold 15). Drivers by points: if/else 28 (39 pts), boolean chains 28, ternaries 2 (3 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. This shape REPEATS in the file: 3 other methods here (ChatSession.dispatchSend, ChatSession.dispatchSend::runTurn, ChatSession.dispatchSend::runTurn::executeToolBatch) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 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.
  • ChatSession.dispatchSend::runTurn::executeToolBatch (cognitive 55) Packages/OsaurusCore/Views/Chat/ChatView.swift:8993 — ChatSession.dispatchSend::runTurn::executeToolBatch has cognitive complexity 55 (threshold 15). Drivers by points: if/else 18 (37 pts), boolean chains 9, loops 4 (7 pts), error handling 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (ChatSession.dispatchSend, ChatSession.dispatchSend::runTurn, ChatSession.dispatchSend::runTurn::postProcessToolResult) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 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.
D4 · Code Duplication · Edited copy of a member (42 corresponding lines) · ×3
  • Edited copy of a member (42 corresponding lines) Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:635 — Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:635-710 | Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:925-976 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (42 corresponding lines) Packages/OsaurusCore/Services/Insights/MediaActivityLogger.swift:58 — Packages/OsaurusCore/Services/Insights/MediaActivityLogger.swift:58-99 | Packages/OsaurusCore/Services/Insights/MediaActivityLogger.swift:250-297 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (42 corresponding lines) Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:947 — Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:947-988 | Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1490-1531 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) · ×3
  • Members sharing a duplicated core (8 members, 50+ identical tokens) Packages/OsaurusCore/Networking/HTTPHandler.swift:3533 — Packages/OsaurusCore/Networking/HTTPHandler.swift:3533-3556 | Packages/OsaurusCore/Networking/HTTPHandler.swift:4048-4085 | Packages/OsaurusCore/Networking/HTTPHandler.swift:4703-4997 | Packages/OsaurusCore/Networking/HTTPHandler.swift:15169-15190 | Packages/OsaurusCore/Networking/HTTPHandler.swift:15297-15811 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18083-18231 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18865-18986 | Packages/OsaurusCore/Networking/HTTPLoopHelpers.swift:160-186 — These 8 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 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.
  • Members sharing a duplicated core (8 members, 50+ identical tokens) Packages/OsaurusCore/Networking/HTTPHandler.swift:5272 — Packages/OsaurusCore/Networking/HTTPHandler.swift:5272-5317 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6955-7045 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7096-7167 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7375-7423 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7432-7523 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7674-7769 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7853-7934 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8502-8682 — These 8 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 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.
  • Members sharing a duplicated core (8 members, 50+ identical tokens) Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2419 — Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2419-2469 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2479-2511 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2805-2847 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2851-2893 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2897-2953 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2957-2992 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:3456-3494 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:3575-3630 — These 8 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 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 · Members sharing a duplicated core (7 members, 50+ identical tokens) · ×3
  • Members sharing a duplicated core (7 members, 50+ identical tokens) Packages/OsaurusCore/Networking/HTTPHandler.swift:5659 — Packages/OsaurusCore/Networking/HTTPHandler.swift:5659-5747 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6471-6580 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6588-6747 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6955-7045 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7096-7167 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7674-7769 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7853-7934 — 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.
  • Members sharing a duplicated core (7 members, 50+ identical tokens) Packages/OsaurusCore/Services/Sandbox/SandboxManager.swift:2060 — Packages/OsaurusCore/Services/Sandbox/SandboxManager.swift:2060-2121 | Packages/OsaurusCore/Services/Sandbox/SandboxManager.swift:2210-2230 | Packages/OsaurusCore/Services/Sandbox/SandboxManager.swift:2232-2257 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1203-1227 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1249-1273 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1289-1313 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1335-1359 — 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.
  • Members sharing a duplicated core (7 members, 50+ identical tokens) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:924 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:924-952 | Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:845-870 | Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1283-1311 | Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:1724-1759 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:1237-1265 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:1112-1140 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1387-1415 — 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 · Edited copy of a member (57 corresponding lines) · ×3
  • Edited copy of a member (57 corresponding lines) Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:301 — Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:301-360 | Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:379-435 — These two members are one piece of code written twice and then edited apart: 57 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (57 corresponding lines) Packages/OsaurusCore/Storage/AgentDatabase.swift:1106 — Packages/OsaurusCore/Storage/AgentDatabase.swift:1106-1165 | Packages/OsaurusCore/Storage/AgentDatabase.swift:1268-1324 — These two members are one piece of code written twice and then edited apart: 57 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (57 corresponding lines) Packages/OsaurusCore/Views/Model/HuggingFaceTokenViews.swift:27 — Packages/OsaurusCore/Views/Model/HuggingFaceTokenViews.swift:27-83 | Packages/OsaurusCore/Views/Plugin/GitHubTokenViews.swift:29-86 — These two members are one piece of code written twice and then edited apart: 57 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (43 corresponding lines) · ×3
  • Edited copy of a member (43 corresponding lines) Packages/OsaurusCore/Services/Method/MethodSearchService.swift:135 — Packages/OsaurusCore/Services/Method/MethodSearchService.swift:135-177 | Packages/OsaurusCore/Services/Tool/ToolSearchService.swift:352-400 — These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (43 corresponding lines) Packages/OsaurusCore/Views/Plugin/GitHubImportSheet.swift:1183 — Packages/OsaurusCore/Views/Plugin/GitHubImportSheet.swift:1183-1225 | Packages/OsaurusCore/Views/Plugin/GitHubImportSheet.swift:1241-1290 — These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (43 corresponding lines) Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:1604 — Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:1604-1657 | Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:1709-1751 — These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (38 corresponding lines) · ×3
  • Edited copy of a member (38 corresponding lines) Packages/OsaurusCore/Views/Chat/NativeBlockViews.swift:935 — Packages/OsaurusCore/Views/Chat/NativeBlockViews.swift:935-972 | Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:1581-1644 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (38 corresponding lines) Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:503 — Packages/OsaurusCore/Services/IMessage/IMessageRPCClient.swift:503-540 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppRPCClient.swift:597-634 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (38 corresponding lines) Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:742 — Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:742-779 | Packages/OsaurusCore/Views/Settings/AgentChannelSettingsComponents.swift:268-307 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 24+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 24+ corresponding lines) Packages/OsaurusCore/Storage/MemoryDatabase.swift:1461 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:1461-1484 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:1882-1905 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2321-2349 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 24+ corresponding lines) Packages/OsaurusCore/Storage/ConfigHistoryDatabase.swift:56 — Packages/OsaurusCore/Storage/ConfigHistoryDatabase.swift:56-79 | Packages/OsaurusCore/Storage/EventRunDatabase.swift:55-78 | Packages/OsaurusCore/Storage/TaskDatabase.swift:112-138 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 24+ corresponding lines) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/AgentLoopRegressionLabCLI.swift:169 — Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/AgentLoopRegressionLabCLI.swift:169-192 | Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalReviewReportCLI.swift:316-339 | Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/OsaurusEvalsCLI.swift:447-475 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 27+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 27+ corresponding lines) Packages/OsaurusCore/Networking/HTTPHandler.swift:3558 — Packages/OsaurusCore/Networking/HTTPHandler.swift:3558-3586 | Packages/OsaurusCore/Networking/HTTPHandler.swift:3588-3614 | Packages/OsaurusCore/Networking/HTTPHandler.swift:3616-3642 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 27 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 27+ corresponding lines) Packages/OsaurusCore/Services/Inference/MLXService.swift:255 — Packages/OsaurusCore/Services/Inference/MLXService.swift:255-281 | Packages/OsaurusCore/Services/Inference/MLXService.swift:283-309 | Packages/OsaurusCore/Services/Inference/MLXService.swift:311-341 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 27 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 27+ corresponding lines) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/MCPCommand.swift:235 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/MCPCommand.swift:235-262 | Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/AgentLoopRegressionLabCLI.swift:207-244 | Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalScoreboardCLI.swift:68-94 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 27 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 18+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 18+ corresponding lines) Packages/OsaurusCore/Views/Tool/ToolCatalogRows.swift:342 — Packages/OsaurusCore/Views/Tool/ToolCatalogRows.swift:342-359 | Packages/OsaurusCore/Views/Tool/ToolCatalogRows.swift:400-420 | Packages/OsaurusCore/Views/Tool/ToolCatalogRows.swift:472-490 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 18+ corresponding lines) Packages/OsaurusCore/Services/Discord/DiscordPollingTransportRuntime.swift:45 — Packages/OsaurusCore/Services/Discord/DiscordPollingTransportRuntime.swift:45-62 | Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:75-95 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppWatchTransportRuntime.swift:61-81 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 18+ corresponding lines) Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1258 — Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1258-1277 | Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1633-1650 | Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1659-1678 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 15+ corresponding lines) · ×3
  • Edited copies of one member (4 members, 15+ corresponding lines) Packages/OsaurusCore/Networking/HTTPHandler.swift:5511 — Packages/OsaurusCore/Networking/HTTPHandler.swift:5511-5525 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6442-6465 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7532-7554 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12489-12510 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 15+ corresponding lines) Packages/OsaurusCore/Browser/BrowserConfigurationStore.swift:38 — Packages/OsaurusCore/Browser/BrowserConfigurationStore.swift:38-54 | Packages/OsaurusCore/ComputerUse/Policy/ComputerUsePolicyStore.swift:24-40 | Packages/OsaurusCore/Models/Configuration/MCPProviderConfiguration.swift:454-468 | Packages/OsaurusCore/Models/Tool/ToolConfigurationStore.swift:15-29 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 15+ corresponding lines) Packages/OsaurusCore/Views/DesignSystem/SettingsFilters.swift:35 — Packages/OsaurusCore/Views/DesignSystem/SettingsFilters.swift:35-51 | Packages/OsaurusCore/Views/DesignSystem/SettingsNavigation.swift:338-352 | Packages/OsaurusCore/Views/DesignSystem/SettingsRow.swift:770-784 | Packages/OsaurusCore/Views/DesignSystem/SettingsRow.swift:825-841 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 9+ corresponding lines) · ×3
  • Edited copies of one member (4 members, 9+ corresponding lines) Packages/OsaurusCore/Services/Template/WorkflowsRegistryAPIClient.swift:1036 — Packages/OsaurusCore/Services/Template/WorkflowsRegistryAPIClient.swift:1036-1044 | Packages/OsaurusCore/Services/Template/WorkflowsRegistryAPIClient.swift:1047-1056 | Packages/OsaurusCore/Services/Template/WorkflowsRegistryAPIClient.swift:1060-1073 | Packages/OsaurusCore/Services/Template/WorkflowsRegistryAPIClient.swift:1076-1087 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 9+ corresponding lines) Packages/OsaurusCore/Storage/AgentDatabase.swift:2609 — Packages/OsaurusCore/Storage/AgentDatabase.swift:2609-2617 | Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:1207-1216 | Packages/OsaurusCore/Storage/FileHistoryDatabase.swift:577-586 | Packages/OsaurusCore/Storage/SchedulerDatabase.swift:614-623 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 9+ corresponding lines) Packages/OsaurusCore/ComputerUse/Driver/MacDriver.swift:111 — Packages/OsaurusCore/ComputerUse/Driver/MacDriver.swift:111-127 | Packages/OsaurusCore/ComputerUse/Driver/MacDriver.swift:266-284 | Packages/OsaurusCore/ComputerUse/Driver/MacDriver.swift:296-304 | Packages/OsaurusCore/Services/Documents/WorkbookWorkflowService.swift:102-118 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (7 members, 10+ corresponding lines) · ×3
  • Edited copies of one member (7 members, 10+ corresponding lines) Packages/OsaurusCore/Storage/ActivityLogStore.swift:1137 — Packages/OsaurusCore/Storage/ActivityLogStore.swift:1137-1148 | Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1919-1933 | Packages/OsaurusCore/Storage/AgentDatabase.swift:2619-2631 | Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:1270-1280 | Packages/OsaurusCore/Storage/FileHistoryDatabase.swift:630-640 | Packages/OsaurusCore/Storage/SchedulerDatabase.swift:667-679 | Packages/OsaurusCore/Storage/TaskDatabase.swift:639-648 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
  • Edited copies of one member (7 members, 10+ corresponding lines) Packages/OsaurusCore/Models/API/AnthropicAPI.swift:103 — Packages/OsaurusCore/Models/API/AnthropicAPI.swift:103-118 | Packages/OsaurusCore/Models/API/AnthropicAPI.swift:157-172 | Packages/OsaurusCore/Models/API/AnthropicAPI.swift:367-382 | Packages/OsaurusCore/Models/API/EmbeddingAPI.swift:25-37 | Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:120-135 | Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:342-357 | Packages/OsaurusCore/Services/HuggingFaceService.swift:163-172 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
  • Edited copies of one member (7 members, 10+ corresponding lines) Packages/OsaurusCore/Models/Configuration/ModelExposureStore.swift:132 — Packages/OsaurusCore/Models/Configuration/ModelExposureStore.swift:132-141 | Packages/OsaurusCore/Models/Configuration/RelayConfiguration.swift:52-61 | Packages/OsaurusCore/Models/Configuration/RemoteProviderConfiguration.swift:573-596 | Packages/OsaurusCore/Models/Voice/SpeechConfiguration.swift:241-252 | Packages/OsaurusCore/Models/Voice/TTSConfiguration.swift:162-173 | Packages/OsaurusCore/Models/Voice/TranscriptionConfiguration.swift:55-66 | Packages/OsaurusCore/Models/Voice/VADConfiguration.swift:107-118 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 4+ corresponding lines) · ×3
  • Edited copies of one member (4 members, 4+ corresponding lines) Packages/OsaurusCore/Models/Workflow/BindingRenderer.swift:346 — Packages/OsaurusCore/Models/Workflow/BindingRenderer.swift:346-349 | Packages/OsaurusCore/Models/Workflow/WorkflowAccessScope.swift:337-340 | Packages/OsaurusCore/Views/Workflow/WorkflowFormView.swift:116-119 | Packages/OsaurusCore/Views/Workflow/WorkflowRunView.swift:619-622 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 4+ corresponding lines) Packages/OsaurusCore/AppleApps/Calendar/CalendarTools.swift:109 — Packages/OsaurusCore/AppleApps/Calendar/CalendarTools.swift:109-112 | Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:46-49 | Packages/OsaurusCore/AppleApps/Notes/NotesTools.swift:52-55 | Packages/OsaurusCore/AppleApps/Reminders/RemindersTools.swift:59-62 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 4+ corresponding lines) Packages/OsaurusCore/Managers/Model/ModelPickerItemCache.swift:502 — Packages/OsaurusCore/Managers/Model/ModelPickerItemCache.swift:502-505 | Packages/OsaurusCore/Models/Configuration/ModelPickerItem.swift:480-483 | Packages/OsaurusCore/Services/MediaGeneration/VeniceMediaCatalog.swift:301-304 | Packages/OsaurusCore/Views/Chat/ChatView.swift:10653-10656 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 5+ corresponding lines) · ×3
  • Edited copies of one member (4 members, 5+ corresponding lines) Packages/OsaurusCore/Managers/SkillManager.swift:1011 — Packages/OsaurusCore/Managers/SkillManager.swift:1011-1015 | Packages/OsaurusCore/Views/Chat/NativeArtifactCardView.swift:897-901 | Packages/OsaurusCore/Views/Chat/NativeCompactionMarkerView.swift:306-310 | Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:303-311 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 5+ corresponding lines) Packages/OsaurusCore/Models/AgentDelegation/SubagentConfigurationStore.swift:179 — Packages/OsaurusCore/Models/AgentDelegation/SubagentConfigurationStore.swift:179-183 | Packages/OsaurusCore/Models/Plugin/SandboxConfiguration.swift:245-249 | Packages/OsaurusCore/Services/Sync/SyncConversationStore.swift:101-105 | Packages/OsaurusCore/Utils/ConfigDiskWriter.swift:51-55 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 5+ corresponding lines) Packages/OsaurusCore/Models/Channels/ChannelIdentity.swift:120 — Packages/OsaurusCore/Models/Channels/ChannelIdentity.swift:120-124 | Packages/OsaurusCore/Models/Channels/ChannelRemoteSafetyPolicy.swift:238-242 | Packages/OsaurusCore/Services/Channels/ChannelRemoteSafetyGate.swift:501-505 | Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:2247-2251 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (1 corresponding lines) · ×3
  • Edited copy of a member (1 corresponding lines) Packages/OsaurusCore/DevelopmentDesign/CatalogInspector.swift:874 — Packages/OsaurusCore/DevelopmentDesign/CatalogInspector.swift:874-874 | Packages/OsaurusCore/DevelopmentDesign/DesignInspectorView.swift:249-249 — These two members are one piece of code written twice and then edited apart: 1 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (1 corresponding lines) Packages/OsaurusCore/DevelopmentDesign/InspectorMessagingParts.swift:87 — Packages/OsaurusCore/DevelopmentDesign/InspectorMessagingParts.swift:87-87 | Packages/OsaurusCore/Views/Chat/TerminalDisplayView.swift:675-677 — These two members are one piece of code written twice and then edited apart: 1 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (1 corresponding lines) Packages/OsaurusCore/Services/Inference/ResponsesToolChoiceContract.swift:65 — Packages/OsaurusCore/Services/Inference/ResponsesToolChoiceContract.swift:65-67 | Packages/OsaurusCore/Services/Provider/RemoteAnthropicNativeStream.swift:154-154 — These two members are one piece of code written twice and then edited apart: 1 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×3
  • Duplicated block (26 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:18087 — Packages/OsaurusCore/Networking/HTTPHandler.swift:18087-18112 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18868-18893 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:18087` 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 (26 lines × 2) Packages/OsaurusCore/Views/Chat/ChatView.swift:5958 — Packages/OsaurusCore/Views/Chat/ChatView.swift:5958-5983 | Packages/OsaurusCore/Views/Chat/ChatView.swift:5987-6012 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Chat/ChatView.swift:5958` 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 (26 lines × 2) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:608 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:608-633 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:745-770 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:608` 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 (21–23 lines × 2) · ×3
  • Duplicated block (21–23 lines × 2) Packages/OsaurusCore/Services/Chat/ChatTitleService.swift:88 — Packages/OsaurusCore/Services/Chat/ChatTitleService.swift:88-110 | Packages/OsaurusCore/Services/Chat/FollowUpSuggestionService.swift:117-137 — 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 `Packages/OsaurusCore/Services/Chat/ChatTitleService.swift:88` 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 (21–23 lines × 2) Packages/OsaurusCore/Tools/Database/DatabaseImport.swift:222 — Packages/OsaurusCore/Tools/Database/DatabaseImport.swift:222-244 | Packages/OsaurusCore/Tools/Database/DatabaseImport.swift:328-348 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/Database/DatabaseImport.swift:222` 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 (21–23 lines × 2) Packages/OsaurusCore/Views/Settings/BrowserSettingsView.swift:197 — Packages/OsaurusCore/Views/Settings/BrowserSettingsView.swift:197-219 | Packages/OsaurusCore/Views/Settings/ComputerUseSettingsView.swift:285-305 — 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 `Packages/OsaurusCore/Views/Settings/BrowserSettingsView.swift:197` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Views/Settings/BrowserSettingsView.swift:220` calls `frame` and `Packages/OsaurusCore/Views/Settings/ComputerUseSettingsView.swift:306` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (15–18 lines × 2) · ×3
  • Duplicated block (15–18 lines × 2) Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:346 — Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:346-360 | Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:942-959 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:346` 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 (15–18 lines × 2) Packages/OsaurusCore/Managers/Chat/ChatSessionImporter.swift:489 — Packages/OsaurusCore/Managers/Chat/ChatSessionImporter.swift:489-506 | Packages/OsaurusCore/Managers/Chat/ChatSessionImporter.swift:617-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 `Packages/OsaurusCore/Managers/Chat/ChatSessionImporter.swift:489` 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–18 lines × 2) Packages/OsaurusCore/Services/ModelRuntime.swift:8404 — Packages/OsaurusCore/Services/ModelRuntime.swift:8404-8418 | Packages/OsaurusCore/Services/ModelRuntime.swift:8420-8437 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/ModelRuntime.swift:8404` 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 (16–17 lines × 2) · ×3
  • Duplicated block (16–17 lines × 2) Packages/OsaurusCore/AppleScript/Tool/AppleScriptToolDispatch.swift:379 — Packages/OsaurusCore/AppleScript/Tool/AppleScriptToolDispatch.swift:379-394 | Packages/OsaurusCore/AppleScript/Tool/AppleScriptToolDispatch.swift:529-545 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/AppleScript/Tool/AppleScriptToolDispatch.swift:379` 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 (16–17 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:2073 — Packages/OsaurusCore/Networking/HTTPHandler.swift:2073-2088 | Packages/OsaurusCore/Networking/HTTPHandler.swift:2140-2156 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:2073` 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 (16–17 lines × 2) Packages/OsaurusCore/Views/Chat/MessageTableRepresentable.swift:382 — Packages/OsaurusCore/Views/Chat/MessageTableRepresentable.swift:382-398 | Packages/OsaurusCore/Views/Chat/MessageTableRepresentable.swift:448-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 `Packages/OsaurusCore/Views/Chat/MessageTableRepresentable.swift:382` 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 lines × 4) · ×3
  • Duplicated block (15 lines × 4) Packages/OsaurusCore/Networking/HTTPHandler.swift:10890 — Packages/OsaurusCore/Networking/HTTPHandler.swift:10890-10904 | Packages/OsaurusCore/Networking/HTTPHandler.swift:10930-10944 | Packages/OsaurusCore/Networking/HTTPHandler.swift:10956-10970 | Packages/OsaurusCore/Networking/HTTPHandler.swift:11006-11020 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:10890` 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 (15 lines × 4) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:524 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:524-538 | Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:790-804 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:653-667 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:991-1005 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 138 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 `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:524` 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 × 4) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:901 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:901-915 | Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1256-1270 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:1089-1103 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1360-1374 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 138 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 `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:901` 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 (9–15 lines × 2) · ×3
  • Duplicated block (9–15 lines × 2) Packages/OsaurusCore/Services/GitHubSkillService.swift:1890 — Packages/OsaurusCore/Services/GitHubSkillService.swift:1890-1898 | Packages/OsaurusCore/Services/GitHubSkillService.swift:1983-1997 — both copies are in the same file, so extract the 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.
  • Duplicated block (9–15 lines × 2) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3837 — Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3837-3845 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3931-3945 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3837` 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–15 lines × 2) Packages/OsaurusCore/Tools/OsaurusTool.swift:225 — Packages/OsaurusCore/Tools/OsaurusTool.swift:225-233 | Packages/OsaurusCore/Tools/OsaurusTool.swift:268-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. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/OsaurusTool.swift:225` 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 × 3) · ×3
  • Duplicated block (14 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:17580 — Packages/OsaurusCore/Networking/HTTPHandler.swift:17580-17593 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17749-17762 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17785-17798 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:17580` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 3) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:111 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:111-124 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:125-138 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:129-142 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 260 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 `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:111` 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 × 3) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:1520 — Packages/OsaurusCore/Views/Plugin/PluginsView.swift:1520-1533 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:1668-1681 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:1702-1715 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `systemName` to `"lock.shield.fill") .glyphSize(.xlarge) .foregroundColor(theme.status.warning.foreground) VStack(alignment: .leading` in one and `"key.fill") .glyphSize(.xlarge) .foregroundColor(theme.status.warning.foreground) VStack(alignment: .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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Packages/OsaurusCore/Views/Plugin/PluginsView.swift:1700` calls `VStack` and `Packages/OsaurusCore/Views/Plugin/PluginsView.swift:1666` 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–14 lines × 2) · ×3
  • Duplicated block (12–14 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:12652 — Packages/OsaurusCore/Networking/HTTPHandler.swift:12652-12663 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12681-12694 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:12652` 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–14 lines × 2) Packages/OsaurusCore/Subagent/SubagentSession.swift:578 — Packages/OsaurusCore/Subagent/SubagentSession.swift:578-589 | Packages/OsaurusCore/Subagent/SubagentSession.swift:638-651 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–14 lines × 2) Packages/OsaurusCore/Tools/WebSearchTools.swift:322 — Packages/OsaurusCore/Tools/WebSearchTools.swift:322-333 | Packages/OsaurusCore/Tools/WebSearchTools.swift:530-543 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/WebSearchTools.swift:530` 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 × 4) · ×3
  • Duplicated block (13 lines × 4) Packages/OsaurusCore/Networking/HTTPHandler.swift:13306 — Packages/OsaurusCore/Networking/HTTPHandler.swift:13306-13318 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17206-17218 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17288-17300 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17627-17639 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:13306` 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 × 4) Packages/OsaurusCore/Networking/HTTPHandler.swift:17208 — Packages/OsaurusCore/Networking/HTTPHandler.swift:17208-17220 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17290-17302 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17629-17641 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18381-18394 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:17208` 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 × 4) Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:1322 — Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:1322-1334 | Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:1360-1372 | Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:1431-1443 | Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:1471-1483 — 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 `Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:1322` 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–13 lines × 3) · ×3
  • Duplicated block (10–13 lines × 3) Packages/OsaurusCore/Services/Auth/ConsentPanelPresenter.swift:79 — Packages/OsaurusCore/Services/Auth/ConsentPanelPresenter.swift:79-88 | Packages/OsaurusCore/Services/MCP/MCPElicitationPromptService.swift:228-237 | Packages/OsaurusCore/Services/ToolPermissionPromptService.swift:896-908 — 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 `Packages/OsaurusCore/Services/Auth/ConsentPanelPresenter.swift:79` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–13 lines × 3) Packages/OsaurusCore/Services/Memory/MemorySearchService.swift:335 — Packages/OsaurusCore/Services/Memory/MemorySearchService.swift:335-347 | Packages/OsaurusCore/Services/Memory/MemorySearchService.swift:382-391 | Packages/OsaurusCore/Services/Memory/MemorySearchService.swift:449-458 — 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 `Packages/OsaurusCore/Services/Memory/MemorySearchService.swift:335` 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–13 lines × 3) Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:67 — Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:67-76 | Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:766-778 | Packages/OsaurusCore/Views/Settings/AgentChannelSettingsComponents.swift:295-306 — 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 `Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:67` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–12 lines × 2) · ×3
  • Duplicated block (10–12 lines × 2) Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:244 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:244-255 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:612-621 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:244` 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 (10–12 lines × 2) Packages/OsaurusCore/Services/GitHubSkillService.swift:174 — Packages/OsaurusCore/Services/GitHubSkillService.swift:174-183 | Packages/OsaurusCore/Services/GitHubSkillService.swift:999-1010 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/GitHubSkillService.swift:174` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–12 lines × 2) Packages/OsaurusCore/Services/Harness/PiRPCAdapter.swift:253 — Packages/OsaurusCore/Services/Harness/PiRPCAdapter.swift:253-262 | Packages/OsaurusCore/Services/Inference/ClaudeCodeStreamDecoder.swift:143-154 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (11 lines × 6) · ×3
  • Duplicated block (11 lines × 6) Packages/OsaurusCore/Networking/HTTPHandler.swift:1579 — Packages/OsaurusCore/Networking/HTTPHandler.swift:1579-1589 | Packages/OsaurusCore/Networking/HTTPHandler.swift:1873-1883 | Packages/OsaurusCore/Networking/HTTPHandler.swift:1946-1956 | Packages/OsaurusCore/Networking/HTTPHandler.swift:2020-2030 | Packages/OsaurusCore/Networking/HTTPHandler.swift:2316-2326 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16731-16741 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:1579` 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 × 6) Packages/OsaurusCore/Networking/HTTPHandler.swift:17206 — Packages/OsaurusCore/Networking/HTTPHandler.swift:17206-17216 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17288-17298 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17580-17590 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17627-17637 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17749-17759 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17785-17795 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 6) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:453 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:453-463 | Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:605-615 | Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1011-1021 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:531-541 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:616-626 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1108-1118 — 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 6 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:453` 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–10 lines × 3) · ×3
  • Duplicated block (9–10 lines × 3) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1358 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1358-1367 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:1418-1427 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:1529-1537 — 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 `Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1358` 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–10 lines × 3) Packages/OsaurusCore/Services/ModelRuntime.swift:1536 — Packages/OsaurusCore/Services/ModelRuntime.swift:1536-1544 | Packages/OsaurusCore/Services/ModelRuntime.swift:1592-1600 | Packages/OsaurusCore/Services/ModelRuntime.swift:3108-3117 — 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. 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 × 3) Packages/OsaurusCore/Views/Agent/AgentsView.swift:5614 — Packages/OsaurusCore/Views/Agent/AgentsView.swift:5614-5623 | Packages/OsaurusCore/Views/Project/ProjectsView.swift:400-408 | Packages/OsaurusCore/Views/Settings/OrchestratorSupportSections.swift:194-202 — 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (8–9 lines × 3) · ×3
  • Duplicated block (8–9 lines × 3) Packages/OsaurusCore/Services/Provider/OpenAICodexOAuthService.swift:473 — Packages/OsaurusCore/Services/Provider/OpenAICodexOAuthService.swift:473-481 | Packages/OsaurusCore/Services/Provider/ProviderReplayDiagnostics.swift:239-246 | Packages/OsaurusCore/Services/Provider/XAIOAuthService.swift:334-342 — 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 `Packages/OsaurusCore/Services/Provider/OpenAICodexOAuthService.swift:473` 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 first that the copies are not typed on the same thing: the declarations holding them bind `maxLength` to `Int = 240` in one and `Int = 700` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (8–9 lines × 3) Packages/OsaurusCore/Services/Sandbox/SandboxManager.swift:2062 — Packages/OsaurusCore/Services/Sandbox/SandboxManager.swift:2062-2069 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1205-1213 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1291-1299 — 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. 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–9 lines × 3) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalDiffMatrixCLI.swift:90 — Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalDiffMatrixCLI.swift:90-97 | Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalDiffMatrixCLI.swift:183-190 | Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalDiffMatrixCLI.swift:277-285 — 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 `Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalDiffMatrixCLI.swift:277` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8 lines × 5) · ×3
  • Duplicated block (8 lines × 5) Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:75 — Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:75-82 | Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:241-248 | Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:318-325 | Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:381-388 | Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:482-489 — 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 `Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:75` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:379` calls `SearchRequestParam` and `Packages/OsaurusCore/Models/Configuration/SearchProviderCatalog.swift:239` 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 × 5) Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:503 — Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:503-510 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:629-636 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:877-884 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:1740-1747 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:1811-1818 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:886` calls `SettingsFieldRow`, `SettingsTextField`, `L` and `Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:638` 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 × 5) Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:543 — Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:543-550 | Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:152-159 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:195-202 | Packages/OsaurusCore/Storage/MethodDatabase.swift:115-122 | Packages/OsaurusCore/Storage/ToolDatabase.swift:170-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 all 5 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (6 lines × 5) · ×3
  • Duplicated block (6 lines × 5) Packages/OsaurusCore/Views/Agent/Setup/AgentSetupWizardView.swift:174 — Packages/OsaurusCore/Views/Agent/Setup/AgentSetupWizardView.swift:174-179 | Packages/OsaurusCore/Views/Agent/Templates/AgentTemplateSheets.swift:64-69 | Packages/OsaurusCore/Views/Template/TemplateImportSheet.swift:84-89 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowBundleSetupView.swift:162-167 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowSetupWizardView.swift:248-253 — 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 `Packages/OsaurusCore/Views/Agent/Setup/AgentSetupWizardView.swift:174` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 5) Packages/OsaurusCore/Models/AgentChannel/AgentChannelConfiguration.swift:718 — Packages/OsaurusCore/Models/AgentChannel/AgentChannelConfiguration.swift:718-724 | Packages/OsaurusCore/Models/Discord/DiscordConnectionConfiguration.swift:74-80 | Packages/OsaurusCore/Models/IMessage/IMessageConnectionConfiguration.swift:222-228 | Packages/OsaurusCore/Models/Slack/SlackConnectionConfiguration.swift:178-183 | Packages/OsaurusCore/Models/WhatsApp/WhatsAppConnectionConfiguration.swift:177-183 — before extracting anything, compare `Packages/OsaurusCore/Models/Discord/DiscordConnectionConfiguration.swift` and `Packages/OsaurusCore/Models/Slack/SlackConnectionConfiguration.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 5) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:997 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:997-1002 | Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1352-1357 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:1318-1323 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:1175-1180 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1456-1461 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 138 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.
D3 · God Classes · FunctionTooLong · ×2
  • FunctionTooLong: MarkdownBlockParsing.swift.parseBlocks Packages/OsaurusCore/Utils/MarkdownBlockParsing.swift:151 — FunctionTooLong — parseBlocks runs 220 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 120 over it, 2.20× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: main.swift.top-level code Packages/OsaurusCore/JSHost/main.swift:30 — FunctionTooLong — top-level code runs 104 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 4 over it, 1.04× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
D4 · Code Duplication · Near-duplicate member pair (64 shared lines) · ×2
  • Near-duplicate member pair (64 shared lines) Packages/OsaurusCore/Networking/HTTPHandler.swift:13992 — Packages/OsaurusCore/Networking/HTTPHandler.swift:13992-14075 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14077-14177 — These two members are variants of one another: 64 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.
  • Near-duplicate member pair (64 shared lines) Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:100 — Packages/OsaurusCore/Services/IMessage/IMessageWatchTransportRuntime.swift:100-208 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppWatchTransportRuntime.swift:85-187 — These two members are variants of one another: 64 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Edited copy of a member (62 corresponding lines) · ×2
  • Edited copy of a member (62 corresponding lines) Packages/OsaurusCore/Views/Event/EventFormComponents.swift:786 — Packages/OsaurusCore/Views/Event/EventFormComponents.swift:786-853 | Packages/OsaurusCore/Views/Event/EventFormComponents.swift:1292-1353 — These two members are one piece of code written twice and then edited apart: 62 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (62 corresponding lines) Packages/OsaurusCore/Views/Plugin/ClaudePluginCard.swift:95 — Packages/OsaurusCore/Views/Plugin/ClaudePluginCard.swift:95-160 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:1132-1193 — These two members are one piece of code written twice and then edited apart: 62 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (56 corresponding lines) · ×2
  • Edited copy of a member (56 corresponding lines) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalScoreboard.swift:612 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalScoreboard.swift:612-667 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalScoreboard.swift:669-728 — These two members are one piece of code written twice and then edited apart: 56 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (56 corresponding lines) Packages/OsaurusCore/Views/Plugin/ToolsManagerView.swift:750 — Packages/OsaurusCore/Views/Plugin/ToolsManagerView.swift:750-805 | Packages/OsaurusCore/Views/Plugin/ToolsManagerView.swift:835-892 — These two members are one piece of code written twice and then edited apart: 56 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (49 corresponding lines) · ×2
  • Edited copy of a member (49 corresponding lines) Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1206 — Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1206-1254 | Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1432-1488 — These two members are one piece of code written twice and then edited apart: 49 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (49 corresponding lines) Packages/OsaurusCore/Services/ModelRuntime/ModelResidencyManager.swift:69 — Packages/OsaurusCore/Services/ModelRuntime/ModelResidencyManager.swift:69-128 | Packages/OsaurusCore/Services/ModelRuntime/ModelResidencyManager.swift:150-198 — These two members are one piece of code written twice and then edited apart: 49 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (52 corresponding lines) · ×2
  • Edited copy of a member (52 corresponding lines) Packages/OsaurusCore/Views/Plugin/GitHubImportSheet.swift:950 — Packages/OsaurusCore/Views/Plugin/GitHubImportSheet.swift:950-1001 | Packages/OsaurusCore/Views/Plugin/GitHubImportSheet.swift:1034-1092 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (52 corresponding lines) Packages/OsaurusCore/Services/Chat/SystemPromptTemplates.swift:1747 — Packages/OsaurusCore/Services/Chat/SystemPromptTemplates.swift:1747-1799 | Packages/OsaurusCore/Services/Chat/SystemPromptTemplates.swift:1901-1952 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (37 corresponding lines) · ×2
  • Edited copy of a member (37 corresponding lines) Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:2412 — Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:2412-2451 | Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:1676-1712 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (37 corresponding lines) Packages/OsaurusCore/Views/Model/ModelCacheInspectorView.swift:229 — Packages/OsaurusCore/Views/Model/ModelCacheInspectorView.swift:229-265 | Packages/OsaurusCore/Views/Model/ModelCacheInspectorView.swift:287-323 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (48 corresponding lines) · ×2
  • Edited copy of a member (48 corresponding lines) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:331 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:331-378 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:399-447 — These two members are one piece of code written twice and then edited apart: 48 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (48 corresponding lines) Packages/OsaurusCore/ComputerUse/Driver/Mac/BackgroundDriver.swift:305 — Packages/OsaurusCore/ComputerUse/Driver/Mac/BackgroundDriver.swift:305-352 | Packages/OsaurusCore/ComputerUse/Driver/Mac/InputController.swift:65-114 — These two members are one piece of code written twice and then edited apart: 48 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 22+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 22+ corresponding lines) Packages/OsaurusCore/Models/IMessage/IMessageConnectionConfiguration.swift:119 — Packages/OsaurusCore/Models/IMessage/IMessageConnectionConfiguration.swift:119-158 | Packages/OsaurusCore/Models/Slack/SlackConnectionConfiguration.swift:150-176 | Packages/OsaurusCore/Models/Telegram/TelegramConnectionConfiguration.swift:63-84 | Packages/OsaurusCore/Models/WhatsApp/WhatsAppConnectionConfiguration.swift:102-125 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 22 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 22+ corresponding lines) Packages/OsaurusCore/Storage/FileHistoryDatabase.swift:52 — Packages/OsaurusCore/Storage/FileHistoryDatabase.swift:52-73 | Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:130-156 | Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:81-105 | Packages/OsaurusCore/Storage/WorkflowRunDatabase.swift:51-72 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 22 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 29+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 29+ corresponding lines) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:3489 — Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:3489-3518 | Packages/OsaurusCore/Views/Chat/ChatTabStripView.swift:997-1028 | Packages/OsaurusCore/Views/Chat/ChatTabStripView.swift:1033-1061 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 29 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 29+ corresponding lines) Packages/OsaurusCore/Services/MediaGeneration/MediaGenerationTypes.swift:158 — Packages/OsaurusCore/Services/MediaGeneration/MediaGenerationTypes.swift:158-186 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:1210-1238 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:3015-3043 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 29 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 13+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 13+ corresponding lines) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1139 — Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1139-1152 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1180-1194 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1230-1245 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1268-1280 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 13+ corresponding lines) Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:704 — Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:704-722 | Packages/OsaurusCore/Services/Email/EmailChannelService.swift:294-306 | Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:479-499 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:574-594 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 23+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 23+ corresponding lines) Packages/OsaurusCore/Models/Agent/RemoteAgent.swift:66 — Packages/OsaurusCore/Models/Agent/RemoteAgent.swift:66-92 | Packages/OsaurusCore/Services/Sandbox/SandboxStartupMetrics.swift:110-132 | Packages/OsaurusCore/Services/Search/SearchTypes.swift:73-95 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 23+ corresponding lines) Packages/OsaurusCore/Models/BackgroundTaskModels.swift:363 — Packages/OsaurusCore/Models/BackgroundTaskModels.swift:363-385 | Packages/OsaurusCore/Models/BackgroundTaskModels.swift:390-414 | Packages/OsaurusCore/Models/BackgroundTaskModels.swift:418-445 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 22+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 22+ corresponding lines) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:235 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:235-256 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:262-283 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:253-274 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 22 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 22+ corresponding lines) Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:436 — Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:436-461 | Packages/OsaurusCore/Storage/RouterBillingDatabase.swift:270-299 | Packages/OsaurusCore/Storage/ToolDatabase.swift:201-222 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 22 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 10+ corresponding lines) · ×2
  • Edited copies of one member (5 members, 10+ corresponding lines) Packages/OsaurusCore/Services/ChunkedFileDownloader.swift:434 — Packages/OsaurusCore/Services/ChunkedFileDownloader.swift:434-443 | Packages/OsaurusCore/Services/Documents/DocumentFileInspector.swift:73-84 | Packages/OsaurusCore/Services/FileHistory/FileObjectStore.swift:302-311 | Packages/OsaurusCore/Services/Sandbox/SandboxManager.swift:3448-3464 | Packages/OsaurusCore/Services/Sandbox/SandboxResumableDownloader.swift:352-365 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 10+ corresponding lines) Packages/OsaurusCore/Models/BackgroundTaskModels.swift:60 — Packages/OsaurusCore/Models/BackgroundTaskModels.swift:60-75 | Packages/OsaurusCore/Views/Settings/OrchestratorSupportSections.swift:383-392 | Packages/OsaurusCore/Views/Workflow/FlowViewer/WorkflowFlowCanvas.swift:553-563 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowLibraryKit.swift:600-609 | Packages/OsaurusCore/Views/Workflow/WorkflowRunHistoryList.swift:24-33 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 11+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 11+ corresponding lines) Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:379 — Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:379-389 | Packages/OsaurusCore/Services/Discord/DiscordAPIClient.swift:391-402 | Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:735-745 | Packages/OsaurusCore/Services/Telegram/TelegramAPIClient.swift:513-527 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 11+ corresponding lines) Packages/OsaurusCore/Storage/MemoryDatabase.swift:986 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:986-996 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:1055-1070 | Packages/OsaurusCore/Storage/MethodDatabase.swift:222-234 | Packages/OsaurusCore/Storage/ToolDatabase.swift:309-319 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 19+ corresponding lines) · ×2
  • Edited copies of one member (5 members, 19+ corresponding lines) Packages/OsaurusCore/Services/AgentBridge/LocalAgentBridge.swift:230 — Packages/OsaurusCore/Services/AgentBridge/LocalAgentBridge.swift:230-248 | Packages/OsaurusCore/Services/AgentBridge/LocalAgentBridge.swift:268-286 | Packages/OsaurusCore/Services/AgentBridge/LocalAgentBridge.swift:288-311 | Packages/OsaurusCore/Services/AgentBridge/LocalAgentBridge.swift:313-333 | Packages/OsaurusCore/Services/AgentBridge/LocalAgentBridge.swift:443-469 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 19+ corresponding lines) Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:294 — Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:294-318 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:320-343 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:345-366 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:371-394 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:465-483 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 10+ corresponding lines) · ×2
  • Edited copies of one member (6 members, 10+ corresponding lines) Packages/OsaurusCore/Storage/ActivityLogStore.swift:1095 — Packages/OsaurusCore/Storage/ActivityLogStore.swift:1095-1104 | Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1872-1881 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:975-984 | Packages/OsaurusCore/Storage/MethodDatabase.swift:209-220 | Packages/OsaurusCore/Storage/RouterBillingDatabase.swift:320-329 | Packages/OsaurusCore/Storage/ToolDatabase.swift:298-307 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
  • Edited copies of one member (6 members, 10+ corresponding lines) Packages/OsaurusCore/Managers/InsightsService.swift:256 — Packages/OsaurusCore/Managers/InsightsService.swift:256-265 | Packages/OsaurusCore/Managers/InsightsService.swift:267-278 | Packages/OsaurusCore/Managers/InsightsService.swift:474-483 | Packages/OsaurusCore/Managers/InsightsService.swift:485-496 | Packages/OsaurusCore/Managers/InsightsService.swift:500-509 | Packages/OsaurusCore/Managers/InsightsService.swift:559-568 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 7+ corresponding lines) · ×2
  • Edited copies of one member (5 members, 7+ corresponding lines) Packages/OsaurusCore/Services/Router/OsaurusRouterAPIClient.swift:518 — Packages/OsaurusCore/Services/Router/OsaurusRouterAPIClient.swift:518-531 | Packages/OsaurusCore/Services/Router/OsaurusRouterAPIClient.swift:533-546 | Packages/OsaurusCore/Services/Router/OsaurusRouterAPIClient.swift:628-634 | Packages/OsaurusCore/Services/Router/OsaurusRouterAPIClient.swift:636-642 | Packages/OsaurusCore/Services/Router/OsaurusRouterAPIClient.swift:663-669 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 7+ corresponding lines) Packages/OsaurusCore/Browser/Runtime/BrowserSupport.swift:37 — Packages/OsaurusCore/Browser/Runtime/BrowserSupport.swift:37-44 | Packages/OsaurusCore/Browser/Runtime/BrowserSupport.swift:47-54 | Packages/OsaurusCore/Models/Tool/ToolExposureDiagnostic.swift:217-223 | Packages/OsaurusCore/Storage/PluginDatabase.swift:428-434 | Packages/OsaurusCore/Views/Chat/ChatView.swift:2964-2970 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 7+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 7+ corresponding lines) Packages/OsaurusCore/Services/Chat/ChatEngine.swift:574 — Packages/OsaurusCore/Services/Chat/ChatEngine.swift:574-581 | Packages/OsaurusCore/Services/Chat/ChatEngine.swift:616-624 | Packages/OsaurusCore/Views/Plugin/SandboxPluginEditorView.swift:512-520 | Packages/OsaurusCore/Views/Template/ListingEditorViews.swift:355-361 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 7+ corresponding lines) Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:137 — Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:137-145 | Packages/OsaurusCore/Models/Theme/ThemeTokens.swift:288-294 | Packages/OsaurusRepository/BundleOnboarding.swift:71-77 | Packages/OsaurusRepository/BundleSettings.swift:31-37 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 3+ corresponding lines) · ×2
  • Edited copies of one member (5 members, 3+ corresponding lines) Packages/OsaurusCore/Models/Configuration/GeminiReasoningContract.swift:65 — Packages/OsaurusCore/Models/Configuration/GeminiReasoningContract.swift:65-68 | Packages/OsaurusCore/Services/Chat/ModelFamilyGuidance.swift:128-130 | Packages/OsaurusCore/Services/ModelRuntime/ImageModelDownloadService.swift:37-39 | Packages/OsaurusCore/Views/Agent/Creation/AgentDraftPanel.swift:836-838 | Packages/OsaurusCore/Views/Agent/Templates/AgentTemplateCard.swift:208-210 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 3+ corresponding lines) Packages/OsaurusCore/Services/Credentials/Consumers/MCPCredentials.swift:51 — Packages/OsaurusCore/Services/Credentials/Consumers/MCPCredentials.swift:51-53 | Packages/OsaurusCore/Services/Keychain/ToolSecretsKeychain.swift:300-302 | Packages/OsaurusCore/Services/MCP/MCPProviderKeychain.swift:184-186 | Packages/OsaurusCore/Services/Provider/RemoteProviderKeychain.swift:218-220 | Packages/OsaurusCore/Tools/Handoff/ArchitectInlineHandoff.swift:387-389 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 1+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 1+ corresponding lines) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:95 — Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:95-97 | Packages/OsaurusCore/Models/Theme/InspectionAdapters/InspectorNativeComponentStyle.swift:7-7 | Packages/OsaurusCore/Utils/OsaurusPaths.swift:693-695 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 1 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 1+ corresponding lines) Packages/OsaurusCore/Models/Theme/BaseComponentAssignments.swift:121 — Packages/OsaurusCore/Models/Theme/BaseComponentAssignments.swift:121-121 | Packages/OsaurusCore/Models/Theme/DesignLibrary/AssignedBaseSegmentedPicker.swift:21-21 | Packages/OsaurusCore/Models/Theme/DesignLibrary/AssignedBaseSlider.swift:18-18 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 1 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (43 lines × 2) · ×2
  • Duplicated block (43 lines × 2) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1067 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1067-1109 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:1177-1219 — 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 `Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1067` 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, `Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:1221` calls `sendReadReceiptsIfEnabled` and `Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1113` 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 (43 lines × 2) Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:1028 — Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:1028-1070 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:1979-2021 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (39 lines × 2) · ×2
  • Duplicated block (39 lines × 2) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:703 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:703-741 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:904-942 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 680 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.
  • Duplicated block (39 lines × 2) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1137 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1137-1175 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1241-1279 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 680 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 `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1137` 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 (37 lines × 2) · ×2
  • Duplicated block (37 lines × 2) Packages/OsaurusCore/Models/Agent/Skill.swift:171 — Packages/OsaurusCore/Models/Agent/Skill.swift:171-207 | Packages/OsaurusCore/Models/Agent/Skill.swift:337-373 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Models/Agent/Skill.swift:171` 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 (37 lines × 2) Packages/OsaurusCore/Subagent/SubagentSession.swift:807 — Packages/OsaurusCore/Subagent/SubagentSession.swift:807-843 | Packages/OsaurusCore/Subagent/SubagentSession.swift:873-909 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Subagent/SubagentSession.swift:807` 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 (30 lines × 2) · ×2
  • Duplicated block (30 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:16101 — Packages/OsaurusCore/Networking/HTTPHandler.swift:16101-16130 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16386-16415 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:16101` 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 (30 lines × 2) Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:956 — Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:956-985 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:1904-1933 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:956` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:1936` calls `VStack` and `Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:988` 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 (26 lines × 3) · ×2
  • Duplicated block (26 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:1835 — Packages/OsaurusCore/Networking/HTTPHandler.swift:1835-1860 | Packages/OsaurusCore/Networking/HTTPHandler.swift:1906-1931 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16882-16907 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:1835` 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 (26 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:6001 — Packages/OsaurusCore/Networking/HTTPHandler.swift:6001-6026 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8836-8861 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8954-8979 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:6001` 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 (21–22 lines × 2) · ×2
  • Duplicated block (21–22 lines × 2) Packages/OsaurusCore/ComputerUse/Driver/Mac/BackgroundDriver.swift:310 — Packages/OsaurusCore/ComputerUse/Driver/Mac/BackgroundDriver.swift:310-331 | Packages/OsaurusCore/ComputerUse/Driver/Mac/InputController.swift:66-86 — 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 `Packages/OsaurusCore/ComputerUse/Driver/Mac/BackgroundDriver.swift:310` 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 (21–22 lines × 2) Packages/OsaurusCore/Services/Chat/SystemPromptTemplates.swift:1751 — Packages/OsaurusCore/Services/Chat/SystemPromptTemplates.swift:1751-1771 | Packages/OsaurusCore/Services/Chat/SystemPromptTemplates.swift:1910-1931 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Chat/SystemPromptTemplates.swift:1910` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (20 lines × 3) · ×2
  • Duplicated block (20 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:2111 — Packages/OsaurusCore/Networking/HTTPHandler.swift:2111-2130 | Packages/OsaurusCore/Networking/HTTPHandler.swift:2146-2165 | Packages/OsaurusCore/Networking/HTTPHandler.swift:2180-2199 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:2111` 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 (20 lines × 3) Packages/OsaurusCore/Services/Chat/GroundedConfigClaimCheck.swift:315 — Packages/OsaurusCore/Services/Chat/GroundedConfigClaimCheck.swift:315-334 | Packages/OsaurusCore/Services/Chat/GroundedFileSideEffectCheck.swift:144-163 | Packages/OsaurusCore/Services/Chat/GroundedKnowledgeClaimCheck.swift:195-214 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (17–20 lines × 2) · ×2
  • Duplicated block (17–20 lines × 2) Packages/OsaurusCore/Models/Event/ScheduleTiming.swift:110 — Packages/OsaurusCore/Models/Event/ScheduleTiming.swift:110-126 | Packages/OsaurusCore/Models/Schedule/ScheduleRunHistory.swift:310-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. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Models/Event/ScheduleTiming.swift:110` 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 (17–20 lines × 2) Packages/OsaurusCore/Services/AgentChannel/AgentChannelPublishService.swift:975 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelPublishService.swift:975-994 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelPublishService.swift:1009-1025 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/AgentChannel/AgentChannelPublishService.swift:975` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (17–19 lines × 2) · ×2
  • Duplicated block (17–19 lines × 2) Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool.swift:596 — Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool.swift:596-614 | Packages/OsaurusCore/Networking/HTTPHandler.swift:2594-2610 — 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 (17–19 lines × 2) Packages/OsaurusCore/Storage/AgentDatabase.swift:1108 — Packages/OsaurusCore/Storage/AgentDatabase.swift:1108-1126 | Packages/OsaurusCore/Storage/AgentDatabase.swift:1270-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 `Packages/OsaurusCore/Storage/AgentDatabase.swift:1108` 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–19 lines × 2) · ×2
  • Duplicated block (15–19 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:7376 — Packages/OsaurusCore/Networking/HTTPHandler.swift:7376-7390 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8873-8891 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:7376` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15–19 lines × 2) Packages/OsaurusCore/Services/MCP/MCPElicitationPromptService.swift:228 — Packages/OsaurusCore/Services/MCP/MCPElicitationPromptService.swift:228-242 | Packages/OsaurusCore/Services/ToolPermissionPromptService.swift:896-914 — 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 `Packages/OsaurusCore/Services/MCP/MCPElicitationPromptService.swift:228` 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 (18 lines × 4) · ×2
  • Duplicated block (18 lines × 4) Packages/OsaurusCore/Networking/HTTPProtocolErrors.swift:95 — Packages/OsaurusCore/Networking/HTTPProtocolErrors.swift:95-112 | Packages/OsaurusCore/Networking/HTTPProtocolErrors.swift:145-162 | Packages/OsaurusCore/Networking/HTTPProtocolErrors.swift:166-183 | Packages/OsaurusCore/Networking/HTTPProtocolErrors.swift:187-204 — 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 `Packages/OsaurusCore/Networking/HTTPProtocolErrors.swift:95` 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 (18 lines × 4) Packages/OsaurusCore/Storage/ConfigHistoryDatabase.swift:143 — Packages/OsaurusCore/Storage/ConfigHistoryDatabase.swift:143-160 | Packages/OsaurusCore/Storage/EventRunDatabase.swift:131-148 | Packages/OsaurusCore/Storage/TaskDatabase.swift:183-200 | Packages/OsaurusCore/Storage/WorkflowRunDatabase.swift:106-123 — 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 `Packages/OsaurusCore/Storage/ConfigHistoryDatabase.swift:143` 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 (18 lines × 3) · ×2
  • Duplicated block (18 lines × 3) Packages/OsaurusCore/Services/Chat/ChatEngine.swift:867 — Packages/OsaurusCore/Services/Chat/ChatEngine.swift:867-884 | Packages/OsaurusCore/Services/Chat/ChatEngine.swift:1987-2004 | Packages/OsaurusCore/Services/Chat/ChatEngine.swift:2155-2172 — 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 `Packages/OsaurusCore/Services/Chat/ChatEngine.swift:867` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 3) Packages/OsaurusCore/Services/LocalGenerationDefaults.swift:262 — Packages/OsaurusCore/Services/LocalGenerationDefaults.swift:262-279 | Packages/OsaurusCore/Services/LocalGenerationDefaults.swift:350-367 | Packages/OsaurusCore/Services/LocalGenerationDefaults.swift:399-416 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (12–17 lines × 2) · ×2
  • Duplicated block (12–17 lines × 2) Packages/OsaurusCore/Identity/MasterKey.swift:282 — Packages/OsaurusCore/Identity/MasterKey.swift:282-298 | Packages/OsaurusCore/Identity/MasterMnemonicStore.swift:63-74 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12–17 lines × 2) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1558 — Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1558-1569 | Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1897-1913 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1897` 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.
D4 · Code Duplication · Duplicated block (15–16 lines × 3) · ×2
  • Duplicated block (15–16 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:687 — Packages/OsaurusCore/Networking/HTTPHandler.swift:687-702 | Packages/OsaurusCore/Networking/HTTPHandler.swift:748-763 | Packages/OsaurusCore/Networking/HTTPHandler.swift:871-885 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:687` 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 (15–16 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:10422 — Packages/OsaurusCore/Networking/HTTPHandler.swift:10422-10436 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16955-16970 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17063-17078 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:10422` 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 × 2) · ×2
  • Duplicated block (15–16 lines × 2) Packages/OsaurusCore/Models/Configuration/ServerRuntimeSettingsStore.swift:626 — Packages/OsaurusCore/Models/Configuration/ServerRuntimeSettingsStore.swift:626-640 | Packages/OsaurusCore/Models/Configuration/ServerRuntimeSettingsStore.swift:665-680 — both copies are in the same file, so extract the 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.
  • Duplicated block (15–16 lines × 2) Packages/OsaurusCore/Services/Attention/OwnerApprovalService.swift:309 — Packages/OsaurusCore/Services/Attention/OwnerApprovalService.swift:309-324 | Packages/OsaurusCore/Services/Attention/OwnerApprovalService.swift:480-494 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Attention/OwnerApprovalService.swift:309` 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–16 lines × 2) · ×2
  • Duplicated block (13–16 lines × 2) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:862 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:862-874 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:996-1011 — 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 `Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:996` 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. 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 (13–16 lines × 2) Packages/OsaurusCore/Views/Skill/SkillEditorSheet.swift:182 — Packages/OsaurusCore/Views/Skill/SkillEditorSheet.swift:182-194 | Packages/OsaurusCore/Views/Skill/SkillEditorSheet.swift:246-261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Skill/SkillEditorSheet.swift:182` 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–15 lines × 2) · ×2
  • Duplicated block (13–15 lines × 2) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:6635 — Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:6635-6647 | Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:6781-6795 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:6635` 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–15 lines × 2) Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:613 — Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:613-625 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:712-726 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:613` 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–15 lines × 2) · ×2
  • Duplicated block (11–15 lines × 2) Packages/OsaurusCore/Subagent/Kinds/ImageSubagentKind.swift:217 — Packages/OsaurusCore/Subagent/Kinds/ImageSubagentKind.swift:217-231 | Packages/OsaurusCore/Subagent/Kinds/VideoSubagentKind.swift:95-105 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (11–15 lines × 2) Packages/OsaurusCore/Views/Settings/ClaudeCodeSetupStep.swift:138 — Packages/OsaurusCore/Views/Settings/ClaudeCodeSetupStep.swift:138-152 | Packages/OsaurusCore/Views/Settings/ClaudeCodeSetupStep.swift:242-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 `Packages/OsaurusCore/Views/Settings/ClaudeCodeSetupStep.swift:138` 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 `spacing` to `theme.space.s14` in one and `theme.space.s8` 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–15 lines × 2) · ×2
  • Duplicated block (10–15 lines × 2) Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:3710 — Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:3710-3719 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:3754-3768 — both copies are in the same file, so extract the 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–15 lines × 2) Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:64 — Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:64-73 | Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:761-775 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:64` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14 lines × 5) · ×2
  • Duplicated block (14 lines × 5) Packages/OsaurusCore/Networking/HTTPHandler.swift:1573 — Packages/OsaurusCore/Networking/HTTPHandler.swift:1573-1586 | Packages/OsaurusCore/Networking/HTTPHandler.swift:1867-1880 | Packages/OsaurusCore/Networking/HTTPHandler.swift:1940-1953 | Packages/OsaurusCore/Networking/HTTPHandler.swift:2014-2027 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16725-16738 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:1573` 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 × 5) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:551 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:551-564 | Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:710-723 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:721-734 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:427-440 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:911-924 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 138 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 `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:551` 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 (10–14 lines × 3) · ×2
  • Duplicated block (10–14 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:7181 — Packages/OsaurusCore/Networking/HTTPHandler.swift:7181-7190 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7382-7391 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8879-8892 — 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, `Packages/OsaurusCore/Networking/HTTPHandler.swift:8893` calls `split`, `String` and `Packages/OsaurusCore/Networking/HTTPHandler.swift:7191` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10–14 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:10289 — Packages/OsaurusCore/Networking/HTTPHandler.swift:10289-10302 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12885-12895 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12963-12972 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:10289` 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 (11–14 lines × 2) · ×2
  • Duplicated block (11–14 lines × 2) Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:1568 — Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:1568-1581 | Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:1811-1821 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (11–14 lines × 2) Packages/OsaurusCore/Tools/KnowledgeTools.swift:364 — Packages/OsaurusCore/Tools/KnowledgeTools.swift:364-374 | Packages/OsaurusCore/Tools/KnowledgeTools.swift:776-789 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/KnowledgeTools.swift:364` 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 (8–14 lines × 2) · ×2
  • Duplicated block (8–14 lines × 2) Packages/OsaurusCore/Models/BackgroundTaskModels.swift:62 — Packages/OsaurusCore/Models/BackgroundTaskModels.swift:62-75 | Packages/OsaurusCore/Views/Settings/OrchestratorSupportSections.swift:385-392 — 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 `Packages/OsaurusCore/Models/BackgroundTaskModels.swift:62` 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–14 lines × 2) Packages/OsaurusCore/Views/Agent/Templates/AgentTemplateSheets.swift:396 — Packages/OsaurusCore/Views/Agent/Templates/AgentTemplateSheets.swift:396-403 | Packages/OsaurusCore/Views/Workflow/Library/RenameInstalledWorkflowSheet.swift:62-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 `Packages/OsaurusCore/Views/Agent/Templates/AgentTemplateSheets.swift:396` 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–13 lines × 4) · ×2
  • Duplicated block (11–13 lines × 4) Packages/OsaurusCore/Networking/HTTPHandler.swift:10425 — Packages/OsaurusCore/Networking/HTTPHandler.swift:10425-10435 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14222-14233 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16957-16969 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17065-17077 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:14222` 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–13 lines × 4) Packages/OsaurusCore/Storage/MemoryDatabase.swift:1595 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:1595-1607 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2002-2014 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2891-2901 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2912-2922 — 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 `Packages/OsaurusCore/Storage/MemoryDatabase.swift:1595` 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 (13 lines × 3) · ×2
  • Duplicated block (13 lines × 3) Packages/OsaurusCore/Models/API/AnthropicAPI.swift:131 — Packages/OsaurusCore/Models/API/AnthropicAPI.swift:131-143 | Packages/OsaurusCore/Models/API/AnthropicAPI.swift:185-197 | Packages/OsaurusCore/Models/API/AnthropicAPI.swift:394-406 — 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 (13 lines × 3) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1308 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1308-1320 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:1310-1322 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:1474-1486 — 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 `config` to `IMessageConnectionConfiguration` in one and `TelegramConnectionConfiguration` 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 (11–13 lines × 3) · ×2
  • Duplicated block (11–13 lines × 3) Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:339 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:339-351 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:369-379 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:382-392 — 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 `Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:339` 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–13 lines × 3) Packages/OsaurusCore/Services/Channels/ChannelSecurityDiagnostics.swift:99 — Packages/OsaurusCore/Services/Channels/ChannelSecurityDiagnostics.swift:99-109 | Packages/OsaurusCore/Services/SupportDiagnosticsBundle.swift:468-478 | Packages/OsaurusCore/Services/Voice/MarkdownStripper.swift:47-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 `Packages/OsaurusCore/Services/Channels/ChannelSecurityDiagnostics.swift:99` 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 (9–12 lines × 2) · ×2
  • Duplicated block (9–12 lines × 2) Packages/OsaurusCore/Services/Knowledge/KnowledgeIndexService.swift:188 — Packages/OsaurusCore/Services/Knowledge/KnowledgeIndexService.swift:188-199 | Packages/OsaurusCore/Services/Knowledge/KnowledgeIndexService.swift:213-221 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Knowledge/KnowledgeIndexService.swift:188` 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–12 lines × 2) Packages/OsaurusCore/Views/Voice/TranscriptionSettingsTab.swift:340 — Packages/OsaurusCore/Views/Voice/TranscriptionSettingsTab.swift:340-351 | Packages/OsaurusCore/Views/Voice/VADModeSettingsTab.swift:301-309 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Voice/TranscriptionSettingsTab.swift:340` 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 `title` to `"Stop Behavior & Cleanup"` in one and `"Behavior"` 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 (11 lines × 5) · ×2
  • Duplicated block (11 lines × 5) Packages/OsaurusCore/Networking/HTTPHandler.swift:14861 — Packages/OsaurusCore/Networking/HTTPHandler.swift:14861-14871 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14885-14895 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14909-14919 | Packages/OsaurusCore/Networking/HTTPHandler.swift:15331-15341 | Packages/OsaurusCore/Networking/HTTPHandler.swift:15358-15368 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:14861` 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 × 5) Packages/OsaurusCore/Services/Provider/ProviderNetworkDiagnostics.swift:236 — Packages/OsaurusCore/Services/Provider/ProviderNetworkDiagnostics.swift:236-246 | Packages/OsaurusCore/Services/Provider/ProviderNetworkDiagnostics.swift:254-264 | Packages/OsaurusCore/Services/Provider/ProviderNetworkDiagnostics.swift:273-283 | Packages/OsaurusCore/Services/Provider/ProviderNetworkDiagnostics.swift:554-564 | Packages/OsaurusCore/Services/Provider/ProviderNetworkDiagnostics.swift:572-582 — 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 `Packages/OsaurusCore/Services/Provider/ProviderNetworkDiagnostics.swift:236` 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 first that the copies are not typed on the same thing: the declarations holding them bind `provider` to `RemoteProvider` in one and `MCPProvider` 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 (11 lines × 4) · ×2
  • Duplicated block (11 lines × 4) Packages/OsaurusCore/Networking/HTTPHandler.swift:5944 — Packages/OsaurusCore/Networking/HTTPHandler.swift:5944-5954 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6066-6076 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8400-8410 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8774-8784 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:5944` 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 × 4) Packages/OsaurusCore/Networking/HTTPHandler.swift:10284 — Packages/OsaurusCore/Networking/HTTPHandler.swift:10284-10294 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12880-12890 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12958-12968 | Packages/OsaurusCore/Networking/HTTPHandler.swift:13036-13046 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:10284` 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–10 lines × 3) · ×2
  • Duplicated block (8–10 lines × 3) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3550 — Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3550-3559 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1876-1883 | Packages/OsaurusCore/Tools/SandboxSecretTools.swift:133-140 — 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 `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3550` 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–10 lines × 3) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:555 — Packages/OsaurusCore/Views/Plugin/PluginsView.swift:555-564 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:684-693 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:2263-2270 — 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 `Packages/OsaurusCore/Views/Plugin/PluginsView.swift:555` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Views/Plugin/PluginsView.swift:696` calls `install` and `Packages/OsaurusCore/Views/Plugin/PluginsView.swift:567` 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 (4–10 lines × 3) · ×2
  • Duplicated block (4–10 lines × 3) Packages/OsaurusCore/Models/Project/Project.swift:61 — Packages/OsaurusCore/Models/Project/Project.swift:61-64 | Packages/OsaurusCore/Models/Schedule/Schedule.swift:594-603 | Packages/OsaurusCore/Models/Watcher/Watcher.swift:186-195 — 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 `Packages/OsaurusCore/Models/Project/Project.swift:61` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Packages/OsaurusCore/Models/Schedule/Schedule.swift:593` calls `container`, `decode` and `Packages/OsaurusCore/Models/Project/Project.swift:61` 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 (4–10 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:15710 — Packages/OsaurusCore/Networking/HTTPHandler.swift:15710-15713 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18147-18156 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18902-18911 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:18147` 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 lines × 5) · ×2
  • Duplicated block (9 lines × 5) Packages/OsaurusCore/AppleScript/Loop/AppleScriptTraceLog.swift:150 — Packages/OsaurusCore/AppleScript/Loop/AppleScriptTraceLog.swift:150-158 | Packages/OsaurusCore/ComputerUse/Loop/ComputerUseTraceLog.swift:142-150 | Packages/OsaurusCore/Managers/TTSService.swift:786-794 | Packages/OsaurusCore/Services/ModelRuntime/PrefillDebugLog.swift:101-109 | Packages/OsaurusCore/Utils/KnowledgeLogger.swift:69-77 — before extracting anything, compare `Packages/OsaurusCore/AppleScript/Loop/AppleScriptTraceLog.swift` and `Packages/OsaurusCore/ComputerUse/Loop/ComputerUseTraceLog.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 45 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 `Packages/OsaurusCore/AppleScript/Loop/AppleScriptTraceLog.swift:150` 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 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 (9 lines × 5) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:185 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:185-193 | Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:187-195 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:212-220 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:203-211 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:195-203 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 138 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:189` calls `stopPairing` and `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:175` 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 (7–8 lines × 3) · ×2
  • Duplicated block (7–8 lines × 3) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/List.swift:22 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/List.swift:22-28 | Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Run.swift:38-44 | Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Show.swift:115-122 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (7–8 lines × 3) Packages/OsaurusCore/Views/Agent/AgentsView.swift:5367 — Packages/OsaurusCore/Views/Agent/AgentsView.swift:5367-5373 | Packages/OsaurusCore/Views/Identity/AgentKeyManagement.swift:172-178 | Packages/OsaurusCore/Views/Voice/VoiceSetupTab.swift:389-396 — 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 `Packages/OsaurusCore/Views/Agent/AgentsView.swift:5367` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6–7 lines × 3) · ×2
  • Duplicated block (6–7 lines × 3) Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1449 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1449-1455 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1464-1469 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1518-1524 — 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 `Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1449` 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 (6–7 lines × 3) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:730 — Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:730-736 | Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:763-768 | Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:780-786 — 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 `Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:730` 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 (6 lines × 10) · ×2
  • Duplicated block (6 lines × 10) Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:30 — Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:30-35 | Packages/OsaurusCore/Storage/EventRunDatabase.swift:26-31 | Packages/OsaurusCore/Storage/FileHistoryDatabase.swift:27-32 | Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:40-45 | Packages/OsaurusCore/Storage/MethodDatabase.swift:24-29 | Packages/OsaurusCore/Storage/RouterBillingDatabase.swift:30-35 | Packages/OsaurusCore/Storage/SchedulerDatabase.swift:33-38 | Packages/OsaurusCore/Storage/TaskDatabase.swift:32-37 | Packages/OsaurusCore/Storage/ToolDatabase.swift:24-29 | Packages/OsaurusCore/Storage/WorkflowRunDatabase.swift:27-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 all 10 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:30` 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 × 10) Packages/OsaurusCore/Networking/HTTPHandler.swift:5635 — Packages/OsaurusCore/Networking/HTTPHandler.swift:5635-5640 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6090-6095 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6936-6941 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7073-7078 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7197-7202 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7646-7651 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7835-7840 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8028-8033 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8085-8090 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8289-8294 — all 10 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:5635` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 7) · ×2
  • Duplicated block (6 lines × 7) Packages/OsaurusCore/Networking/HTTPHandler.swift:5301 — Packages/OsaurusCore/Networking/HTTPHandler.swift:5301-5317 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7029-7045 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7156-7167 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7418-7423 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7512-7523 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7758-7769 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7918-7934 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:5301` 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 × 7) Packages/OsaurusCore/Storage/MemoryDatabase.swift:1513 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:1513-1518 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:1544-1549 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:1928-1933 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:1959-1964 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2308-2313 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2404-2409 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2432-2437 — 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 `Packages/OsaurusCore/Storage/MemoryDatabase.swift:1513` 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 first that the copies are not typed on the same thing: the declarations holding them bind `limit` to `Int = MemoryConfiguration.fallbackSearchLimit` in one and `Int = 200` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Packages/OsaurusCore/Storage/MemoryDatabase.swift:2403` calls `sqlite3_bind_int`, `Int32` and `Packages/OsaurusCore/Storage/MemoryDatabase.swift:1512` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (5–6 lines × 2) · ×2
  • Duplicated block (5–6 lines × 2) Packages/OsaurusCore/Folder/FolderContextService.swift:315 — Packages/OsaurusCore/Folder/FolderContextService.swift:315-320 | Packages/OsaurusCore/Folder/FolderContextService.swift:357-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 `Packages/OsaurusCore/Folder/FolderContextService.swift:315` 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–6 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:7150 — Packages/OsaurusCore/Networking/HTTPHandler.swift:7150-7154 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7911-7916 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:7150` 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 (5 lines × 17) · ×2
  • Duplicated block (5 lines × 17) Packages/OsaurusCore/Storage/ActivityLogStore.swift:38 — Packages/OsaurusCore/Storage/ActivityLogStore.swift:38-42 | Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:25-32 | Packages/OsaurusCore/Storage/AgentDatabase.swift:48-52 | Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:27-31 | Packages/OsaurusCore/Storage/ConfigHistoryDatabase.swift:24-28 | Packages/OsaurusCore/Storage/EventRunDatabase.swift:23-27 | Packages/OsaurusCore/Storage/FileHistoryDatabase.swift:24-28 | Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:29-33 | Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:37-41 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:35-39 | Packages/OsaurusCore/Storage/MethodDatabase.swift:21-25 | Packages/OsaurusCore/Storage/PluginDatabase.swift:18-22 | Packages/OsaurusCore/Storage/RouterBillingDatabase.swift:27-31 | Packages/OsaurusCore/Storage/SchedulerDatabase.swift:30-34 | Packages/OsaurusCore/Storage/TaskDatabase.swift:29-33 | Packages/OsaurusCore/Storage/ToolDatabase.swift:21-25 | Packages/OsaurusCore/Storage/WorkflowRunDatabase.swift:24-28 — 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 17 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Storage/ActivityLogStore.swift:38` 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, `Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:22` calls `invalidReceiveEvent` and `Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:24` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 17) Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:321 — Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:321-325 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:445-449 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:534-538 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:606-610 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:699-703 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:795-799 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:861-865 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:915-919 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:987-991 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:1079-1083 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:1239-1243 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:1432-1436 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:1572-1576 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:1639-1643 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:1735-1739 | Packages/OsaurusCore/Tools/Database/SchedulerTools.swift:131-135 | Packages/OsaurusCore/Tools/Database/SchedulerTools.swift:320-324 — there are 17 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 17 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:321` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:327` calls `requireString`, `value` and `Packages/OsaurusCore/Tools/Database/SchedulerTools.swift:137` 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 (5 lines × 13) · ×2
  • Duplicated block (5 lines × 13) Packages/OsaurusCore/Networking/HTTPHandler.swift:3551 — Packages/OsaurusCore/Networking/HTTPHandler.swift:3551-3555 | Packages/OsaurusCore/Networking/HTTPHandler.swift:4079-4084 | Packages/OsaurusCore/Networking/HTTPHandler.swift:4818-4822 | Packages/OsaurusCore/Networking/HTTPHandler.swift:4915-4919 | Packages/OsaurusCore/Networking/HTTPHandler.swift:4982-4986 | Packages/OsaurusCore/Networking/HTTPHandler.swift:15186-15190 | Packages/OsaurusCore/Networking/HTTPHandler.swift:15720-15725 | Packages/OsaurusCore/Networking/HTTPHandler.swift:15786-15791 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18163-18167 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18213-18217 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18918-18922 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18968-18972 | Packages/OsaurusCore/Networking/HTTPLoopHelpers.swift:181-185 — there are 13 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 13 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:3551` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 13) Packages/OsaurusCore/Tools/AgentChannelTools.swift:458 — Packages/OsaurusCore/Tools/AgentChannelTools.swift:458-462 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:512-516 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:567-571 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:631-635 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:690-694 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:748-752 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:812-816 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:862-866 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:908-912 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:964-968 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1030-1034 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1100-1104 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1247-1251 — all 13 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 `Packages/OsaurusCore/Tools/AgentChannelTools.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. 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, `Packages/OsaurusCore/Tools/AgentChannelTools.swift:687` calls `value`, `requireString` and `Packages/OsaurusCore/Tools/AgentChannelTools.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.
D4 · Code Duplication · Duplicated block (5 lines × 6) · ×2
  • Duplicated block (5 lines × 6) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:305 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:305-309 | Packages/OsaurusCore/PrivacyFilter/Model/PrivacyFilterModelDownloader.swift:450-454 | Packages/OsaurusCore/Services/HuggingFaceService.swift:244-248 | Packages/OsaurusCore/Services/HuggingFaceService.swift:374-378 | Packages/OsaurusCore/Services/HuggingFaceService.swift:772-776 | Packages/OsaurusCore/Services/HuggingFaceService.swift:1011-1015 — there are 6 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 6 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (5 lines × 6) Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:112 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:112-116 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:131-135 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:149-153 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:162-166 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:180-184 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:198-202 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×2
  • Duplicated block (5 lines × 5) Packages/OsaurusCore/Networking/HTTPHandler.swift:15465 — Packages/OsaurusCore/Networking/HTTPHandler.swift:15465-15470 | Packages/OsaurusCore/Networking/HTTPHandler.swift:15936-15941 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16251-16256 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17944-17950 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18616-18620 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:15465` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Networking/HTTPHandler.swift:17952` calls `writeMessageStart` and `Packages/OsaurusCore/Networking/HTTPHandler.swift:15472` 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 × 5) Packages/OsaurusCore/PrivacyFilter/Model/PrivacyFilterModelDownloader.swift:465 — Packages/OsaurusCore/PrivacyFilter/Model/PrivacyFilterModelDownloader.swift:465-469 | Packages/OsaurusCore/Services/HuggingFaceService.swift:454-458 | Packages/OsaurusCore/Services/HuggingFaceService.swift:779-784 | Packages/OsaurusCore/Services/HuggingFaceService.swift:874-878 | Packages/OsaurusCore/Services/HuggingFaceService.swift:1018-1022 — there are 5 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/PrivacyFilter/Model/PrivacyFilterModelDownloader.swift:465` 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, `Packages/OsaurusCore/Services/HuggingFaceService.swift:776` calls `URLQueryItem` and `Packages/OsaurusCore/Services/HuggingFaceService.swift:451` 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.
D1 · Cyclomatic Complexity · HTTPHandler.channelRead (cyclomatic 272) · ×1
  • HTTPHandler.channelRead (cyclomatic 272) Packages/OsaurusCore/Networking/HTTPHandler.swift:495 — HTTPHandler.channelRead has cyclomatic complexity 272 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HTTPHandler.handleAgentRunEndpoint (cyclomatic 205) · ×1
  • HTTPHandler.handleAgentRunEndpoint (cyclomatic 205) Packages/OsaurusCore/Networking/HTTPHandler.swift:10496 — HTTPHandler.handleAgentRunEndpoint has cyclomatic complexity 205 (threshold 15). Of this number, 196 points are the body's own statements and 9 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 · ConfigEvents.build (cyclomatic 188) · ×1
  • ConfigEvents.build (cyclomatic 188) Packages/OsaurusCore/Configuration/Declarative/ConfigEvents.swift:383 — ConfigEvents.build has cyclomatic complexity 188 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AppleScriptLoop.run (cyclomatic 172) · ×1
  • AppleScriptLoop.run (cyclomatic 172) Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:310 — AppleScriptLoop.run has cyclomatic complexity 172 (threshold 15). Of this number, 170 points are the body's own statements and 2 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 · ConfigPlanner.validate (cyclomatic 172) · ×1
  • ConfigPlanner.validate (cyclomatic 172) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:423 — ConfigPlanner.validate has cyclomatic complexity 172 (threshold 15). Of this number, 170 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 · AgentToolLoop.runHoldingResidency (cyclomatic 172) · ×1
  • AgentToolLoop.runHoldingResidency (cyclomatic 172) Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:2359 — AgentToolLoop.runHoldingResidency has cyclomatic complexity 172 (threshold 15). Of this number, 166 points are the body's own statements and 6 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 · WorkflowValidator.validateNode (cyclomatic 161) · ×1
  • WorkflowValidator.validateNode (cyclomatic 161) Packages/OsaurusCore/Models/Workflow/WorkflowValidator.swift:413 — WorkflowValidator.validateNode has cyclomatic complexity 161 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SubagentSession.runPreparedHost (cyclomatic 124) · ×1
  • SubagentSession.runPreparedHost (cyclomatic 124) Packages/OsaurusCore/Subagent/SubagentSession.swift:549 — SubagentSession.runPreparedHost has cyclomatic complexity 124 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SystemPromptComposer.resolveTools (cyclomatic 117) · ×1
  • SystemPromptComposer.resolveTools (cyclomatic 117) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:2766 — SystemPromptComposer.resolveTools has cyclomatic complexity 117 (threshold 15). Of this number, 114 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TokenizerBridge.applyChatTemplate (cyclomatic 116) · ×1
  • TokenizerBridge.applyChatTemplate (cyclomatic 116) Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.swift:211 — TokenizerBridge.applyChatTemplate has cyclomatic complexity 116 (threshold 15). Of this number, 114 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ContentBlock.generateBlocks (cyclomatic 113) · ×1
  • ContentBlock.generateBlocks (cyclomatic 113) Packages/OsaurusCore/Models/Chat/ContentBlock.swift:646 — ContentBlock.generateBlocks has cyclomatic complexity 113 (threshold 15). Of this number, 112 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 · XLSXEditor.shiftRows (cyclomatic 112) · ×1
  • XLSXEditor.shiftRows (cyclomatic 112) Packages/OsaurusCore/Services/Documents/OOXML/XLSXEditor.swift:328 — XLSXEditor.shiftRows has cyclomatic complexity 112 (threshold 15). Of this number, 109 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EvalRunner.runAgentLoopCaseWithSettings (cyclomatic 109) · ×1
  • EvalRunner.runAgentLoopCaseWithSettings (cyclomatic 109) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerAgentLoop.swift:33 — EvalRunner.runAgentLoopCaseWithSettings has cyclomatic complexity 109 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChatView.chatModeContent (cyclomatic 105) · ×1
  • ChatView.chatModeContent (cyclomatic 105) Packages/OsaurusCore/Views/Chat/ChatView.swift:11698 — ChatView.chatModeContent has cyclomatic complexity 105 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OsaurusBundle.load (cyclomatic 96) · ×1
  • OsaurusBundle.load (cyclomatic 96) Packages/OsaurusRepository/OsaurusBundle.swift:379 — OsaurusBundle.load has cyclomatic complexity 96 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EvalRunner.runCacheProofCase (cyclomatic 91) · ×1
  • EvalRunner.runCacheProofCase (cyclomatic 91) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerCacheProof.swift:158 — EvalRunner.runCacheProofCase has cyclomatic complexity 91 (threshold 15). Of this number, 87 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · LocalVisionEvidence.read (cyclomatic 89) · ×1
  • LocalVisionEvidence.read (cyclomatic 89) Packages/OsaurusCore/Models/Configuration/LocalVisionEvidence.swift:136 — LocalVisionEvidence.read has cyclomatic complexity 89 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentLoopEvaluator.runConversation (cyclomatic 89) · ×1
  • AgentLoopEvaluator.runConversation (cyclomatic 89) Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift:715 — AgentLoopEvaluator.runConversation has cyclomatic complexity 89 (threshold 15). Of this number, 59 points are the body's own statements and 30 belong to 7 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Functions.call (cyclomatic 87) · ×1
  • Functions.call (cyclomatic 87) Packages/OsaurusCore/Utils/CalculatorEngine.swift:700 — Functions.call has cyclomatic complexity 87 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CapabilityClaimsEvaluator.runConversation (cyclomatic 86) · ×1
  • CapabilityClaimsEvaluator.runConversation (cyclomatic 86) Packages/OsaurusCore/Services/Context/CapabilityClaimsEvaluator.swift:215 — CapabilityClaimsEvaluator.runConversation has cyclomatic complexity 86 (threshold 15). Of this number, 81 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChatSession.processStreamDeltas (cyclomatic 84) · ×1
  • ChatSession.processStreamDeltas (cyclomatic 84) Packages/OsaurusCore/Views/Chat/ChatView.swift:6167 — ChatSession.processStreamDeltas has cyclomatic complexity 84 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SystemPromptComposer.appendGatedSections (cyclomatic 83) · ×1
  • SystemPromptComposer.appendGatedSections (cyclomatic 83) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:972 — SystemPromptComposer.appendGatedSections 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.
D1 · Cyclomatic Complexity · AgentTaskState.record (cyclomatic 78) · ×1
  • AgentTaskState.record (cyclomatic 78) Packages/OsaurusCore/Services/Chat/AgentTaskState.swift:662 — AgentTaskState.record has cyclomatic complexity 78 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ComputerUseLoop.run (cyclomatic 76) · ×1
  • ComputerUseLoop.run (cyclomatic 76) Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:209 — ComputerUseLoop.run has cyclomatic complexity 76 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NativeCellHeightEstimator.estimatedHeight (cyclomatic 73) · ×1
  • NativeCellHeightEstimator.estimatedHeight (cyclomatic 73) Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:4290 — NativeCellHeightEstimator.estimatedHeight has cyclomatic complexity 73 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FileReadTool.readResolved (cyclomatic 70) · ×1
  • FileReadTool.readResolved (cyclomatic 70) Packages/OsaurusCore/Folder/FolderTools.swift:1535 — FileReadTool.readResolved has cyclomatic complexity 70 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RemoteProviderService._streamRemote (cyclomatic 69) · ×1
  • RemoteProviderService._streamRemote (cyclomatic 69) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:2946 — RemoteProviderService._streamRemote has cyclomatic complexity 69 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ConfigApplier.applyMCPServers (cyclomatic 67) · ×1
  • ConfigApplier.applyMCPServers (cyclomatic 67) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:1636 — ConfigApplier.applyMCPServers has cyclomatic complexity 67 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RemoteProviderService.buildChatRequest (cyclomatic 67) · ×1
  • RemoteProviderService.buildChatRequest (cyclomatic 67) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:3466 — RemoteProviderService.buildChatRequest has cyclomatic complexity 67 (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 · ModelDownloadService.runOrchestration (cyclomatic 66) · ×1
  • ModelDownloadService.runOrchestration (cyclomatic 66) Packages/OsaurusCore/Services/ModelDownloadService.swift:381 — ModelDownloadService.runOrchestration 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 · RemoteChatRequest.toOpenResponsesRequest (cyclomatic 64) · ×1
  • RemoteChatRequest.toOpenResponsesRequest (cyclomatic 64) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:6050 — RemoteChatRequest.toOpenResponsesRequest has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ClaudePluginInstaller.install (cyclomatic 64) · ×1
  • ClaudePluginInstaller.install (cyclomatic 64) Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:221 — ClaudePluginInstaller.install has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NativeMessageCellView.configureAsUserMessage (cyclomatic 63) · ×1
  • NativeMessageCellView.configureAsUserMessage (cyclomatic 63) Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2996 — NativeMessageCellView.configureAsUserMessage has cyclomatic complexity 63 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkflowDraftOp.parse (cyclomatic 62) · ×1
  • WorkflowDraftOp.parse (cyclomatic 62) Packages/OsaurusCore/Models/Workflow/WorkflowDraft.swift:355 — WorkflowDraftOp.parse has cyclomatic complexity 62 (threshold 15). Of this number, 56 points are the body's own statements and 6 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 · ModelRowCellView.configure (cyclomatic 62) · ×1
  • ModelRowCellView.configure (cyclomatic 62) Packages/OsaurusCore/Views/Model/ModelPickerTableRepresentable.swift:556 — ModelRowCellView.configure 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 · AppDelegate.applicationDidFinishLaunching (cyclomatic 61) · ×1
  • AppDelegate.applicationDidFinishLaunching (cyclomatic 61) Packages/OsaurusCore/AppDelegate.swift:178 — AppDelegate.applicationDidFinishLaunching has cyclomatic complexity 61 (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 · ModelRuntime.loadContainer (cyclomatic 61) · ×1
  • ModelRuntime.loadContainer (cyclomatic 61) Packages/OsaurusCore/Services/ModelRuntime.swift:4841 — ModelRuntime.loadContainer has cyclomatic complexity 61 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MarkdownBlockParsing.swift.parseBlocks (cyclomatic 61) · ×1
  • MarkdownBlockParsing.swift.parseBlocks (cyclomatic 61) Packages/OsaurusCore/Utils/MarkdownBlockParsing.swift:151 — MarkdownBlockParsing.swift.parseBlocks has cyclomatic complexity 61 (threshold 15). Of this number, 54 points are the body's own statements and 7 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 · MLXBatchAdapter.additionalContext (cyclomatic 60) · ×1
  • MLXBatchAdapter.additionalContext (cyclomatic 60) Packages/OsaurusCore/Services/ModelRuntime/MLXBatchAdapter.swift:1320 — MLXBatchAdapter.additionalContext has cyclomatic complexity 60 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GenerationEventMapper.map (cyclomatic 59) · ×1
  • GenerationEventMapper.map (cyclomatic 59) Packages/OsaurusCore/Services/ModelRuntime/GenerationEventMapper.swift:67 — GenerationEventMapper.map has cyclomatic complexity 59 (threshold 15). Of this number, 50 points are the body's own statements and 9 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 · ToolRegistry.execute (cyclomatic 58) · ×1
  • ToolRegistry.execute (cyclomatic 58) Packages/OsaurusCore/Tools/ToolRegistry.swift:1251 — ToolRegistry.execute has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CalculatorNode.exactInteger (cyclomatic 58) · ×1
  • CalculatorNode.exactInteger (cyclomatic 58) Packages/OsaurusCore/Utils/CalculatorEngine.swift:360 — CalculatorNode.exactInteger has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RequestLog.title (cyclomatic 58) · ×1
  • RequestLog.title (cyclomatic 58) Packages/OsaurusCore/Models/Chat/RequestLog.swift:889 — RequestLog.title has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SyncManageFeed.perform (cyclomatic 58) · ×1
  • SyncManageFeed.perform (cyclomatic 58) Packages/OsaurusCore/Services/Sync/SyncManageFeed.swift:550 — SyncManageFeed.perform has cyclomatic complexity 58 (threshold 15). Of this number, 57 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 · SetupChecker.check (cyclomatic 58) · ×1
  • SetupChecker.check (cyclomatic 58) Packages/OsaurusCore/Services/Template/SetupChecker.swift:398 — SetupChecker.check has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EvalMatrixBuilder.build (cyclomatic 55) · ×1
  • EvalMatrixBuilder.build (cyclomatic 55) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalMatrix.swift:811 — EvalMatrixBuilder.build has cyclomatic complexity 55 (threshold 15). Of this number, 54 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 · HTTPHandler.handleChatCompletions (cyclomatic 55) · ×1
  • HTTPHandler.handleChatCompletions (cyclomatic 55) Packages/OsaurusCore/Networking/HTTPHandler.swift:15297 — HTTPHandler.handleChatCompletions has cyclomatic complexity 55 (threshold 15). Of this number, 52 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ContentBlockKind.== (cyclomatic 55) · ×1
  • ContentBlockKind.== (cyclomatic 55) Packages/OsaurusCore/Models/Chat/ContentBlock.swift:161 — ContentBlockKind.== has cyclomatic complexity 55 (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 · PendingImportProcessor.install (cyclomatic 55) · ×1
  • PendingImportProcessor.install (cyclomatic 55) Packages/OsaurusCore/Services/Import/PendingImportProcessor.swift:524 — PendingImportProcessor.install has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DesignWorkingStore.validate (cyclomatic 54) · ×1
  • DesignWorkingStore.validate (cyclomatic 54) Packages/OsaurusCore/DevelopmentDesign/DesignWorkingStore.swift:309 — DesignWorkingStore.validate has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HTTPHandler.handleOpenResponsesStreaming (cyclomatic 54) · ×1
  • HTTPHandler.handleOpenResponsesStreaming (cyclomatic 54) Packages/OsaurusCore/Networking/HTTPHandler.swift:18604 — HTTPHandler.handleOpenResponsesStreaming has cyclomatic complexity 54 (threshold 15). Of this number, 51 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RenderChartTool.execute (cyclomatic 54) · ×1
  • RenderChartTool.execute (cyclomatic 54) Packages/OsaurusCore/Tools/RenderChartTool.swift:141 — RenderChartTool.execute has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChatEngine.wrapStreamWithLogging (cyclomatic 54) · ×1
  • ChatEngine.wrapStreamWithLogging (cyclomatic 54) Packages/OsaurusCore/Services/Chat/ChatEngine.swift:1376 — ChatEngine.wrapStreamWithLogging has cyclomatic complexity 54 (threshold 15). Of this number, 52 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 · WorkflowFailure.classify (cyclomatic 54) · ×1
  • WorkflowFailure.classify (cyclomatic 54) Packages/OsaurusCore/Services/Workflow/WorkflowFailure.swift:51 — WorkflowFailure.classify has cyclomatic complexity 54 (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 · WorkflowStepRisk.badges (cyclomatic 54) · ×1
  • WorkflowStepRisk.badges (cyclomatic 54) Packages/OsaurusCore/Services/Workflow/WorkflowTrust.swift:94 — WorkflowStepRisk.badges has cyclomatic complexity 54 (threshold 15). Of this number, 36 points are the body's own statements and 18 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 · BoundedArchiveExtractor.inspect (cyclomatic 53) · ×1
  • BoundedArchiveExtractor.inspect (cyclomatic 53) Packages/OsaurusRepository/BoundedArchiveExtractor.swift:139 — BoundedArchiveExtractor.inspect has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RemoteChatRequest.toGeminiRequest (cyclomatic 53) · ×1
  • RemoteChatRequest.toGeminiRequest (cyclomatic 53) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:5622 — RemoteChatRequest.toGeminiRequest has cyclomatic complexity 53 (threshold 15). Of this number, 52 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 · MediaNodeExecutor.settings (cyclomatic 52) · ×1
  • MediaNodeExecutor.settings (cyclomatic 52) Packages/OsaurusCore/Services/Workflow/MediaNodeExecutor.swift:961 — MediaNodeExecutor.settings has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChatSession.init (cyclomatic 52) · ×1
  • ChatSession.init (cyclomatic 52) Packages/OsaurusCore/Views/Chat/ChatView.swift:1090 — ChatSession.init has cyclomatic complexity 52 (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 · CatalogLibraryFixture.activityContent (cyclomatic 51) · ×1
  • CatalogLibraryFixture.activityContent (cyclomatic 51) Packages/OsaurusCore/DevelopmentDesign/CatalogComponents.swift:559 — CatalogLibraryFixture.activityContent has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ImageGenerationService.drive (cyclomatic 51) · ×1
  • ImageGenerationService.drive (cyclomatic 51) Packages/OsaurusCore/Services/ModelRuntime/ImageGenerationService.swift:724 — ImageGenerationService.drive has cyclomatic complexity 51 (threshold 15). Of this number, 47 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 · RemoteAnthropicNativeStream.consume (cyclomatic 51) · ×1
  • RemoteAnthropicNativeStream.consume (cyclomatic 51) Packages/OsaurusCore/Services/Provider/RemoteAnthropicNativeStream.swift:38 — RemoteAnthropicNativeStream.consume has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RemoteResponsesNativeStream.consume (cyclomatic 51) · ×1
  • RemoteResponsesNativeStream.consume (cyclomatic 51) Packages/OsaurusCore/Services/Provider/RemoteResponsesNativeStream.swift:26 — RemoteResponsesNativeStream.consume has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CatalogLibraryFixture.baseContent (cyclomatic 50) · ×1
  • CatalogLibraryFixture.baseContent (cyclomatic 50) Packages/OsaurusCore/DevelopmentDesign/CatalogComponents.swift:394 — CatalogLibraryFixture.baseContent has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OsaurusTool.agentChannelFailure (cyclomatic 50) · ×1
  • OsaurusTool.agentChannelFailure (cyclomatic 50) Packages/OsaurusCore/Tools/AgentChannelTools.swift:21 — OsaurusTool.agentChannelFailure has cyclomatic complexity 50 (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 · ChatEngine.completeChat (cyclomatic 50) · ×1
  • ChatEngine.completeChat (cyclomatic 50) Packages/OsaurusCore/Services/Chat/ChatEngine.swift:1832 — ChatEngine.completeChat has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HTTPHandler.handlePluginRoute (cyclomatic 49) · ×1
  • HTTPHandler.handlePluginRoute (cyclomatic 49) Packages/OsaurusCore/Networking/HTTPHandler.swift:2959 — HTTPHandler.handlePluginRoute has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OsaurusInspectTool.describeItem (cyclomatic 49) · ×1
  • OsaurusInspectTool.describeItem (cyclomatic 49) Packages/OsaurusCore/Tools/ConfigurationTools.swift:1280 — OsaurusInspectTool.describeItem has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ToolRegistry.runPermissionGate (cyclomatic 49) · ×1
  • ToolRegistry.runPermissionGate (cyclomatic 49) Packages/OsaurusCore/Tools/ToolRegistry.swift:982 — ToolRegistry.runPermissionGate has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChatImportApplier.apply (cyclomatic 49) · ×1
  • ChatImportApplier.apply (cyclomatic 49) Packages/OsaurusCore/Services/ChatImport/ChatImportApplier.swift:55 — ChatImportApplier.apply has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RemoteProviderService.handleOpenResponsesEvent (cyclomatic 49) · ×1
  • RemoteProviderService.handleOpenResponsesEvent (cyclomatic 49) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:2427 — RemoteProviderService.handleOpenResponsesEvent has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RemoteProviderService.buildURLRequest (cyclomatic 49) · ×1
  • RemoteProviderService.buildURLRequest (cyclomatic 49) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:4101 — RemoteProviderService.buildURLRequest has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OpenAPISummary.parse (cyclomatic 49) · ×1
  • OpenAPISummary.parse (cyclomatic 49) Packages/OsaurusCore/Tools/Workflow/WorkflowDiscoverTool.swift:626 — OpenAPISummary.parse has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NativeToolCallRowView.configure (cyclomatic 49) · ×1
  • NativeToolCallRowView.configure (cyclomatic 49) Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:1094 — NativeToolCallRowView.configure has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ComputerUseLoop.act (cyclomatic 47) · ×1
  • ComputerUseLoop.act (cyclomatic 47) Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:1334 — ComputerUseLoop.act has cyclomatic complexity 47 (threshold 15). Of this number, 46 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 · WorkflowDraftPatcher.apply (cyclomatic 47) · ×1
  • WorkflowDraftPatcher.apply (cyclomatic 47) Packages/OsaurusCore/Models/Workflow/WorkflowDraft.swift:558 — WorkflowDraftPatcher.apply has cyclomatic complexity 47 (threshold 15). Of this number, 46 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 · ModelRuntime.unloadClaimed (cyclomatic 46) · ×1
  • ModelRuntime.unloadClaimed (cyclomatic 46) Packages/OsaurusCore/Services/ModelRuntime.swift:2435 — ModelRuntime.unloadClaimed has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CacheProofEvaluator.runConversation (cyclomatic 46) · ×1
  • CacheProofEvaluator.runConversation (cyclomatic 46) Packages/OsaurusCore/Services/Context/CacheProofEvaluator.swift:304 — CacheProofEvaluator.runConversation has cyclomatic complexity 46 (threshold 15). Of this number, 42 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 · ChatView.setupKeyMonitor (cyclomatic 46) · ×1
  • ChatView.setupKeyMonitor (cyclomatic 46) Packages/OsaurusCore/Views/Chat/ChatView.swift:13538 — ChatView.setupKeyMonitor has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ImportCommand.parse (cyclomatic 45) · ×1
  • ImportCommand.parse (cyclomatic 45) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Import/ImportCommand.swift:185 — ImportCommand.parse has cyclomatic complexity 45 (threshold 15). Of this number, 41 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 · EvalRunner.runToolResultGroundingCase (cyclomatic 45) · ×1
  • EvalRunner.runToolResultGroundingCase (cyclomatic 45) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerToolResultGrounding.swift:14 — EvalRunner.runToolResultGroundingCase has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FileSearchTool.execute (cyclomatic 45) · ×1
  • FileSearchTool.execute (cyclomatic 45) Packages/OsaurusCore/Folder/FolderTools.swift:4846 — FileSearchTool.execute has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HTTPHandler.handleConfigAdminEndpoint (cyclomatic 45) · ×1
  • HTTPHandler.handleConfigAdminEndpoint (cyclomatic 45) Packages/OsaurusCore/Networking/HTTPHandler.swift:2307 — HTTPHandler.handleConfigAdminEndpoint has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SafeDiskCachePurge.clear (cyclomatic 45) · ×1
  • SafeDiskCachePurge.clear (cyclomatic 45) Packages/OsaurusCore/Services/SafeDiskCachePurge.swift:13 — SafeDiskCachePurge.clear has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EvalRunner.score (cyclomatic 43) · ×1
  • EvalRunner.score (cyclomatic 43) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:858 — EvalRunner.score has cyclomatic complexity 43 (threshold 15). 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: 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 · RedactFileTool.execute (cyclomatic 43) · ×1
  • RedactFileTool.execute (cyclomatic 43) Packages/OsaurusCore/Folder/RedactionTools.swift:272 — RedactFileTool.execute 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 · Solver.polynomial (cyclomatic 43) · ×1
  • Solver.polynomial (cyclomatic 43) Packages/OsaurusCore/Utils/CalculatorEngine.swift:892 — Solver.polynomial has cyclomatic complexity 43 (threshold 15). Of this number, 39 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 · ConfigPlanner.planMCPServers (cyclomatic 43) · ×1
  • ConfigPlanner.planMCPServers (cyclomatic 43) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2115 — ConfigPlanner.planMCPServers 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 · AgentDelegationDispatcher.run (cyclomatic 43) · ×1
  • AgentDelegationDispatcher.run (cyclomatic 43) Packages/OsaurusCore/Services/AgentDelegation/AgentDelegationDispatcher.swift:506 — AgentDelegationDispatcher.run 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 · WorkspaceAuditRow.title (cyclomatic 43) · ×1
  • WorkspaceAuditRow.title (cyclomatic 43) Packages/OsaurusCore/Views/Workspaces/WorkspaceAuditView.swift:327 — WorkspaceAuditRow.title has cyclomatic complexity 43 (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 · EvalRunner.runDefaultAgentCase (cyclomatic 42) · ×1
  • EvalRunner.runDefaultAgentCase (cyclomatic 42) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:1760 — EvalRunner.runDefaultAgentCase has cyclomatic complexity 42 (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 · ModelRuntime.decodeWAVAudioSamples (cyclomatic 42) · ×1
  • ModelRuntime.decodeWAVAudioSamples (cyclomatic 42) Packages/OsaurusCore/Services/ModelRuntime.swift:7779 — ModelRuntime.decodeWAVAudioSamples has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SchemaValidator.validateValue (cyclomatic 42) · ×1
  • SchemaValidator.validateValue (cyclomatic 42) Packages/OsaurusCore/Tools/SchemaValidator.swift:178 — SchemaValidator.validateValue has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Tokenizer.tokenize (cyclomatic 42) · ×1
  • Tokenizer.tokenize (cyclomatic 42) Packages/OsaurusCore/Utils/CalculatorEngine.swift:201 — Tokenizer.tokenize has cyclomatic complexity 42 (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 · ConfigChannelPlatform.apply (cyclomatic 42) · ×1
  • ConfigChannelPlatform.apply (cyclomatic 42) Packages/OsaurusCore/Configuration/Declarative/ConfigChannelDetails.swift:87 — ConfigChannelPlatform.apply has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkflowValidator.mediaIssues (cyclomatic 42) · ×1
  • WorkflowValidator.mediaIssues (cyclomatic 42) Packages/OsaurusCore/Models/Workflow/WorkflowValidator.swift:754 — WorkflowValidator.mediaIssues has cyclomatic complexity 42 (threshold 15). Of this number, 38 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 · PrivacyFilterPipeline.applyOutbound (cyclomatic 42) · ×1
  • PrivacyFilterPipeline.applyOutbound (cyclomatic 42) Packages/OsaurusCore/PrivacyFilter/Core/PrivacyFilterPipeline.swift:333 — PrivacyFilterPipeline.applyOutbound has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DiscoveryCenter.take (cyclomatic 42) · ×1
  • DiscoveryCenter.take (cyclomatic 42) Packages/OsaurusCore/Services/Onboarding/DiscoveryCenter.swift:377 — DiscoveryCenter.take has cyclomatic complexity 42 (threshold 15). Of this number, 40 points are the body's own statements and 2 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 · PluginHostContext.completeStream (cyclomatic 42) · ×1
  • PluginHostContext.completeStream (cyclomatic 42) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1820 — PluginHostContext.completeStream has cyclomatic complexity 42 (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 · WorkflowCondition.evaluate (cyclomatic 41) · ×1
  • WorkflowCondition.evaluate (cyclomatic 41) Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:1857 — WorkflowCondition.evaluate 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 · AgentChannelCustomJSONRunner.execute (cyclomatic 41) · ×1
  • AgentChannelCustomJSONRunner.execute (cyclomatic 41) Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:539 — AgentChannelCustomJSONRunner.execute 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 · AccessibilityManager.traverseElement (cyclomatic 41) · ×1
  • AccessibilityManager.traverseElement (cyclomatic 41) Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:769 — AccessibilityManager.traverseElement 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 · EvalRunner.scoreSpawnWave (cyclomatic 40) · ×1
  • EvalRunner.scoreSpawnWave (cyclomatic 40) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerAgentLoop.swift:1615 — EvalRunner.scoreSpawnWave has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OsaurusBundle.select (cyclomatic 40) · ×1
  • OsaurusBundle.select (cyclomatic 40) Packages/OsaurusRepository/OsaurusBundle.swift:930 — OsaurusBundle.select has cyclomatic complexity 40 (threshold 15). Of this number, 37 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BackgroundTaskManager.dispatchChat (cyclomatic 40) · ×1
  • BackgroundTaskManager.dispatchChat (cyclomatic 40) Packages/OsaurusCore/Managers/BackgroundTaskManager.swift:1111 — BackgroundTaskManager.dispatchChat has cyclomatic complexity 40 (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 · JSONSchemaValidator.check (cyclomatic 40) · ×1
  • JSONSchemaValidator.check (cyclomatic 40) Packages/OsaurusCore/Models/Workflow/JSONSchemaValidator.swift:67 — JSONSchemaValidator.check has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PDFEditor.fillForm (cyclomatic 40) · ×1
  • PDFEditor.fillForm (cyclomatic 40) Packages/OsaurusCore/Services/Documents/PDFEditor.swift:346 — PDFEditor.fillForm has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RemoteProviderService.processEventPayload (cyclomatic 40) · ×1
  • RemoteProviderService.processEventPayload (cyclomatic 40) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:1737 — RemoteProviderService.processEventPayload has cyclomatic complexity 40 (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 · OverviewTab.summaryHeadline (cyclomatic 40) · ×1
  • OverviewTab.summaryHeadline (cyclomatic 40) Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:1131 — OverviewTab.summaryHeadline has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · WorkspaceAuditRow.subtitle (cyclomatic 40) · ×1
  • WorkspaceAuditRow.subtitle (cyclomatic 40) Packages/OsaurusCore/Views/Workspaces/WorkspaceAuditView.swift:439 — WorkspaceAuditRow.subtitle has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Options.parse (cyclomatic 39) · ×1
  • Options.parse (cyclomatic 39) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/OsaurusEvalsCLI.swift:887 — Options.parse has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EvalRunner.runAppleScriptCase (cyclomatic 39) · ×1
  • EvalRunner.runAppleScriptCase (cyclomatic 39) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerAppleScript.swift:36 — EvalRunner.runAppleScriptCase has cyclomatic complexity 39 (threshold 15). Of this number, 37 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 · ShellCommandRiskScanner.parse (cyclomatic 39) · ×1
  • ShellCommandRiskScanner.parse (cyclomatic 39) Packages/OsaurusCore/Tools/ShellCommandRiskScanner.swift:330 — ShellCommandRiskScanner.parse has cyclomatic complexity 39 (threshold 15). Of this number, 37 points are the body's own statements and 2 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 · Tokenizer.number (cyclomatic 39) · ×1
  • Tokenizer.number (cyclomatic 39) Packages/OsaurusCore/Utils/CalculatorEngine.swift:277 — Tokenizer.number has cyclomatic complexity 39 (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 · ConfigScheduleFrequency.parse (cyclomatic 39) · ×1
  • ConfigScheduleFrequency.parse (cyclomatic 39) Packages/OsaurusCore/Configuration/Declarative/ConfigScheduleFrequency.swift:21 — ConfigScheduleFrequency.parse has cyclomatic complexity 39 (threshold 15). Of this number, 33 points are the body's own statements and 6 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 · PendingImportProcessor.prepare (cyclomatic 39) · ×1
  • PendingImportProcessor.prepare (cyclomatic 39) Packages/OsaurusCore/Services/Import/PendingImportProcessor.swift:260 — PendingImportProcessor.prepare has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RemoteChatRequest.toAnthropicRequest (cyclomatic 39) · ×1
  • RemoteChatRequest.toAnthropicRequest (cyclomatic 39) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:5366 — RemoteChatRequest.toAnthropicRequest has cyclomatic complexity 39 (threshold 15). Of this number, 38 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 · ChatSession.send (cyclomatic 39) · ×1
  • ChatSession.send (cyclomatic 39) Packages/OsaurusCore/Views/Chat/ChatView.swift:7367 — ChatSession.send has cyclomatic complexity 39 (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 · FileWriteTool.execute (cyclomatic 38) · ×1
  • FileWriteTool.execute (cyclomatic 38) Packages/OsaurusCore/Folder/FolderTools.swift:2766 — FileWriteTool.execute has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OsaurusConfigTool.applyDocument (cyclomatic 38) · ×1
  • OsaurusConfigTool.applyDocument (cyclomatic 38) Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool.swift:468 — OsaurusConfigTool.applyDocument has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentChannelPublishService.publish (cyclomatic 38) · ×1
  • AgentChannelPublishService.publish (cyclomatic 38) Packages/OsaurusCore/Services/AgentChannel/AgentChannelPublishService.swift:186 — AgentChannelPublishService.publish has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChatEngine.prepareDispatch (cyclomatic 38) · ×1
  • ChatEngine.prepareDispatch (cyclomatic 38) Packages/OsaurusCore/Services/Chat/ChatEngine.swift:227 — ChatEngine.prepareDispatch has cyclomatic complexity 38 (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 · SyncHostRunner.process (cyclomatic 38) · ×1
  • SyncHostRunner.process (cyclomatic 38) Packages/OsaurusCore/Services/Sync/SyncHostRunner.swift:324 — SyncHostRunner.process has cyclomatic complexity 38 (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 · ToolCategory.from (cyclomatic 38) · ×1
  • ToolCategory.from (cyclomatic 38) Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:130 — ToolCategory.from has cyclomatic complexity 38 (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 · AssignedNativeMenuItems.body (cyclomatic 38) · ×1
  • AssignedNativeMenuItems.body (cyclomatic 38) Packages/OsaurusCore/Models/Theme/InspectionAdapters/AssignedMenuPresentation.swift:629 — AssignedNativeMenuItems.body has cyclomatic complexity 38 (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 · BlockMemoizer.blocks (cyclomatic 37) · ×1
  • BlockMemoizer.blocks (cyclomatic 37) Packages/OsaurusCore/Managers/BlockMemoizer.swift:118 — BlockMemoizer.blocks has cyclomatic complexity 37 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · RemoteProviderManager.testConnection (cyclomatic 37) · ×1
  • RemoteProviderManager.testConnection (cyclomatic 37) Packages/OsaurusCore/Managers/RemoteProviderManager.swift:1682 — RemoteProviderManager.testConnection 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 · SearchAndExtractTool.enrichedResults (cyclomatic 37) · ×1
  • SearchAndExtractTool.enrichedResults (cyclomatic 37) Packages/OsaurusCore/Tools/WebSearchTools.swift:650 — SearchAndExtractTool.enrichedResults 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 · AgentChannelInboundActivityPresentation.guidance (cyclomatic 37) · ×1
  • AgentChannelInboundActivityPresentation.guidance (cyclomatic 37) Packages/OsaurusCore/Services/AgentChannel/AgentChannelInboundActivity.swift:139 — AgentChannelInboundActivityPresentation.guidance has cyclomatic complexity 37 (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 · ChatSession.runHarnessTurn (cyclomatic 37) · ×1
  • ChatSession.runHarnessTurn (cyclomatic 37) Packages/OsaurusCore/Views/Chat/ChatSession+Harness.swift:34 — ChatSession.runHarnessTurn has cyclomatic complexity 37 (threshold 15). Of this number, 33 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 · CatalogAssignmentMenu.allows (cyclomatic 37) · ×1
  • CatalogAssignmentMenu.allows (cyclomatic 37) Packages/OsaurusCore/Models/Theme/DesignLibrary/CatalogPreviewInspection.swift:117 — CatalogAssignmentMenu.allows has cyclomatic complexity 37 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CompatibilityReport.formatMarkdown (cyclomatic 36) · ×1
  • CompatibilityReport.formatMarkdown (cyclomatic 36) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCompat.swift:187 — CompatibilityReport.formatMarkdown 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 · EvalCaseTelemetry.isEmpty (cyclomatic 36) · ×1
  • EvalCaseTelemetry.isEmpty (cyclomatic 36) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReport.swift:240 — EvalCaseTelemetry.isEmpty has cyclomatic complexity 36 (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 · EvalRunner.runPromptSurfaceCase (cyclomatic 36) · ×1
  • EvalRunner.runPromptSurfaceCase (cyclomatic 36) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerPromptSurface.swift:19 — EvalRunner.runPromptSurfaceCase has cyclomatic complexity 36 (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 · PromotionGate.evaluate (cyclomatic 36) · ×1
  • PromotionGate.evaluate (cyclomatic 36) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/PromotionGate.swift:47 — PromotionGate.evaluate 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 · CatalogLibraryFixture.chatContent (cyclomatic 36) · ×1
  • CatalogLibraryFixture.chatContent (cyclomatic 36) Packages/OsaurusCore/DevelopmentDesign/CatalogComponents.swift:489 — CatalogLibraryFixture.chatContent 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 · InsightsService.filterInMemory (cyclomatic 36) · ×1
  • InsightsService.filterInMemory (cyclomatic 36) Packages/OsaurusCore/Managers/InsightsService.swift:572 — InsightsService.filterInMemory has cyclomatic complexity 36 (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 · ModelRuntime.estimatedArchitectureKVHeadroomBytes (cyclomatic 36) · ×1
  • ModelRuntime.estimatedArchitectureKVHeadroomBytes (cyclomatic 36) Packages/OsaurusCore/Services/ModelRuntime.swift:3593 — ModelRuntime.estimatedArchitectureKVHeadroomBytes has cyclomatic complexity 36 (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 · OsaurusInspectTool.resolvedListEnvelope (cyclomatic 36) · ×1
  • OsaurusInspectTool.resolvedListEnvelope (cyclomatic 36) Packages/OsaurusCore/Tools/ConfigurationTools.swift:749 — OsaurusInspectTool.resolvedListEnvelope has cyclomatic complexity 36 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ReadKnowledgeTool.execute (cyclomatic 36) · ×1
  • ReadKnowledgeTool.execute (cyclomatic 36) Packages/OsaurusCore/Tools/KnowledgeTools.swift:451 — ReadKnowledgeTool.execute 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 · ActivityExportService.renderMarkdown (cyclomatic 36) · ×1
  • ActivityExportService.renderMarkdown (cyclomatic 36) Packages/OsaurusCore/Services/Insights/ActivityExportService.swift:222 — ActivityExportService.renderMarkdown 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 · ChatSession.finalizeRun (cyclomatic 36) · ×1
  • ChatSession.finalizeRun (cyclomatic 36) Packages/OsaurusCore/Views/Chat/ChatView.swift:5881 — ChatSession.finalizeRun 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 · ChatModelPickerCard.modelColumn (cyclomatic 36) · ×1
  • ChatModelPickerCard.modelColumn (cyclomatic 36) Packages/OsaurusCore/Views/Model/ChatModelPickerCard.swift:538 — ChatModelPickerCard.modelColumn 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 · EvalRunner.runComputerUseLoopCase (cyclomatic 34) · ×1
  • EvalRunner.runComputerUseLoopCase (cyclomatic 34) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerComputerUseLoop.swift:21 — EvalRunner.runComputerUseLoopCase has cyclomatic complexity 34 (threshold 15). Of this number, 32 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 · HTTPHandler.handlePairInviteEndpoint (cyclomatic 34) · ×1
  • HTTPHandler.handlePairInviteEndpoint (cyclomatic 34) Packages/OsaurusCore/Networking/HTTPHandler.swift:9509 — HTTPHandler.handlePairInviteEndpoint has cyclomatic complexity 34 (threshold 15). Of this number, 31 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ShellCommandRiskScanner.downloadSources (cyclomatic 34) · ×1
  • ShellCommandRiskScanner.downloadSources (cyclomatic 34) Packages/OsaurusCore/Tools/ShellCommandRiskScanner.swift:241 — ShellCommandRiskScanner.downloadSources has cyclomatic complexity 34 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OpenAICompatibleStreamParser.processChoice (cyclomatic 34) · ×1
  • OpenAICompatibleStreamParser.processChoice (cyclomatic 34) Packages/OsaurusCore/Services/Provider/OpenAICompatibleStreamParser.swift:645 — OpenAICompatibleStreamParser.processChoice 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 · SearchDiagnostics.classifyFailure (cyclomatic 34) · ×1
  • SearchDiagnostics.classifyFailure (cyclomatic 34) Packages/OsaurusCore/Services/Search/SearchTypes.swift:180 — SearchDiagnostics.classifyFailure 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 · WorkflowNodeEditor.form (cyclomatic 34) · ×1
  • WorkflowNodeEditor.form (cyclomatic 34) Packages/OsaurusCore/Views/Workflow/Architect/WorkflowNodeEditor.swift:90 — WorkflowNodeEditor.form 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 · ConfigCommand.runPlanOrApply (cyclomatic 33) · ×1
  • ConfigCommand.runPlanOrApply (cyclomatic 33) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Config.swift:149 — ConfigCommand.runPlanOrApply 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 · ModelRuntime.attentionLayerMix (cyclomatic 33) · ×1
  • ModelRuntime.attentionLayerMix (cyclomatic 33) Packages/OsaurusCore/Services/ModelRuntime.swift:3808 — ModelRuntime.attentionLayerMix has cyclomatic complexity 33 (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 · RetainedToolResultStore.read (cyclomatic 33) · ×1
  • RetainedToolResultStore.read (cyclomatic 33) Packages/OsaurusCore/Storage/RetainedToolResultStore.swift:199 — RetainedToolResultStore.read 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 · AgentChannelConnectionService.actionStatus (cyclomatic 33) · ×1
  • AgentChannelConnectionService.actionStatus (cyclomatic 33) Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1739 — AgentChannelConnectionService.actionStatus 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 · FloatingInputCard.normalBody (cyclomatic 33) · ×1
  • FloatingInputCard.normalBody (cyclomatic 33) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:1007 — FloatingInputCard.normalBody 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 · EventEditorSheet.build (cyclomatic 33) · ×1
  • EventEditorSheet.build (cyclomatic 33) Packages/OsaurusCore/Views/Event/EventEditorSheet.swift:762 — EventEditorSheet.build 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 · LanguageCatalogSource.item (cyclomatic 33) · ×1
  • LanguageCatalogSource.item (cyclomatic 33) Packages/OsaurusCore/Views/Model/Catalog/LanguageCatalogSource.swift:469 — LanguageCatalogSource.item 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 · WorkflowFlowCanvas.draw (cyclomatic 33) · ×1
  • WorkflowFlowCanvas.draw (cyclomatic 33) Packages/OsaurusCore/Views/Workflow/FlowViewer/WorkflowFlowCanvas.swift:270 — WorkflowFlowCanvas.draw has cyclomatic complexity 33 (threshold 15). Of this number, 26 points are the body's own statements and 7 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 · ContextOptimizerSearch.plan (cyclomatic 32) · ×1
  • ContextOptimizerSearch.plan (cyclomatic 32) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ContextOptimizer.swift:105 — ContextOptimizerSearch.plan has cyclomatic complexity 32 (threshold 15). Of this number, 28 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · EvalRunner.runCapabilityClaimsCase (cyclomatic 32) · ×1
  • EvalRunner.runCapabilityClaimsCase (cyclomatic 32) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:1392 — EvalRunner.runCapabilityClaimsCase has cyclomatic complexity 32 (threshold 15). Of this number, 31 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. This is NOT this file's highest cyclomatic complexity: EvalRunner.dispatchCase (cyclomatic 33) 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 · FileEditTool.editDocument (cyclomatic 32) · ×1
  • FileEditTool.editDocument (cyclomatic 32) Packages/OsaurusCore/Folder/FolderTools.swift:3999 — FileEditTool.editDocument 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 · ToolEnvelope.fromError (cyclomatic 32) · ×1
  • ToolEnvelope.fromError (cyclomatic 32) Packages/OsaurusCore/Tools/ToolEnvelope.swift:222 — ToolEnvelope.fromError 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 · ZipArchive.entries (cyclomatic 32) · ×1
  • ZipArchive.entries (cyclomatic 32) Packages/OsaurusCore/Utils/ZipArchive.swift:67 — ZipArchive.entries 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 · SharedArtifact.resolveSourcePathDetailed (cyclomatic 32) · ×1
  • SharedArtifact.resolveSourcePathDetailed (cyclomatic 32) Packages/OsaurusCore/Models/Chat/SharedArtifact.swift:776 — SharedArtifact.resolveSourcePathDetailed 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. This is NOT this file's highest cyclomatic complexity: SharedArtifact.mimeType (cyclomatic 41) 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 · LocalVisionEvidence.tensorPayloadSizes (cyclomatic 32) · ×1
  • LocalVisionEvidence.tensorPayloadSizes (cyclomatic 32) Packages/OsaurusCore/Models/Configuration/LocalVisionEvidence.swift:459 — LocalVisionEvidence.tensorPayloadSizes 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 · ClaudeCodeHarnessAdapter.launchPlan (cyclomatic 32) · ×1
  • ClaudeCodeHarnessAdapter.launchPlan (cyclomatic 32) Packages/OsaurusCore/Services/Harness/ClaudeCodeHarnessAdapter.swift:40 — ClaudeCodeHarnessAdapter.launchPlan 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 · ResponsesGenerationStream.compatibility (cyclomatic 32) · ×1
  • ResponsesGenerationStream.compatibility (cyclomatic 32) Packages/OsaurusCore/Services/Inference/ResponsesCompatibilityStream.swift:19 — ResponsesGenerationStream.compatibility 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 · DiscoveryCatalog.status (cyclomatic 32) · ×1
  • DiscoveryCatalog.status (cyclomatic 32) Packages/OsaurusCore/Services/Onboarding/DiscoveryCatalog.swift:140 — DiscoveryCatalog.status has cyclomatic complexity 32 (threshold 15). Of this number, 30 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · RemoteProviderService.parseResponse (cyclomatic 32) · ×1
  • RemoteProviderService.parseResponse (cyclomatic 32) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:4840 — RemoteProviderService.parseResponse has cyclomatic complexity 32 (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 · NativeToolCallRowView.applyAssignedLayout (cyclomatic 32) · ×1
  • NativeToolCallRowView.applyAssignedLayout (cyclomatic 32) Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:1421 — NativeToolCallRowView.applyAssignedLayout 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 · ModelRuntime.isKnownHybridModel (cyclomatic 31) · ×1
  • ModelRuntime.isKnownHybridModel (cyclomatic 31) Packages/OsaurusCore/Services/ModelRuntime.swift:6094 — ModelRuntime.isKnownHybridModel has cyclomatic complexity 31 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ModelRuntime.bridgeToolEventStream (cyclomatic 31) · ×1
  • ModelRuntime.bridgeToolEventStream (cyclomatic 31) Packages/OsaurusCore/Services/ModelRuntime.swift:6743 — ModelRuntime.bridgeToolEventStream has cyclomatic complexity 31 (threshold 15). Of this number, 28 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Solver.solve (cyclomatic 31) · ×1
  • Solver.solve (cyclomatic 31) Packages/OsaurusCore/Utils/CalculatorEngine.swift:1042 — Solver.solve has cyclomatic complexity 31 (threshold 15). Of this number, 23 points are the body's own statements and 8 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 · ConfigPlanner.plan (cyclomatic 31) · ×1
  • ConfigPlanner.plan (cyclomatic 31) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:175 — ConfigPlanner.plan has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ConfigPlanner.diffPortableSettings (cyclomatic 31) · ×1
  • ConfigPlanner.diffPortableSettings (cyclomatic 31) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1299 — ConfigPlanner.diffPortableSettings 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 · WorkflowValidator.validate (cyclomatic 31) · ×1
  • WorkflowValidator.validate (cyclomatic 31) Packages/OsaurusCore/Models/Workflow/WorkflowValidator.swift:163 — WorkflowValidator.validate 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 · NativeImageJobCoordinator.runJob (cyclomatic 31) · ×1
  • NativeImageJobCoordinator.runJob (cyclomatic 31) Packages/OsaurusCore/Services/AgentDelegation/NativeImageJobCoordinator.swift:675 — NativeImageJobCoordinator.runJob has cyclomatic complexity 31 (threshold 15). Of this number, 30 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 · MCPElicitationForm.convert (cyclomatic 31) · ×1
  • MCPElicitationForm.convert (cyclomatic 31) Packages/OsaurusCore/Services/MCP/MCPElicitation.swift:186 — MCPElicitationForm.convert 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 · MemoryManagementConsoleService.diagnoseStorage (cyclomatic 31) · ×1
  • MemoryManagementConsoleService.diagnoseStorage (cyclomatic 31) Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:325 — MemoryManagementConsoleService.diagnoseStorage has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MLXBatchAdapter.generate (cyclomatic 31) · ×1
  • MLXBatchAdapter.generate (cyclomatic 31) Packages/OsaurusCore/Services/ModelRuntime/MLXBatchAdapter.swift:1643 — MLXBatchAdapter.generate has cyclomatic complexity 31 (threshold 15). Of this number, 30 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 · DiscoveryCenter.step (cyclomatic 31) · ×1
  • DiscoveryCenter.step (cyclomatic 31) Packages/OsaurusCore/Services/Onboarding/DiscoveryCenter.swift:297 — DiscoveryCenter.step has cyclomatic complexity 31 (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 · TelegramConnectionService.diagnostics (cyclomatic 31) · ×1
  • TelegramConnectionService.diagnostics (cyclomatic 31) Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:528 — TelegramConnectionService.diagnostics has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · DBImportTool.execute (cyclomatic 31) · ×1
  • DBImportTool.execute (cyclomatic 31) Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:1239 — DBImportTool.execute 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 · NativeMarkdownView.applyMixedSegments (cyclomatic 31) · ×1
  • NativeMarkdownView.applyMixedSegments (cyclomatic 31) Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:997 — NativeMarkdownView.applyMixedSegments 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 · CatalogElementAssignments.extendMappings (cyclomatic 31) · ×1
  • CatalogElementAssignments.extendMappings (cyclomatic 31) Packages/OsaurusCore/Models/Theme/DesignLibrary/CatalogElementAssignments.swift:65 — CatalogElementAssignments.extendMappings 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 · XMLFeedReader.parser (cyclomatic 31) · ×1
  • XMLFeedReader.parser (cyclomatic 31) Packages/OsaurusCore/Services/Event/Feed/FeedParser.swift:238 — XMLFeedReader.parser 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 · MCPOAuthService.signIn (cyclomatic 31) · ×1
  • MCPOAuthService.signIn (cyclomatic 31) Packages/OsaurusCore/Services/MCP/OAuth/MCPOAuthService.swift:117 — MCPOAuthService.signIn 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 · ServeCommand.execute (cyclomatic 30) · ×1
  • ServeCommand.execute (cyclomatic 30) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Serve.swift:13 — ServeCommand.execute 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 · OsaurusEvalsCLI.runCaptureScreen (cyclomatic 30) · ×1
  • OsaurusEvalsCLI.runCaptureScreen (cyclomatic 30) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/OsaurusEvalsCaptureScreenCLI.swift:39 — OsaurusEvalsCLI.runCaptureScreen 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 · FileCopyTool.execute (cyclomatic 30) · ×1
  • FileCopyTool.execute (cyclomatic 30) Packages/OsaurusCore/Folder/FileCopyTool.swift:89 — FileCopyTool.execute 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 · ConfigPlanner.summarizePortableSettings (cyclomatic 30) · ×1
  • ConfigPlanner.summarizePortableSettings (cyclomatic 30) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1426 — ConfigPlanner.summarizePortableSettings 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 · ResponsesItemPayload.transform (cyclomatic 30) · ×1
  • ResponsesItemPayload.transform (cyclomatic 30) Packages/OsaurusCore/PrivacyFilter/Core/MessageScrubbing.swift:488 — ResponsesItemPayload.transform 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 · PluginHostContext.complete (cyclomatic 30) · ×1
  • PluginHostContext.complete (cyclomatic 30) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1528 — PluginHostContext.complete 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 · ChatSession.dispatchSend (cyclomatic 30) · ×1
  • ChatSession.dispatchSend (cyclomatic 30) Packages/OsaurusCore/Views/Chat/ChatView.swift:7577 — ChatSession.dispatchSend 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. This shape REPEATS in the file: 3 other methods here (ChatSession.dispatchSend::runTurn, ChatSession.dispatchSend::runTurn::postProcessToolResult, ChatSession.dispatchSend::runTurn::executeToolBatch) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 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 · ShowCommand.printFormattedOutput (cyclomatic 29) · ×1
  • ShowCommand.printFormattedOutput (cyclomatic 29) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Show.swift:166 — ShowCommand.printFormattedOutput 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 · OsaurusEvalsCLI.runCommand (cyclomatic 29) · ×1
  • OsaurusEvalsCLI.runCommand (cyclomatic 29) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/OsaurusEvalsCLI.swift:148 — OsaurusEvalsCLI.runCommand 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 · EvalRunner.runArchitectCase (cyclomatic 29) · ×1
  • EvalRunner.runArchitectCase (cyclomatic 29) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerWorkflow.swift:43 — EvalRunner.runArchitectCase 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 · FileEditTool.normalizingEditShapes (cyclomatic 29) · ×1
  • FileEditTool.normalizingEditShapes (cyclomatic 29) Packages/OsaurusCore/Folder/FolderTools.swift:3628 — FileEditTool.normalizingEditShapes has cyclomatic complexity 29 (threshold 15). Of this number, 26 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CNContactsService.search (cyclomatic 29) · ×1
  • CNContactsService.search (cyclomatic 29) Packages/OsaurusCore/AppleApps/Contacts/ContactsService.swift:187 — CNContactsService.search has cyclomatic complexity 29 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ConfigApplier.applyProviders (cyclomatic 29) · ×1
  • ConfigApplier.applyProviders (cyclomatic 29) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:2060 — ConfigApplier.applyProviders 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 · ConfigPlanner.planAgents (cyclomatic 29) · ×1
  • ConfigPlanner.planAgents (cyclomatic 29) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1471 — ConfigPlanner.planAgents 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 · AgentTaskState.nextStepBias (cyclomatic 29) · ×1
  • AgentTaskState.nextStepBias (cyclomatic 29) Packages/OsaurusCore/Services/Chat/AgentTaskState.swift:1027 — AgentTaskState.nextStepBias 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 · ChatImportVerifier.verify (cyclomatic 29) · ×1
  • ChatImportVerifier.verify (cyclomatic 29) Packages/OsaurusCore/Services/ChatImport/ChatImportVerifier.swift:25 — ChatImportVerifier.verify 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 · FoundationModelService.dynamicSchema (cyclomatic 29) · ×1
  • FoundationModelService.dynamicSchema (cyclomatic 29) Packages/OsaurusCore/Services/Inference/FoundationModelService.swift:671 — FoundationModelService.dynamicSchema 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 · MemoryService.performDistillSession (cyclomatic 29) · ×1
  • MemoryService.performDistillSession (cyclomatic 29) Packages/OsaurusCore/Services/Memory/MemoryService.swift:829 — MemoryService.performDistillSession 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 · ImageModelRequestPolicy.validate (cyclomatic 29) · ×1
  • ImageModelRequestPolicy.validate (cyclomatic 29) Packages/OsaurusCore/Services/ModelRuntime/ImageModelRequestPolicy.swift:54 — ImageModelRequestPolicy.validate 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 · PluginHostContext.httpRequest (cyclomatic 29) · ×1
  • PluginHostContext.httpRequest (cyclomatic 29) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:2665 — PluginHostContext.httpRequest 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 · WorkflowEvalHarness.structureChecks (cyclomatic 29) · ×1
  • WorkflowEvalHarness.structureChecks (cyclomatic 29) Packages/OsaurusCore/Services/Workflow/WorkflowEvalHarness.swift:988 — WorkflowEvalHarness.structureChecks 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 · RunWorkflowTool.execute (cyclomatic 29) · ×1
  • RunWorkflowTool.execute (cyclomatic 29) Packages/OsaurusCore/Tools/Workflow/WorkflowTools.swift:522 — RunWorkflowTool.execute 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 · EvalMatrix.formatMarkdown (cyclomatic 28) · ×1
  • EvalMatrix.formatMarkdown (cyclomatic 28) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalMatrix.swift:389 — EvalMatrix.formatMarkdown 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 · Skill.parseYaml (cyclomatic 28) · ×1
  • Skill.parseYaml (cyclomatic 28) Packages/OsaurusCore/Models/Agent/Skill.swift:672 — Skill.parseYaml 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 · HTTPHandler.handleCompletions (cyclomatic 28) · ×1
  • HTTPHandler.handleCompletions (cyclomatic 28) Packages/OsaurusCore/Networking/HTTPHandler.swift:14835 — HTTPHandler.handleCompletions 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 · HTTPHandler.handleAnthropicMessagesStreaming (cyclomatic 28) · ×1
  • HTTPHandler.handleAnthropicMessagesStreaming (cyclomatic 28) Packages/OsaurusCore/Networking/HTTPHandler.swift:17931 — HTTPHandler.handleAnthropicMessagesStreaming has cyclomatic complexity 28 (threshold 15). Of this number, 22 points are the body's own statements and 6 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 · ListKnowledgeTool.execute (cyclomatic 28) · ×1
  • ListKnowledgeTool.execute (cyclomatic 28) Packages/OsaurusCore/Tools/KnowledgeTools.swift:726 — ListKnowledgeTool.execute 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 · OsaurusConfigTool.handleTemplates (cyclomatic 28) · ×1
  • OsaurusConfigTool.handleTemplates (cyclomatic 28) Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool.swift:685 — OsaurusConfigTool.handleTemplates 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 · DispatchEnvelope.badges (cyclomatic 28) · ×1
  • DispatchEnvelope.badges (cyclomatic 28) Packages/OsaurusCore/Models/Chat/DispatchEnvelope.swift:456 — DispatchEnvelope.badges 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 · AgentChannelConnectionService.authorizeInboundMessage (cyclomatic 28) · ×1
  • AgentChannelConnectionService.authorizeInboundMessage (cyclomatic 28) Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1111 — AgentChannelConnectionService.authorizeInboundMessage 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 · ContextBudgetManager.summarizeToolResult (cyclomatic 28) · ×1
  • ContextBudgetManager.summarizeToolResult (cyclomatic 28) Packages/OsaurusCore/Services/Chat/ContextBudgetManager.swift:755 — ContextBudgetManager.summarizeToolResult 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 · ImageComposerRequestBuilder.build (cyclomatic 28) · ×1
  • ImageComposerRequestBuilder.build (cyclomatic 28) Packages/OsaurusCore/Services/ModelRuntime/ImageComposerRequestBuilder.swift:81 — ImageComposerRequestBuilder.build 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 · SlackConnectionService.diagnostics (cyclomatic 28) · ×1
  • SlackConnectionService.diagnostics (cyclomatic 28) Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:582 — SlackConnectionService.diagnostics 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 · WorkflowTestTool.runExamples (cyclomatic 28) · ×1
  • WorkflowTestTool.runExamples (cyclomatic 28) Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift:806 — WorkflowTestTool.runExamples 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 · AssignedPickerHostingView.applyRecipe · ×1
  • AssignedPickerHostingView.applyRecipe::visit (cyclomatic 28) Packages/OsaurusCore/Models/Theme/InspectionAdapters/AssignedNativePicker.swift:239 — AssignedPickerHostingView.applyRecipe::visit 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 · OsaurusCLI.parseCommand (cyclomatic 27) · ×1
  • OsaurusCLI.parseCommand (cyclomatic 27) Packages/OsaurusCLI/Sources/OsaurusCLI/OsaurusCLI.swift:35 — OsaurusCLI.parseCommand has cyclomatic complexity 27 (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 · ImportCommand.render (cyclomatic 27) · ×1
  • ImportCommand.render (cyclomatic 27) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Import/ImportCommand.swift:728 — ImportCommand.render 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 · EvalRunner.runMicroPerfCase (cyclomatic 27) · ×1
  • EvalRunner.runMicroPerfCase (cyclomatic 27) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerMicroPerf.swift:26 — EvalRunner.runMicroPerfCase 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 · EvalRunner.runScreenContextCase (cyclomatic 27) · ×1
  • EvalRunner.runScreenContextCase (cyclomatic 27) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerScreenContext.swift:29 — EvalRunner.runScreenContextCase has cyclomatic complexity 27 (threshold 15). Of this number, 25 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 · ShellMutationPlanner.targets (cyclomatic 27) · ×1
  • ShellMutationPlanner.targets (cyclomatic 27) Packages/OsaurusCore/Folder/ShellMutationPlanner.swift:33 — ShellMutationPlanner.targets 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 · ExternalModelLocator.bundleDiagnostic (cyclomatic 27) · ×1
  • ExternalModelLocator.bundleDiagnostic (cyclomatic 27) Packages/OsaurusCore/Services/ExternalModelLocator.swift:916 — ExternalModelLocator.bundleDiagnostic has cyclomatic complexity 27 (threshold 15). Of this number, 23 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 · LocalGenerationDefaults.repairLagunaXS21TopKIfNeeded (cyclomatic 27) · ×1
  • LocalGenerationDefaults.repairLagunaXS21TopKIfNeeded (cyclomatic 27) Packages/OsaurusCore/Services/LocalGenerationDefaults.swift:160 — LocalGenerationDefaults.repairLagunaXS21TopKIfNeeded has cyclomatic complexity 27 (threshold 15). Of this number, 24 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CapabilitiesDiscoverTool.execute (cyclomatic 27) · ×1
  • CapabilitiesDiscoverTool.execute (cyclomatic 27) Packages/OsaurusCore/Tools/CapabilityTools.swift:397 — CapabilitiesDiscoverTool.execute 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 · CalculatorNode.evaluate (cyclomatic 27) · ×1
  • CalculatorNode.evaluate (cyclomatic 27) Packages/OsaurusCore/Utils/CalculatorEngine.swift:430 — CalculatorNode.evaluate 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 · ConfigApplier.applyLocked (cyclomatic 27) · ×1
  • ConfigApplier.applyLocked (cyclomatic 27) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:112 — ConfigApplier.applyLocked 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 · ConfigApplier.applyDelegation (cyclomatic 27) · ×1
  • ConfigApplier.applyDelegation (cyclomatic 27) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:1235 — ConfigApplier.applyDelegation 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 · FileDiff.partialToolName (cyclomatic 27) · ×1
  • FileDiff.partialToolName (cyclomatic 27) Packages/OsaurusCore/Models/Chat/FileDiff.swift:261 — FileDiff.partialToolName 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 · ChatImportMCPBuilder.item (cyclomatic 27) · ×1
  • ChatImportMCPBuilder.item (cyclomatic 27) Packages/OsaurusCore/Services/ChatImport/ChatImportFastPaths.swift:405 — ChatImportMCPBuilder.item 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 · ImageGenerationService.generateVideo (cyclomatic 27) · ×1
  • ImageGenerationService.generateVideo (cyclomatic 27) Packages/OsaurusCore/Services/ModelRuntime/ImageGenerationService.swift:323 — ImageGenerationService.generateVideo 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 · State.consume (cyclomatic 27) · ×1
  • State.consume (cyclomatic 27) Packages/OsaurusCore/Services/Provider/RemoteResponsesPrivacyStream.swift:72 — State.consume 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 · WorkspacesService.refreshSelectedWorkspace (cyclomatic 27) · ×1
  • WorkspacesService.refreshSelectedWorkspace (cyclomatic 27) Packages/OsaurusCore/Services/Router/WorkspacesService.swift:542 — WorkspacesService.refreshSelectedWorkspace 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. This is NOT this file's highest cyclomatic complexity: WorkspacesService.message (cyclomatic 30) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SyncConversationMapper.fitTurnObject (cyclomatic 27) · ×1
  • SyncConversationMapper.fitTurnObject (cyclomatic 27) Packages/OsaurusCore/Services/Sync/SyncConversationMapper.swift:384 — SyncConversationMapper.fitTurnObject 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 · SyncConversationStore.saveTurns (cyclomatic 27) · ×1
  • SyncConversationStore.saveTurns (cyclomatic 27) Packages/OsaurusCore/Services/Sync/SyncConversationStore.swift:392 — SyncConversationStore.saveTurns 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 · HTTPNodeExecutor.paginated (cyclomatic 27) · ×1
  • HTTPNodeExecutor.paginated (cyclomatic 27) Packages/OsaurusCore/Services/Workflow/HTTPNodeExecutor.swift:296 — HTTPNodeExecutor.paginated 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 · ImageSubagentKind.resolveModel (cyclomatic 27) · ×1
  • ImageSubagentKind.resolveModel (cyclomatic 27) Packages/OsaurusCore/Subagent/Kinds/ImageSubagentKind.swift:85 — ImageSubagentKind.resolveModel 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 · ChatSession.runVideoGeneration (cyclomatic 27) · ×1
  • ChatSession.runVideoGeneration (cyclomatic 27) Packages/OsaurusCore/Views/Chat/ChatView.swift:7164 — ChatSession.runVideoGeneration 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 · ImageGenerationPanelView.run (cyclomatic 27) · ×1
  • ImageGenerationPanelView.run (cyclomatic 27) Packages/OsaurusCore/Views/Model/ImageGenerationPanelView.swift:728 — ImageGenerationPanelView.run has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkflowRunView.nodeRow (cyclomatic 27) · ×1
  • WorkflowRunView.nodeRow (cyclomatic 27) Packages/OsaurusCore/Views/Workflow/WorkflowRunView.swift:228 — WorkflowRunView.nodeRow 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 · OOXMLText.replace (cyclomatic 27) · ×1
  • OOXMLText.replace (cyclomatic 27) Packages/OsaurusCore/Services/Documents/OOXML/OOXMLText.swift:269 — OOXMLText.replace has cyclomatic complexity 27 (threshold 15). Of this number, 20 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 · LocalModelsCatalogPage.body (cyclomatic 27) · ×1
  • LocalModelsCatalogPage.body (cyclomatic 27) Packages/OsaurusCore/Views/Model/Catalog/LocalModelsCatalogPage.swift:45 — LocalModelsCatalogPage.body 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 · BenchCommand.parseOptions (cyclomatic 26) · ×1
  • BenchCommand.parseOptions (cyclomatic 26) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Bench.swift:507 — BenchCommand.parseOptions has cyclomatic complexity 26 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EvalMatrixBuilder.errorCategory (cyclomatic 26) · ×1
  • EvalMatrixBuilder.errorCategory (cyclomatic 26) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalMatrix.swift:741 — EvalMatrixBuilder.errorCategory 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 · EvalRunner.scoreSpawnResidencyLane (cyclomatic 26) · ×1
  • EvalRunner.scoreSpawnResidencyLane (cyclomatic 26) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:323 — EvalRunner.scoreSpawnResidencyLane has cyclomatic complexity 26 (threshold 15). Of this number, 24 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 · DesignMessageChecks.run (cyclomatic 26) · ×1
  • DesignMessageChecks.run (cyclomatic 26) Packages/OsaurusCore/DevelopmentDesign/DesignMessageChecks.swift:5 — DesignMessageChecks.run has cyclomatic complexity 26 (threshold 15). Of this number, 24 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · FileUndoTool.execute (cyclomatic 26) · ×1
  • FileUndoTool.execute (cyclomatic 26) Packages/OsaurusCore/Folder/FolderTools.swift:4596 — FileUndoTool.execute 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 · RemoteProviderManager.connect (cyclomatic 26) · ×1
  • RemoteProviderManager.connect (cyclomatic 26) Packages/OsaurusCore/Managers/RemoteProviderManager.swift:409 — RemoteProviderManager.connect 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 · SpeechService.startStreamingTranscription (cyclomatic 26) · ×1
  • SpeechService.startStreamingTranscription (cyclomatic 26) Packages/OsaurusCore/Managers/SpeechService.swift:925 — SpeechService.startStreamingTranscription 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 · HTTPHandler.handleSessionEndpoint (cyclomatic 26) · ×1
  • HTTPHandler.handleSessionEndpoint (cyclomatic 26) Packages/OsaurusCore/Networking/HTTPHandler.swift:8502 — HTTPHandler.handleSessionEndpoint 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 · ModelRuntime.computeWeightsSizeBytes (cyclomatic 26) · ×1
  • ModelRuntime.computeWeightsSizeBytes (cyclomatic 26) Packages/OsaurusCore/Services/ModelRuntime.swift:8011 — ModelRuntime.computeWeightsSizeBytes 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 · SpawnPermissionGate.authorize (cyclomatic 26) · ×1
  • SpawnPermissionGate.authorize (cyclomatic 26) Packages/OsaurusCore/Subagent/SpawnPermissionGate.swift:85 — SpawnPermissionGate.authorize 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 · AppleScriptToolDispatch.literalsForDispatch (cyclomatic 26) · ×1
  • AppleScriptToolDispatch.literalsForDispatch (cyclomatic 26) Packages/OsaurusCore/AppleScript/Tool/AppleScriptToolDispatch.swift:413 — AppleScriptToolDispatch.literalsForDispatch 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 · ConfigEvents.export (cyclomatic 26) · ×1
  • ConfigEvents.export (cyclomatic 26) Packages/OsaurusCore/Configuration/Declarative/ConfigEvents.swift:248 — ConfigEvents.export 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 · ConfigYAML.walk (cyclomatic 26) · ×1
  • ConfigYAML.walk (cyclomatic 26) Packages/OsaurusCore/Configuration/Declarative/ConfigYAML.swift:160 — ConfigYAML.walk 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 · OsaurusImportTool.execute (cyclomatic 26) · ×1
  • OsaurusImportTool.execute (cyclomatic 26) Packages/OsaurusCore/Configuration/Declarative/OsaurusImportTool.swift:44 — OsaurusImportTool.execute 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 · AnthropicMessagesRequest.toChatCompletionRequest (cyclomatic 26) · ×1
  • AnthropicMessagesRequest.toChatCompletionRequest (cyclomatic 26) Packages/OsaurusCore/Models/API/AnthropicAPI.swift:1017 — AnthropicMessagesRequest.toChatCompletionRequest 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 · WorkflowDraftOp.parseConnection (cyclomatic 26) · ×1
  • WorkflowDraftOp.parseConnection (cyclomatic 26) Packages/OsaurusCore/Models/Workflow/WorkflowDraft.swift:296 — WorkflowDraftOp.parseConnection 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. This is NOT this file's highest cyclomatic complexity: WorkflowDiff.plainLines::fieldName (cyclomatic 42) 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 · BoundedZipReader.parseEntries (cyclomatic 26) · ×1
  • BoundedZipReader.parseEntries (cyclomatic 26) Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:1504 — BoundedZipReader.parseEntries 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 · PPTXEmitter.slides (cyclomatic 26) · ×1
  • PPTXEmitter.slides (cyclomatic 26) Packages/OsaurusCore/Services/Documents/PPTXEmitter.swift:55 — PPTXEmitter.slides 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 · FileDiffEngine.diff (cyclomatic 26) · ×1
  • FileDiffEngine.diff (cyclomatic 26) Packages/OsaurusCore/Services/FileHistory/FileDiffEngine.swift:75 — FileDiffEngine.diff has cyclomatic complexity 26 (threshold 15). Of this number, 22 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · LocalVideoRequestPolicy.init (cyclomatic 26) · ×1
  • LocalVideoRequestPolicy.init (cyclomatic 26) Packages/OsaurusCore/Services/MediaGeneration/LocalVideoRequestPolicy.swift:15 — LocalVideoRequestPolicy.init 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 · WorkspaceAgentRunClient.prepare (cyclomatic 26) · ×1
  • WorkspaceAgentRunClient.prepare (cyclomatic 26) Packages/OsaurusCore/Services/Router/WorkspaceAgentRunClient.swift:157 — WorkspaceAgentRunClient.prepare 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 · AgentDraftTool.queueImport (cyclomatic 26) · ×1
  • AgentDraftTool.queueImport (cyclomatic 26) Packages/OsaurusCore/Tools/Agent/AgentDraftTool.swift:268 — AgentDraftTool.queueImport 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 · ChatSession.compactBeforeToolContinuation (cyclomatic 26) · ×1
  • ChatSession.compactBeforeToolContinuation (cyclomatic 26) Packages/OsaurusCore/Views/Chat/ChatView.swift:3845 — ChatSession.compactBeforeToolContinuation 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 · ChatSession.runImageGeneration (cyclomatic 26) · ×1
  • ChatSession.runImageGeneration (cyclomatic 26) Packages/OsaurusCore/Views/Chat/ChatView.swift:6923 — ChatSession.runImageGeneration has cyclomatic complexity 26 (threshold 15). Of this number, 24 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 · AnchoredCardCoordinator.updatePresentation (cyclomatic 26) · ×1
  • AnchoredCardCoordinator.updatePresentation (cyclomatic 26) Packages/OsaurusCore/Views/Common/AnchoredCardPresenter.swift:292 — AnchoredCardCoordinator.updatePresentation 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 · XLSXFormula.scan (cyclomatic 26) · ×1
  • XLSXFormula.scan (cyclomatic 26) Packages/OsaurusCore/Services/Documents/OOXML/XLSXFormula.swift:69 — XLSXFormula.scan 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. This shape REPEATS in the file: one other method here (XLSXFormula.scan::readCell) 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 · LanguageModelCatalog.makeLists (cyclomatic 26) · ×1
  • LanguageModelCatalog.makeLists (cyclomatic 26) Packages/OsaurusCore/Views/Model/Catalog/LanguageCatalogSource.swift:134 — LanguageModelCatalog.makeLists has cyclomatic complexity 26 (threshold 15). Of this number, 16 points are the body's own statements and 10 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MCPCommand.execute (cyclomatic 25) · ×1
  • MCPCommand.execute (cyclomatic 25) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/MCPCommand.swift:14 — MCPCommand.execute 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 · EvalReport.formatTelemetryLine (cyclomatic 25) · ×1
  • EvalReport.formatTelemetryLine (cyclomatic 25) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReport.swift:898 — EvalReport.formatTelemetryLine 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 · BackgroundTaskManager.lookupReattachableSession (cyclomatic 25) · ×1
  • BackgroundTaskManager.lookupReattachableSession (cyclomatic 25) Packages/OsaurusCore/Managers/BackgroundTaskManager.swift:1433 — BackgroundTaskManager.lookupReattachableSession 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 · MCPProviderManager.performConnect (cyclomatic 25) · ×1
  • MCPProviderManager.performConnect (cyclomatic 25) Packages/OsaurusCore/Managers/MCPProviderManager.swift:307 — MCPProviderManager.performConnect 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 · OpenAICompatibleTTSClient.synthesizeStreaming (cyclomatic 25) · ×1
  • OpenAICompatibleTTSClient.synthesizeStreaming (cyclomatic 25) Packages/OsaurusCore/Managers/OpenAICompatibleTTSClient.swift:234 — OpenAICompatibleTTSClient.synthesizeStreaming has cyclomatic complexity 25 (threshold 15). Of this number, 24 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 · HTTPHandler.handleChatNDJSON (cyclomatic 25) · ×1
  • HTTPHandler.handleChatNDJSON (cyclomatic 25) Packages/OsaurusCore/Networking/HTTPHandler.swift:15863 — HTTPHandler.handleChatNDJSON has cyclomatic complexity 25 (threshold 15). Of this number, 24 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 · ScreenContextDistiller.sampledItem (cyclomatic 25) · ×1
  • ScreenContextDistiller.sampledItem (cyclomatic 25) Packages/OsaurusCore/ComputerUse/Perception/ScreenContextDistiller.swift:519 — ScreenContextDistiller.sampledItem 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 · ConfigApplier.patch (cyclomatic 25) · ×1
  • ConfigApplier.patch (cyclomatic 25) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:799 — ConfigApplier.patch 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 · ConfigDiff.merge (cyclomatic 25) · ×1
  • ConfigDiff.merge (cyclomatic 25) Packages/OsaurusCore/Configuration/Declarative/ConfigDiff.swift:68 — ConfigDiff.merge 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 · OsaurusConfigDocument.translatingLegacyEvents (cyclomatic 25) · ×1
  • OsaurusConfigDocument.translatingLegacyEvents (cyclomatic 25) Packages/OsaurusCore/Configuration/Declarative/ConfigEvents.swift:1285 — OsaurusConfigDocument.translatingLegacyEvents has cyclomatic complexity 25 (threshold 15). Of this number, 24 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 · OpenResponsesRequest.toResponsesInferenceRequest (cyclomatic 25) · ×1
  • OpenResponsesRequest.toResponsesInferenceRequest (cyclomatic 25) Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:1306 — OpenResponsesRequest.toResponsesInferenceRequest has cyclomatic complexity 25 (threshold 15). Of this number, 24 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 · OpenResponsesRequest.toChatCompletionRequest (cyclomatic 25) · ×1
  • OpenResponsesRequest.toChatCompletionRequest (cyclomatic 25) Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:1527 — OpenResponsesRequest.toChatCompletionRequest 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 · LocalVisionEvidence.mimoAudioEvidence (cyclomatic 25) · ×1
  • LocalVisionEvidence.mimoAudioEvidence (cyclomatic 25) Packages/OsaurusCore/Models/Configuration/LocalVisionEvidence.swift:404 — LocalVisionEvidence.mimoAudioEvidence 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 · ScheduleFrequency.nextRunDate (cyclomatic 25) · ×1
  • ScheduleFrequency.nextRunDate (cyclomatic 25) Packages/OsaurusCore/Models/Schedule/Schedule.swift:111 — ScheduleFrequency.nextRunDate 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 · LocalAgentBridge.scheduleNextRun (cyclomatic 25) · ×1
  • LocalAgentBridge.scheduleNextRun (cyclomatic 25) Packages/OsaurusCore/Services/AgentBridge/LocalAgentBridge.swift:516 — LocalAgentBridge.scheduleNextRun 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 · AgentSubagentRunner.run (cyclomatic 25) · ×1
  • AgentSubagentRunner.run (cyclomatic 25) Packages/OsaurusCore/Services/AgentDelegation/AgentSubagentRunner.swift:159 — AgentSubagentRunner.run has cyclomatic complexity 25 (threshold 15). Of this number, 22 points are the body's own statements and 3 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 · ResponsesGenerationAccumulator.consume (cyclomatic 25) · ×1
  • ResponsesGenerationAccumulator.consume (cyclomatic 25) Packages/OsaurusCore/Services/Inference/ResponsesGenerationAccumulator.swift:42 — ResponsesGenerationAccumulator.consume 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 · WorkflowRunner.runMap (cyclomatic 25) · ×1
  • WorkflowRunner.runMap (cyclomatic 25) Packages/OsaurusCore/Services/Workflow/WorkflowRunner.swift:1083 — WorkflowRunner.runMap has cyclomatic complexity 25 (threshold 15). Of this number, 23 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 · CapabilityRowBuilder.build (cyclomatic 25) · ×1
  • CapabilityRowBuilder.build (cyclomatic 25) Packages/OsaurusCore/Views/Agent/AgentCapabilityManagerView.swift:149 — CapabilityRowBuilder.build has cyclomatic complexity 25 (threshold 15). Of this number, 24 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 · SelectableTextView.applyThemeStyling (cyclomatic 25) · ×1
  • SelectableTextView.applyThemeStyling (cyclomatic 25) Packages/OsaurusCore/Views/Chat/SelectableTextView.swift:824 — SelectableTextView.applyThemeStyling 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 · ToolsManagerView.updateFilteredLists (cyclomatic 25) · ×1
  • ToolsManagerView.updateFilteredLists (cyclomatic 25) Packages/OsaurusCore/Views/Plugin/ToolsManagerView.swift:395 — ToolsManagerView.updateFilteredLists has cyclomatic complexity 25 (threshold 15). Of this number, 23 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 · XLSXEditor.renameSheet (cyclomatic 25) · ×1
  • XLSXEditor.renameSheet (cyclomatic 25) Packages/OsaurusCore/Services/Documents/OOXML/XLSXEditor.swift:725 — XLSXEditor.renameSheet 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 · AppDelegate.updateStatusItemAndMenu (cyclomatic 24) · ×1
  • AppDelegate.updateStatusItemAndMenu (cyclomatic 24) Packages/OsaurusCore/AppDelegate.swift:2125 — AppDelegate.updateStatusItemAndMenu 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 · FileEditTool.execute (cyclomatic 24) · ×1
  • FileEditTool.execute (cyclomatic 24) Packages/OsaurusCore/Folder/FolderTools.swift:3747 — FileEditTool.execute 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 · ToastAction.from (cyclomatic 24) · ×1
  • ToastAction.from (cyclomatic 24) Packages/OsaurusCore/Models/Toast.swift:372 — ToastAction.from 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 · HTTPHandler.workspaceKeyMayReach (cyclomatic 24) · ×1
  • HTTPHandler.workspaceKeyMayReach (cyclomatic 24) Packages/OsaurusCore/Networking/HTTPHandler.swift:4345 — HTTPHandler.workspaceKeyMayReach 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 · ModelSSDResidency.remoteNGramBytes (cyclomatic 24) · ×1
  • ModelSSDResidency.remoteNGramBytes (cyclomatic 24) Packages/OsaurusCore/Services/ModelSSDResidency.swift:80 — ModelSSDResidency.remoteNGramBytes 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 · CapabilitiesLoadTool.loadTool (cyclomatic 24) · ×1
  • CapabilitiesLoadTool.loadTool (cyclomatic 24) Packages/OsaurusCore/Tools/CapabilityTools.swift:1233 — CapabilitiesLoadTool.loadTool 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 · ShareArtifactTool.execute (cyclomatic 24) · ×1
  • ShareArtifactTool.execute (cyclomatic 24) Packages/OsaurusCore/Tools/ShareArtifactTool.swift:90 — ShareArtifactTool.execute has cyclomatic complexity 24 (threshold 15). Of this number, 22 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SearchAndExtractTool.execute (cyclomatic 24) · ×1
  • SearchAndExtractTool.execute (cyclomatic 24) Packages/OsaurusCore/Tools/WebSearchTools.swift:420 — SearchAndExtractTool.execute 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 · EventKitCalendarService.update (cyclomatic 24) · ×1
  • EventKitCalendarService.update (cyclomatic 24) Packages/OsaurusCore/AppleApps/Calendar/CalendarService.swift:324 — EventKitCalendarService.update 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 · AppleScriptToolDispatch.exactReplacementLiterals (cyclomatic 24) · ×1
  • AppleScriptToolDispatch.exactReplacementLiterals (cyclomatic 24) Packages/OsaurusCore/AppleScript/Tool/AppleScriptToolDispatch.swift:519 — AppleScriptToolDispatch.exactReplacementLiterals 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 · BrowserToolExecutor.batchDo (cyclomatic 24) · ×1
  • BrowserToolExecutor.batchDo (cyclomatic 24) Packages/OsaurusCore/Browser/Tool/BrowserToolExecutor.swift:491 — BrowserToolExecutor.batchDo 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 · PluginManager.loadPluginWithError (cyclomatic 24) · ×1
  • PluginManager.loadPluginWithError (cyclomatic 24) Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:1217 — PluginManager.loadPluginWithError 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 · ChatSessionData.sameListRow (cyclomatic 24) · ×1
  • ChatSessionData.sameListRow (cyclomatic 24) Packages/OsaurusCore/Models/Chat/ChatSessionData.swift:212 — ChatSessionData.sameListRow 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 · ServerRuntimeSettingsStore.shouldRepairPagedCacheDefault (cyclomatic 24) · ×1
  • ServerRuntimeSettingsStore.shouldRepairPagedCacheDefault (cyclomatic 24) Packages/OsaurusCore/Models/Configuration/ServerRuntimeSettingsStore.swift:650 — ServerRuntimeSettingsStore.shouldRepairPagedCacheDefault 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 · PrivacyFilterEngine.detect (cyclomatic 24) · ×1
  • PrivacyFilterEngine.detect (cyclomatic 24) Packages/OsaurusCore/PrivacyFilter/Core/PrivacyFilterEngine.swift:176 — PrivacyFilterEngine.detect 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 · AgentChannelInboundRelay.deliverReply (cyclomatic 24) · ×1
  • AgentChannelInboundRelay.deliverReply (cyclomatic 24) Packages/OsaurusCore/Services/AgentChannel/AgentChannelInboundRelay.swift:670 — AgentChannelInboundRelay.deliverReply 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 · ContextBudgetManager.trimMessagesReportingOverflow (cyclomatic 24) · ×1
  • ContextBudgetManager.trimMessagesReportingOverflow (cyclomatic 24) Packages/OsaurusCore/Services/Chat/ContextBudgetManager.swift:369 — ContextBudgetManager.trimMessagesReportingOverflow has cyclomatic complexity 24 (threshold 15). Of this number, 21 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · OpenAIPromptBuilder.buildPrompt (cyclomatic 24) · ×1
  • OpenAIPromptBuilder.buildPrompt (cyclomatic 24) Packages/OsaurusCore/Services/Chat/PromptBuilder.swift:13 — OpenAIPromptBuilder.buildPrompt 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 · WebhookHandshakeResponder.respond (cyclomatic 24) · ×1
  • WebhookHandshakeResponder.respond (cyclomatic 24) Packages/OsaurusCore/Services/Event/WebhookProviderProfile.swift:510 — WebhookHandshakeResponder.respond 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 · FileDiffEngine.canonicalLines (cyclomatic 24) · ×1
  • FileDiffEngine.canonicalLines (cyclomatic 24) Packages/OsaurusCore/Services/FileHistory/FileDiffEngine.swift:494 — FileDiffEngine.canonicalLines has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 9 of the 24 points are its own statements and the rest belongs to 2 function items inside it that branch (walk, textLines). 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 · RuntimeProofValidator.appendProvenClaimIssues (cyclomatic 24) · ×1
  • RuntimeProofValidator.appendProvenClaimIssues (cyclomatic 24) Packages/OsaurusCore/Services/ModelRuntime/RuntimeProofValidation.swift:310 — RuntimeProofValidator.appendProvenClaimIssues 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 · OnboardingFirstRun.perform (cyclomatic 24) · ×1
  • OnboardingFirstRun.perform (cyclomatic 24) Packages/OsaurusCore/Services/Onboarding/OnboardingFirstRun.swift:301 — OnboardingFirstRun.perform 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 · OnboardingFirstRun.explore (cyclomatic 24) · ×1
  • OnboardingFirstRun.explore (cyclomatic 24) Packages/OsaurusCore/Services/Onboarding/OnboardingFirstRun.swift:365 — OnboardingFirstRun.explore 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 · OpenAICompatibleToolCallAccumulator.validateToolCallJSON (cyclomatic 24) · ×1
  • OpenAICompatibleToolCallAccumulator.validateToolCallJSON (cyclomatic 24) Packages/OsaurusCore/Services/Provider/OpenAICompatibleStreamParser.swift:329 — OpenAICompatibleToolCallAccumulator.validateToolCallJSON 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 · RemoteProviderService.handleAnthropicEvent (cyclomatic 24) · ×1
  • RemoteProviderService.handleAnthropicEvent (cyclomatic 24) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:2258 — RemoteProviderService.handleAnthropicEvent 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 · MediaNodeExecutor.runLocal (cyclomatic 24) · ×1
  • MediaNodeExecutor.runLocal (cyclomatic 24) Packages/OsaurusCore/Services/Workflow/MediaNodeExecutor.swift:442 — MediaNodeExecutor.runLocal 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 · TextSubagentKind.run (cyclomatic 24) · ×1
  • TextSubagentKind.run (cyclomatic 24) Packages/OsaurusCore/Subagent/Kinds/TextSubagentKind.swift:987 — TextSubagentKind.run 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 · WorkflowTestTool.execute (cyclomatic 24) · ×1
  • WorkflowTestTool.execute (cyclomatic 24) Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift:515 — WorkflowTestTool.execute 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 · ChatHistoryFilterPicker.passes (cyclomatic 24) · ×1
  • ChatHistoryFilterPicker.passes (cyclomatic 24) Packages/OsaurusCore/Views/Chat/ChatHistoryPane.swift:417 — ChatHistoryFilterPicker.passes 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 · SessionRow.navigatorRow (cyclomatic 24) · ×1
  • SessionRow.navigatorRow (cyclomatic 24) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:3176 — SessionRow.navigatorRow 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 · NativeActivityGroupView.configure (cyclomatic 24) · ×1
  • NativeActivityGroupView.configure (cyclomatic 24) Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:93 — NativeActivityGroupView.configure 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 · NativeMessageCellView.configureAsParagraph (cyclomatic 24) · ×1
  • NativeMessageCellView.configureAsParagraph (cyclomatic 24) Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2647 — NativeMessageCellView.configureAsParagraph 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 · WorkflowRunView.details (cyclomatic 24) · ×1
  • WorkflowRunView.details (cyclomatic 24) Packages/OsaurusCore/Views/Workflow/WorkflowRunView.swift:390 — WorkflowRunView.details 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 · CatalogPreviewInspection.label (cyclomatic 24) · ×1
  • CatalogPreviewInspection.label (cyclomatic 24) Packages/OsaurusCore/Models/Theme/DesignLibrary/CatalogPreviewInspection.swift:15 — CatalogPreviewInspection.label 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 · LoginWithOsaurusRequest.parse (cyclomatic 24) · ×1
  • LoginWithOsaurusRequest.parse (cyclomatic 24) Packages/OsaurusCore/Services/Auth/LoginWithOsaurus/LoginWithOsaurusRequest.swift:183 — LoginWithOsaurusRequest.parse 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 · EvalRunner.prefillProgressAccountingProblem (cyclomatic 23) · ×1
  • EvalRunner.prefillProgressAccountingProblem (cyclomatic 23) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerCacheProof.swift:749 — EvalRunner.prefillProgressAccountingProblem 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 · RunEnvironment.summary (cyclomatic 23) · ×1
  • RunEnvironment.summary (cyclomatic 23) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/RunEnvironment.swift:281 — RunEnvironment.summary 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 · CatalogLibraryFixture.body (cyclomatic 23) · ×1
  • CatalogLibraryFixture.body (cyclomatic 23) Packages/OsaurusCore/DevelopmentDesign/CatalogComponents.swift:304 — CatalogLibraryFixture.body 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 · Lines.replace (cyclomatic 23) · ×1
  • Lines.replace (cyclomatic 23) Packages/OsaurusCore/Folder/FileEditMatcher.swift:234 — Lines.replace has cyclomatic complexity 23 (threshold 15). Of this number, 21 points are the body's own statements and 2 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 · FolderContextService.buildFileTree · ×1
  • FolderContextService.buildFileTree::traverse (cyclomatic 23) Packages/OsaurusCore/Folder/FolderContextService.swift:266 — FolderContextService.buildFileTree::traverse 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 · FileWriteTool.writeDocument (cyclomatic 23) · ×1
  • FileWriteTool.writeDocument (cyclomatic 23) Packages/OsaurusCore/Folder/FolderTools.swift:3261 — FileWriteTool.writeDocument 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 · ShellRunTool.execute (cyclomatic 23) · ×1
  • ShellRunTool.execute (cyclomatic 23) Packages/OsaurusCore/Folder/FolderTools.swift:5735 — ShellRunTool.execute 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 · TranscriptionWorker.runLoop (cyclomatic 23) · ×1
  • TranscriptionWorker.runLoop (cyclomatic 23) Packages/OsaurusCore/Managers/SpeechService.swift:1515 — TranscriptionWorker.runLoop 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 · ModelDownloadService.transferFile (cyclomatic 23) · ×1
  • ModelDownloadService.transferFile (cyclomatic 23) Packages/OsaurusCore/Services/ModelDownloadService.swift:826 — ModelDownloadService.transferFile 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 · ModelRuntime.makeMLXChatMessages (cyclomatic 23) · ×1
  • ModelRuntime.makeMLXChatMessages (cyclomatic 23) Packages/OsaurusCore/Services/ModelRuntime.swift:7473 — ModelRuntime.makeMLXChatMessages 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 · SandboxReadFileTool.execute (cyclomatic 23) · ×1
  • SandboxReadFileTool.execute (cyclomatic 23) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1707 — SandboxReadFileTool.execute 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 · MCPProviderTool.convertMCPContent (cyclomatic 23) · ×1
  • MCPProviderTool.convertMCPContent (cyclomatic 23) Packages/OsaurusCore/Tools/MCPProviderTool.swift:483 — MCPProviderTool.convertMCPContent 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 · SchemaValidator.validateObject (cyclomatic 23) · ×1
  • SchemaValidator.validateObject (cyclomatic 23) Packages/OsaurusCore/Tools/SchemaValidator.swift:69 — SchemaValidator.validateObject 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 · AppleJSON.serializable (cyclomatic 23) · ×1
  • AppleJSON.serializable (cyclomatic 23) Packages/OsaurusCore/AppleApps/Support/AppleToolBase.swift:330 — AppleJSON.serializable has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · BrowserSnapshotFormatter.format (cyclomatic 23) · ×1
  • BrowserSnapshotFormatter.format (cyclomatic 23) Packages/OsaurusCore/Browser/Runtime/BrowserSupport.swift:172 — BrowserSnapshotFormatter.format 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 · AgentAction.argumentsJSON (cyclomatic 23) · ×1
  • AgentAction.argumentsJSON (cyclomatic 23) Packages/OsaurusCore/ComputerUse/Model/AgentAction.swift:224 — AgentAction.argumentsJSON 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 · OsaurusConfigDocument.declaredSections (cyclomatic 23) · ×1
  • OsaurusConfigDocument.declaredSections (cyclomatic 23) Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigDocument.swift:153 — OsaurusConfigDocument.declaredSections 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 · ContentBlock.knownFileContents (cyclomatic 23) · ×1
  • ContentBlock.knownFileContents (cyclomatic 23) Packages/OsaurusCore/Models/Chat/ContentBlock.swift:1283 — ContentBlock.knownFileContents 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 · MTPLayoutAdvisory.evaluate (cyclomatic 23) · ×1
  • MTPLayoutAdvisory.evaluate (cyclomatic 23) Packages/OsaurusCore/Models/Chat/MTPLayoutAdvisory.swift:135 — MTPLayoutAdvisory.evaluate 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 · ServerRuntimeSettingsStore.shouldRepairLegacyCacheDefaults (cyclomatic 23) · ×1
  • ServerRuntimeSettingsStore.shouldRepairLegacyCacheDefaults (cyclomatic 23) Packages/OsaurusCore/Models/Configuration/ServerRuntimeSettingsStore.swift:611 — ServerRuntimeSettingsStore.shouldRepairLegacyCacheDefaults 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 · ToolApprovalPresentation.guarantees (cyclomatic 23) · ×1
  • ToolApprovalPresentation.guarantees (cyclomatic 23) Packages/OsaurusCore/Models/Tool/ToolApprovalPresentation.swift:320 — ToolApprovalPresentation.guarantees 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 · WorkflowNode.effectiveOutputSchema (cyclomatic 23) · ×1
  • WorkflowNode.effectiveOutputSchema (cyclomatic 23) Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:495 — WorkflowNode.effectiveOutputSchema 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 · AgentSubagentRunner.consumeStream (cyclomatic 23) · ×1
  • AgentSubagentRunner.consumeStream (cyclomatic 23) Packages/OsaurusCore/Services/AgentDelegation/AgentSubagentRunner.swift:536 — AgentSubagentRunner.consumeStream 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 · OwnerApprovalService.request (cyclomatic 23) · ×1
  • OwnerApprovalService.request (cyclomatic 23) Packages/OsaurusCore/Services/Attention/OwnerApprovalService.swift:232 — OwnerApprovalService.request 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 · ChatImportRepoWalker.collect (cyclomatic 23) · ×1
  • ChatImportRepoWalker.collect (cyclomatic 23) Packages/OsaurusCore/Services/ChatImport/ChatImportSourceResolver.swift:305 — ChatImportRepoWalker.collect 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 · RemoteProviderService.dispatchFinal (cyclomatic 23) · ×1
  • RemoteProviderService.dispatchFinal (cyclomatic 23) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:2834 — RemoteProviderService.dispatchFinal 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 · RemoteResponsesNativeStream.capture (cyclomatic 23) · ×1
  • RemoteResponsesNativeStream.capture (cyclomatic 23) Packages/OsaurusCore/Services/Provider/RemoteResponsesNativeStream.swift:133 — RemoteResponsesNativeStream.capture 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 · SharedAgentStatus.derive (cyclomatic 23) · ×1
  • SharedAgentStatus.derive (cyclomatic 23) Packages/OsaurusCore/Services/Router/SharedAgentIdentity.swift:270 — SharedAgentStatus.derive 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 · WorkspaceAgentAccessHost.redeem (cyclomatic 23) · ×1
  • WorkspaceAgentAccessHost.redeem (cyclomatic 23) Packages/OsaurusCore/Services/Router/WorkspaceAgentAccessHost.swift:364 — WorkspaceAgentAccessHost.redeem 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 · MediaModelCandidate.constraintsSummary (cyclomatic 23) · ×1
  • MediaModelCandidate.constraintsSummary (cyclomatic 23) Packages/OsaurusCore/Services/Workflow/MediaModelResolver.swift:72 — MediaModelCandidate.constraintsSummary 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 · DatabaseImport.parseXLSX (cyclomatic 23) · ×1
  • DatabaseImport.parseXLSX (cyclomatic 23) Packages/OsaurusCore/Tools/Database/DatabaseImport.swift:253 — DatabaseImport.parseXLSX 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 · WorkflowRunsTool.nodeDetail (cyclomatic 23) · ×1
  • WorkflowRunsTool.nodeDetail (cyclomatic 23) Packages/OsaurusCore/Tools/Workflow/WorkflowRunsTool.swift:321 — WorkflowRunsTool.nodeDetail 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 · AgentDetailView.bodyCore (cyclomatic 23) · ×1
  • AgentDetailView.bodyCore (cyclomatic 23) Packages/OsaurusCore/Views/Agent/AgentsView.swift:1760 — AgentDetailView.bodyCore 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 · NativeThinkingView.applyAssignedLayout (cyclomatic 23) · ×1
  • NativeThinkingView.applyAssignedLayout (cyclomatic 23) Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift:396 — NativeThinkingView.applyAssignedLayout 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 · TerminalDisplayView.applyTheme (cyclomatic 23) · ×1
  • TerminalDisplayView.applyTheme (cyclomatic 23) Packages/OsaurusCore/Views/Chat/TerminalDisplayView.swift:378 — TerminalDisplayView.applyTheme 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 · SettingsFieldRow.body (cyclomatic 23) · ×1
  • SettingsFieldRow.body (cyclomatic 23) Packages/OsaurusCore/Views/DesignSystem/SettingsFields.swift:504 — SettingsFieldRow.body 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 · N8nSettingsView.body (cyclomatic 23) · ×1
  • N8nSettingsView.body (cyclomatic 23) Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:78 — N8nSettingsView.body 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 · ShellArgs.split (cyclomatic 23) · ×1
  • ShellArgs.split (cyclomatic 23) Packages/OsaurusCore/Services/MCP/Stdio/ShellArgs.swift:35 — ShellArgs.split 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 · WorkflowNodeEditor.fromFields (cyclomatic 23) · ×1
  • WorkflowNodeEditor.fromFields (cyclomatic 23) Packages/OsaurusCore/Views/Workflow/Architect/WorkflowNodeEditor.swift:396 — WorkflowNodeEditor.fromFields has cyclomatic complexity 23 (threshold 15). Of this number, 22 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 · RunCommand.execute (cyclomatic 22) · ×1
  • RunCommand.execute (cyclomatic 22) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Run.swift:13 — RunCommand.execute 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 · CentralRepositoryManager.mapFailure (cyclomatic 22) · ×1
  • CentralRepositoryManager.mapFailure (cyclomatic 22) Packages/OsaurusRepository/CentralRepositoryManager.swift:444 — CentralRepositoryManager.mapFailure has cyclomatic complexity 22 (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 · InspectorMessageExamples.make (cyclomatic 22) · ×1
  • InspectorMessageExamples.make (cyclomatic 22) Packages/OsaurusCore/DevelopmentDesign/InspectorMessageConfigurations.swift:79 — InspectorMessageExamples.make 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 · HTTPHandler.decodeOllamaChatRequest (cyclomatic 22) · ×1
  • HTTPHandler.decodeOllamaChatRequest (cyclomatic 22) Packages/OsaurusCore/Networking/HTTPHandler.swift:15815 — HTTPHandler.decodeOllamaChatRequest 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 · HTTPHandler.handleOllamaGenerate (cyclomatic 22) · ×1
  • HTTPHandler.handleOllamaGenerate (cyclomatic 22) Packages/OsaurusCore/Networking/HTTPHandler.swift:16160 — HTTPHandler.handleOllamaGenerate 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 · RequestValidator.rawResponseSchemaReason (cyclomatic 22) · ×1
  • RequestValidator.rawResponseSchemaReason (cyclomatic 22) Packages/OsaurusCore/Networking/RequestValidator.swift:47 — RequestValidator.rawResponseSchemaReason 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 · ModelRuntime.generateEventStream (cyclomatic 22) · ×1
  • ModelRuntime.generateEventStream (cyclomatic 22) Packages/OsaurusCore/Services/ModelRuntime.swift:6235 — ModelRuntime.generateEventStream 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 · ModelSSDResidency.fetch (cyclomatic 22) · ×1
  • ModelSSDResidency.fetch (cyclomatic 22) Packages/OsaurusCore/Services/ModelSSDResidency.swift:210 — ModelSSDResidency.fetch 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 · SpawnResultCompaction.modelVisible (cyclomatic 22) · ×1
  • SpawnResultCompaction.modelVisible (cyclomatic 22) Packages/OsaurusCore/Subagent/SpawnResultCompaction.swift:54 — SpawnResultCompaction.modelVisible 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 · SpawnAgentTool.execute (cyclomatic 22) · ×1
  • SpawnAgentTool.execute (cyclomatic 22) Packages/OsaurusCore/Tools/SpawnAgentTool.swift:123 — SpawnAgentTool.execute 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 · EventKitRemindersService.update (cyclomatic 22) · ×1
  • EventKitRemindersService.update (cyclomatic 22) Packages/OsaurusCore/AppleApps/Reminders/RemindersService.swift:219 — EventKitRemindersService.update has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BrowserSnapshotFormatter.line (cyclomatic 22) · ×1
  • BrowserSnapshotFormatter.line (cyclomatic 22) Packages/OsaurusCore/Browser/Runtime/BrowserSupport.swift:249 — BrowserSnapshotFormatter.line 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 · AgentAction.semanticProblem (cyclomatic 22) · ×1
  • AgentAction.semanticProblem (cyclomatic 22) Packages/OsaurusCore/ComputerUse/Model/AgentAction.swift:535 — AgentAction.semanticProblem 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 · ChatWindowState.loadSession (cyclomatic 22) · ×1
  • ChatWindowState.loadSession (cyclomatic 22) Packages/OsaurusCore/Managers/Chat/ChatWindowState.swift:1932 — ChatWindowState.loadSession 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 · AgentTargetResolver.resolve (cyclomatic 22) · ×1
  • AgentTargetResolver.resolve (cyclomatic 22) Packages/OsaurusCore/Models/Agent/AgentDispatchTarget.swift:205 — AgentTargetResolver.resolve 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 · RemoteProvider.resolvedHeaders (cyclomatic 22) · ×1
  • RemoteProvider.resolvedHeaders (cyclomatic 22) Packages/OsaurusCore/Models/Configuration/RemoteProviderConfiguration.swift:336 — RemoteProvider.resolvedHeaders 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 · Template.merge (cyclomatic 22) · ×1
  • Template.merge (cyclomatic 22) Packages/OsaurusCore/Models/Template/Template+Agent.swift:116 — Template.merge 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 · AssignedBaseToggleStyle.makeBody (cyclomatic 22) · ×1
  • AssignedBaseToggleStyle.makeBody (cyclomatic 22) Packages/OsaurusCore/Models/Theme/BaseComponentAssignments.swift:123 — AssignedBaseToggleStyle.makeBody 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 · BindingRenderer.parse (cyclomatic 22) · ×1
  • BindingRenderer.parse (cyclomatic 22) Packages/OsaurusCore/Models/Workflow/BindingRenderer.swift:112 — BindingRenderer.parse 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 · RegexEntityDetector.detect (cyclomatic 22) · ×1
  • RegexEntityDetector.detect (cyclomatic 22) Packages/OsaurusCore/PrivacyFilter/Core/RegexEntityDetector.swift:126 — RegexEntityDetector.detect 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 · ContextCompactionService.compactionCutIndex (cyclomatic 22) · ×1
  • ContextCompactionService.compactionCutIndex (cyclomatic 22) Packages/OsaurusCore/Services/Chat/ContextCompactionService.swift:241 — ContextCompactionService.compactionCutIndex 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 · ChannelDialogRelay.interpret (cyclomatic 22) · ×1
  • ChannelDialogRelay.interpret (cyclomatic 22) Packages/OsaurusCore/Services/Event/ChannelDialogRelay.swift:344 — ChannelDialogRelay.interpret 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 · PiRPCCodec.decode (cyclomatic 22) · ×1
  • PiRPCCodec.decode (cyclomatic 22) Packages/OsaurusCore/Services/Harness/PiRPCAdapter.swift:141 — PiRPCCodec.decode has cyclomatic complexity 22 (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 · StreamingStatsHint.decode (cyclomatic 22) · ×1
  • StreamingStatsHint.decode (cyclomatic 22) Packages/OsaurusCore/Services/Inference/ModelService.swift:667 — StreamingStatsHint.decode 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 · ResponsesGenerationStream.native (cyclomatic 22) · ×1
  • ResponsesGenerationStream.native (cyclomatic 22) Packages/OsaurusCore/Services/Inference/ResponsesGenerationEvent.swift:104 — ResponsesGenerationStream.native 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 · KnowledgeCurationService.approve (cyclomatic 22) · ×1
  • KnowledgeCurationService.approve (cyclomatic 22) Packages/OsaurusCore/Services/Knowledge/KnowledgeCurationService.swift:47 — KnowledgeCurationService.approve 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 · TokenizerBridge.applyDeepseekV4NativeTemplate (cyclomatic 22) · ×1
  • TokenizerBridge.applyDeepseekV4NativeTemplate (cyclomatic 22) Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.swift:904 — TokenizerBridge.applyDeepseekV4NativeTemplate 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 · SetupChecker.check (cyclomatic 22) · ×1
  • SetupChecker.check (cyclomatic 22) Packages/OsaurusCore/Services/Template/SetupChecker.swift:838 — SetupChecker.check 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 · MediaNodeExecutor.describe (cyclomatic 22) · ×1
  • MediaNodeExecutor.describe (cyclomatic 22) Packages/OsaurusCore/Services/Workflow/MediaNodeExecutor.swift:336 — MediaNodeExecutor.describe 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 · ReplyNodeExecutor.run (cyclomatic 22) · ×1
  • ReplyNodeExecutor.run (cyclomatic 22) Packages/OsaurusCore/Services/Workflow/ReplyNodeExecutor.swift:20 — ReplyNodeExecutor.run 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 · ToolNodeExecutor.run (cyclomatic 22) · ×1
  • ToolNodeExecutor.run (cyclomatic 22) Packages/OsaurusCore/Services/Workflow/ToolNodeExecutor.swift:88 — ToolNodeExecutor.run 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 · WorkflowEvalHarness.runArchitect (cyclomatic 22) · ×1
  • WorkflowEvalHarness.runArchitect (cyclomatic 22) Packages/OsaurusCore/Services/Workflow/WorkflowEvalHarness.swift:543 — WorkflowEvalHarness.runArchitect 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 · WorkflowEvalHarness.scoreArchitect (cyclomatic 22) · ×1
  • WorkflowEvalHarness.scoreArchitect (cyclomatic 22) Packages/OsaurusCore/Services/Workflow/WorkflowEvalHarness.swift:810 — WorkflowEvalHarness.scoreArchitect 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 · DatabaseImport.detectFormat (cyclomatic 22) · ×1
  • DatabaseImport.detectFormat (cyclomatic 22) Packages/OsaurusCore/Tools/Database/DatabaseImport.swift:88 — DatabaseImport.detectFormat 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 · WorkflowTestTool.summary (cyclomatic 22) · ×1
  • WorkflowTestTool.summary (cyclomatic 22) Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift:1021 — WorkflowTestTool.summary 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 · SessionRow.body (cyclomatic 22) · ×1
  • SessionRow.body (cyclomatic 22) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:2996 — SessionRow.body 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 · FloatingInputCard.startVoiceInput (cyclomatic 22) · ×1
  • FloatingInputCard.startVoiceInput (cyclomatic 22) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:1484 — FloatingInputCard.startVoiceInput 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 · SettingsTextField.body (cyclomatic 22) · ×1
  • SettingsTextField.body (cyclomatic 22) Packages/OsaurusCore/Views/DesignSystem/SettingsFields.swift:153 — SettingsTextField.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 · ChatPickerOptionsSnapshot.make (cyclomatic 22) · ×1
  • ChatPickerOptionsSnapshot.make (cyclomatic 22) Packages/OsaurusCore/Views/Model/ChatModelPickerCard.swift:74 — ChatPickerOptionsSnapshot.make 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 · WorkflowMediaGalleryModel.settingsLines (cyclomatic 22) · ×1
  • WorkflowMediaGalleryModel.settingsLines (cyclomatic 22) Packages/OsaurusCore/Views/Workflow/WorkflowMediaGallery.swift:41 — WorkflowMediaGalleryModel.settingsLines has cyclomatic complexity 22 (threshold 15). Of this number, 19 points are the body's own statements and 3 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 · XLSXEditor.setCells (cyclomatic 22) · ×1
  • XLSXEditor.setCells (cyclomatic 22) Packages/OsaurusCore/Services/Documents/OOXML/XLSXEditor.swift:175 — XLSXEditor.setCells has cyclomatic complexity 22 (threshold 15). Of this number, 14 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MCPOAuthURLPolicy.isLocalOrPrivateHost (cyclomatic 22) · ×1
  • MCPOAuthURLPolicy.isLocalOrPrivateHost (cyclomatic 22) Packages/OsaurusCore/Services/MCP/OAuth/MCPOAuthHTTPTransport.swift:122 — MCPOAuthURLPolicy.isLocalOrPrivateHost 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 · MCPOAuthError.errorDescription (cyclomatic 22) · ×1
  • MCPOAuthError.errorDescription (cyclomatic 22) Packages/OsaurusCore/Services/MCP/OAuth/MCPOAuthService.swift:55 — MCPOAuthError.errorDescription has cyclomatic complexity 22 (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 · bridge.handleLoginEvent (cyclomatic 22) · ×1
  • bridge.handleLoginEvent (cyclomatic 22) helpers/osaurus-wa/bridge.go:350 — bridge.handleLoginEvent has cyclomatic complexity 22 (threshold 15). Of this number, 20 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ManifestValidate.validate (cyclomatic 21) · ×1
  • ManifestValidate.validate (cyclomatic 21) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Manifest/ManifestValidate.swift:72 — ManifestValidate.validate 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 · ToolsInstall.installManual (cyclomatic 21) · ×1
  • ToolsInstall.installManual (cyclomatic 21) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsInstall.swift:72 — ToolsInstall.installManual 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 · OsaurusEvalsCLI.runDiff (cyclomatic 21) · ×1
  • OsaurusEvalsCLI.runDiff (cyclomatic 21) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalDiffMatrixCLI.swift:24 — OsaurusEvalsCLI.runDiff 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 · EvalRunner.runHTTPAPICase (cyclomatic 21) · ×1
  • EvalRunner.runHTTPAPICase (cyclomatic 21) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerHTTPAPI.swift:181 — EvalRunner.runHTTPAPICase 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, 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 · EvalRunner.runReasoningChannelCase (cyclomatic 21) · ×1
  • EvalRunner.runReasoningChannelCase (cyclomatic 21) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerReasoningChannel.swift:43 — EvalRunner.runReasoningChannelCase 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, 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 · EvalRunner.runSubagentCase (cyclomatic 21) · ×1
  • EvalRunner.runSubagentCase (cyclomatic 21) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:37 — EvalRunner.runSubagentCase 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 · AppDelegate.presentAnnouncementIfEligible (cyclomatic 21) · ×1
  • AppDelegate.presentAnnouncementIfEligible (cyclomatic 21) Packages/OsaurusCore/AppDelegate.swift:3048 — AppDelegate.presentAnnouncementIfEligible 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 · CatalogLibraryFixture.featureContent (cyclomatic 21) · ×1
  • CatalogLibraryFixture.featureContent (cyclomatic 21) Packages/OsaurusCore/DevelopmentDesign/CatalogComponents.swift:650 — CatalogLibraryFixture.featureContent 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 · MCPProviderManager.executeTool (cyclomatic 21) · ×1
  • MCPProviderManager.executeTool (cyclomatic 21) Packages/OsaurusCore/Managers/MCPProviderManager.swift:822 — MCPProviderManager.executeTool 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 · HTTPHandler.handleListSessionsEndpoint · ×1
  • HTTPHandler.handleListSessionsEndpoint::matches (cyclomatic 21) Packages/OsaurusCore/Networking/HTTPHandler.swift:8255 — HTTPHandler.handleListSessionsEndpoint::matches 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 · RelayTunnelManager.connect (cyclomatic 21) · ×1
  • RelayTunnelManager.connect (cyclomatic 21) Packages/OsaurusCore/Networking/RelayTunnelManager.swift:457 — RelayTunnelManager.connect 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 · NotificationService.userNotificationCenter (cyclomatic 21) · ×1
  • NotificationService.userNotificationCenter (cyclomatic 21) Packages/OsaurusCore/Services/NotificationService.swift:274 — NotificationService.userNotificationCenter 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 · SubagentSession.prepare (cyclomatic 21) · ×1
  • SubagentSession.prepare (cyclomatic 21) Packages/OsaurusCore/Subagent/SubagentSession.swift:348 — SubagentSession.prepare has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 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 · ToolRegistry.availability (cyclomatic 21) · ×1
  • ToolRegistry.availability (cyclomatic 21) Packages/OsaurusCore/Tools/ToolRegistry.swift:3235 — ToolRegistry.availability 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, 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 · InlineMathScanner.split (cyclomatic 21) · ×1
  • InlineMathScanner.split (cyclomatic 21) Packages/OsaurusCore/Utils/InlineMathScanner.swift:86 — InlineMathScanner.split has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 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 · AgentView.renderForModel (cyclomatic 21) · ×1
  • AgentView.renderForModel (cyclomatic 21) Packages/OsaurusCore/ComputerUse/Model/AgentView.swift:244 — AgentView.renderForModel 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 · EffectClassifier.classify (cyclomatic 21) · ×1
  • EffectClassifier.classify (cyclomatic 21) Packages/OsaurusCore/ComputerUse/Policy/EffectClassifier.swift:32 — EffectClassifier.classify 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 · ConfigApplier.patchCapabilities (cyclomatic 21) · ×1
  • ConfigApplier.patchCapabilities (cyclomatic 21) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:1149 — ConfigApplier.patchCapabilities 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 · ConfigDiff.editScript (cyclomatic 21) · ×1
  • ConfigDiff.editScript (cyclomatic 21) Packages/OsaurusCore/Configuration/Declarative/ConfigDiff.swift:231 — ConfigDiff.editScript 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 · ConfigYAML.checkMapping (cyclomatic 21) · ×1
  • ConfigYAML.checkMapping (cyclomatic 21) Packages/OsaurusCore/Configuration/Declarative/ConfigYAML.swift:230 — ConfigYAML.checkMapping 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 · OsaurusConfigDocument.filtered (cyclomatic 21) · ×1
  • OsaurusConfigDocument.filtered (cyclomatic 21) Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigDocument.swift:179 — OsaurusConfigDocument.filtered 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 · OsaurusConfigTool.loadDocument (cyclomatic 21) · ×1
  • OsaurusConfigTool.loadDocument (cyclomatic 21) Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool.swift:1091 — OsaurusConfigTool.loadDocument 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 · ChatSessionExporter.timingSuffix (cyclomatic 21) · ×1
  • ChatSessionExporter.timingSuffix (cyclomatic 21) Packages/OsaurusCore/Managers/Chat/ChatSessionExporter.swift:238 — ChatSessionExporter.timingSuffix 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 · ModelManager.fetchRemoteMLXModels (cyclomatic 21) · ×1
  • ModelManager.fetchRemoteMLXModels (cyclomatic 21) Packages/OsaurusCore/Managers/Model/ModelManager.swift:366 — ModelManager.fetchRemoteMLXModels 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 · TemplateRequirements.items (cyclomatic 21) · ×1
  • TemplateRequirements.items (cyclomatic 21) Packages/OsaurusCore/Models/Template/TemplateRequirements.swift:424 — TemplateRequirements.items has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · AgentChannelPublishService.classifyProviderFailure (cyclomatic 21) · ×1
  • AgentChannelPublishService.classifyProviderFailure (cyclomatic 21) Packages/OsaurusCore/Services/AgentChannel/AgentChannelPublishService.swift:1131 — AgentChannelPublishService.classifyProviderFailure 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 · ChatImportReportTool.parse (cyclomatic 21) · ×1
  • ChatImportReportTool.parse (cyclomatic 21) Packages/OsaurusCore/Services/ChatImport/ChatImportReader.swift:231 — ChatImportReportTool.parse has cyclomatic complexity 21 (threshold 15). Of this number, 14 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 · DocumentEditService.structure (cyclomatic 21) · ×1
  • DocumentEditService.structure (cyclomatic 21) Packages/OsaurusCore/Services/Documents/DocumentEditService.swift:237 — DocumentEditService.structure 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 · MarkdownRichTextRenderer.blockDescriptor (cyclomatic 21) · ×1
  • MarkdownRichTextRenderer.blockDescriptor (cyclomatic 21) Packages/OsaurusCore/Services/Documents/MarkdownRichTextRenderer.swift:228 — MarkdownRichTextRenderer.blockDescriptor 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 · PDFAdapter.selectionRange (cyclomatic 21) · ×1
  • PDFAdapter.selectionRange (cyclomatic 21) Packages/OsaurusCore/Services/Documents/PDFAdapter.swift:231 — PDFAdapter.selectionRange 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 · WebhookVerification.verify (cyclomatic 21) · ×1
  • WebhookVerification.verify (cyclomatic 21) Packages/OsaurusCore/Services/Event/WebhookProviderProfile.swift:372 — WebhookVerification.verify 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 · FileDiffEngine.collapse (cyclomatic 21) · ×1
  • FileDiffEngine.collapse (cyclomatic 21) Packages/OsaurusCore/Services/FileHistory/FileDiffEngine.swift:312 — FileDiffEngine.collapse has cyclomatic complexity 21 (threshold 15). Of this number, 14 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · IMessageConnectionService.diagnostics (cyclomatic 21) · ×1
  • IMessageConnectionService.diagnostics (cyclomatic 21) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:310 — IMessageConnectionService.diagnostics 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 · PendingImportProcessor.removeItem (cyclomatic 21) · ×1
  • PendingImportProcessor.removeItem (cyclomatic 21) Packages/OsaurusCore/Services/Import/PendingImportProcessor.swift:875 — PendingImportProcessor.removeItem 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 · KnowledgeIndexService.scanIndexableFiles (cyclomatic 21) · ×1
  • KnowledgeIndexService.scanIndexableFiles (cyclomatic 21) Packages/OsaurusCore/Services/Knowledge/KnowledgeIndexService.swift:347 — KnowledgeIndexService.scanIndexableFiles 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 · KnowledgeSearchService.search (cyclomatic 21) · ×1
  • KnowledgeSearchService.search (cyclomatic 21) Packages/OsaurusCore/Services/Knowledge/KnowledgeSearchService.swift:214 — KnowledgeSearchService.search 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 · MediaGenerationCoordinator.validateImageRequest (cyclomatic 21) · ×1
  • MediaGenerationCoordinator.validateImageRequest (cyclomatic 21) Packages/OsaurusCore/Services/MediaGeneration/MediaGenerationCoordinator.swift:579 — MediaGenerationCoordinator.validateImageRequest 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 · MediaGenerationCoordinator.validateVideoRequest (cyclomatic 21) · ×1
  • MediaGenerationCoordinator.validateVideoRequest (cyclomatic 21) Packages/OsaurusCore/Services/MediaGeneration/MediaGenerationCoordinator.swift:630 — MediaGenerationCoordinator.validateVideoRequest 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 · RemoteProviderService.handleGeminiEvent (cyclomatic 21) · ×1
  • RemoteProviderService.handleGeminiEvent (cyclomatic 21) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:2178 — RemoteProviderService.handleGeminiEvent 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 · InboundSharedRunBridge.mergeCompletedTurn (cyclomatic 21) · ×1
  • InboundSharedRunBridge.mergeCompletedTurn (cyclomatic 21) Packages/OsaurusCore/Services/Router/InboundSharedRunBridge.swift:520 — InboundSharedRunBridge.mergeCompletedTurn 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 · SlackConnectionService.classifyInboundEvent (cyclomatic 21) · ×1
  • SlackConnectionService.classifyInboundEvent (cyclomatic 21) Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:1437 — SlackConnectionService.classifyInboundEvent 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 · SyncLegacyImporter.importAll (cyclomatic 21) · ×1
  • SyncLegacyImporter.importAll (cyclomatic 21) Packages/OsaurusCore/Services/Sync/SyncLegacyImporter.swift:96 — SyncLegacyImporter.importAll 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 · ToolIndexService.exposureDiagnostic (cyclomatic 21) · ×1
  • ToolIndexService.exposureDiagnostic (cyclomatic 21) Packages/OsaurusCore/Services/Tool/ToolIndexService.swift:176 — ToolIndexService.exposureDiagnostic 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, 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 · HTTPNodeExecutor.run (cyclomatic 21) · ×1
  • HTTPNodeExecutor.run (cyclomatic 21) Packages/OsaurusCore/Services/Workflow/HTTPNodeExecutor.swift:118 — HTTPNodeExecutor.run has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 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 · HiddenAgentHandoffKind.run (cyclomatic 21) · ×1
  • HiddenAgentHandoffKind.run (cyclomatic 21) Packages/OsaurusCore/Tools/Handoff/HiddenAgentHandoffRunner.swift:268 — HiddenAgentHandoffKind.run 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 · ChatHistoryList.filteredSessions (cyclomatic 21) · ×1
  • ChatHistoryList.filteredSessions (cyclomatic 21) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:4242 — ChatHistoryList.filteredSessions 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 · ChatSession.maybeGenerateFollowUps (cyclomatic 21) · ×1
  • ChatSession.maybeGenerateFollowUps (cyclomatic 21) Packages/OsaurusCore/Views/Chat/ChatView.swift:5541 — ChatSession.maybeGenerateFollowUps 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 · FloatingInputCard.modelPickerOptionsControl (cyclomatic 21) · ×1
  • FloatingInputCard.modelPickerOptionsControl (cyclomatic 21) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:3482 — FloatingInputCard.modelPickerOptionsControl 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 · NativeActivityGroupView.applyAssignedLayout (cyclomatic 21) · ×1
  • NativeActivityGroupView.applyAssignedLayout (cyclomatic 21) Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:257 — NativeActivityGroupView.applyAssignedLayout 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 · NativeChartView.applyInspectionStyle (cyclomatic 21) · ×1
  • NativeChartView.applyInspectionStyle (cyclomatic 21) Packages/OsaurusCore/Views/Chat/NativeChartView.swift:265 — NativeChartView.applyInspectionStyle 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 · XLSXEditor.deleteSheet (cyclomatic 21) · ×1
  • XLSXEditor.deleteSheet (cyclomatic 21) Packages/OsaurusCore/Services/Documents/OOXML/XLSXEditor.swift:776 — XLSXEditor.deleteSheet 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 · WorkflowSetupWizardView.steps (cyclomatic 21) · ×1
  • WorkflowSetupWizardView.steps (cyclomatic 21) Packages/OsaurusCore/Views/Workflow/Library/WorkflowSetupWizardView.swift:368 — WorkflowSetupWizardView.steps has cyclomatic complexity 21 (threshold 15). Of this number, 18 points are the body's own statements and 3 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 · WorkflowSecretsStep.oauthControls (cyclomatic 21) · ×1
  • WorkflowSecretsStep.oauthControls (cyclomatic 21) Packages/OsaurusCore/Views/Workflow/Library/WorkflowSetupWizardView.swift:829 — WorkflowSecretsStep.oauthControls 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 · main.swift.top-level code (cyclomatic 21) · ×1
  • main.swift.top-level code (cyclomatic 21) Packages/OsaurusCore/JSHost/main.swift:30 — main.swift.top-level code 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 · Accessibility.swift.computeFocusedContent (cyclomatic 21) · ×1
  • Accessibility.swift.computeFocusedContent (cyclomatic 21) Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:1123 — Accessibility.swift.computeFocusedContent has cyclomatic complexity 21 (threshold 15). Of this number, 18 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · bridge.handleSendAttachment (cyclomatic 21) · ×1
  • bridge.handleSendAttachment (cyclomatic 21) helpers/osaurus-wa/bridge.go:707 — bridge.handleSendAttachment 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 · bridge.emitMessage (cyclomatic 21) · ×1
  • bridge.emitMessage (cyclomatic 21) helpers/osaurus-wa/bridge.go:1134 — bridge.emitMessage 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 · BenchCommand.measureOnce (cyclomatic 20) · ×1
  • BenchCommand.measureOnce (cyclomatic 20) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Bench.swift:378 — BenchCommand.measureOnce 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 · ImportCommand.loadAndCheck (cyclomatic 20) · ×1
  • ImportCommand.loadAndCheck (cyclomatic 20) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Import/ImportCommand.swift:333 — ImportCommand.loadAndCheck 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 · OsaurusEvalsCLI.runOptimizeContext (cyclomatic 20) · ×1
  • OsaurusEvalsCLI.runOptimizeContext (cyclomatic 20) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/ContextOptimizeCLI.swift:37 — OsaurusEvalsCLI.runOptimizeContext 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 · BoundedArchiveExtractor.validateLocalHeader (cyclomatic 20) · ×1
  • BoundedArchiveExtractor.validateLocalHeader (cyclomatic 20) Packages/OsaurusRepository/BoundedArchiveExtractor.swift:486 — BoundedArchiveExtractor.validateLocalHeader 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 · DesignWorkingStore.init (cyclomatic 20) · ×1
  • DesignWorkingStore.init (cyclomatic 20) Packages/OsaurusCore/DevelopmentDesign/DesignWorkingStore.swift:48 — DesignWorkingStore.init 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 · FileReadTool.spawnedOperationCancellationSupport (cyclomatic 20) · ×1
  • FileReadTool.spawnedOperationCancellationSupport (cyclomatic 20) Packages/OsaurusCore/Folder/FolderTools.swift:1165 — FileReadTool.spawnedOperationCancellationSupport has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · HTTPHandler.handleDispatchEndpoint (cyclomatic 20) · ×1
  • HTTPHandler.handleDispatchEndpoint (cyclomatic 20) Packages/OsaurusCore/Networking/HTTPHandler.swift:12520 — HTTPHandler.handleDispatchEndpoint 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 · HTTPHandler.handleMCPCallTool (cyclomatic 20) · ×1
  • HTTPHandler.handleMCPCallTool (cyclomatic 20) Packages/OsaurusCore/Networking/HTTPHandler.swift:17425 — HTTPHandler.handleMCPCallTool 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 · DeclaredReasoningEffort.nativeThinkingModes (cyclomatic 20) · ×1
  • DeclaredReasoningEffort.nativeThinkingModes (cyclomatic 20) Packages/OsaurusCore/Services/DeclaredReasoningEffort.swift:300 — DeclaredReasoningEffort.nativeThinkingModes has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ModelDownloadService.makeAlert (cyclomatic 20) · ×1
  • ModelDownloadService.makeAlert (cyclomatic 20) Packages/OsaurusCore/Services/ModelDownloadService.swift:106 — ModelDownloadService.makeAlert has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ActivityLogStore.whereClause (cyclomatic 20) · ×1
  • ActivityLogStore.whereClause (cyclomatic 20) Packages/OsaurusCore/Storage/ActivityLogStore.swift:1007 — ActivityLogStore.whereClause 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 · MemoryDatabase.searchPinnedFactsText (cyclomatic 20) · ×1
  • MemoryDatabase.searchPinnedFactsText (cyclomatic 20) Packages/OsaurusCore/Storage/MemoryDatabase.swift:1486 — MemoryDatabase.searchPinnedFactsText 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. This shape REPEATS in the file: one other method here (MemoryDatabase.searchEpisodesText) 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 · MemoryDatabase.searchEpisodesText (cyclomatic 20) · ×1
  • MemoryDatabase.searchEpisodesText (cyclomatic 20) Packages/OsaurusCore/Storage/MemoryDatabase.swift:1907 — MemoryDatabase.searchEpisodesText 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. This shape REPEATS in the file: one other method here (MemoryDatabase.searchPinnedFactsText) 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 · RetainedToolResultStore.makeRoom (cyclomatic 20) · ×1
  • RetainedToolResultStore.makeRoom (cyclomatic 20) Packages/OsaurusCore/Storage/RetainedToolResultStore.swift:312 — RetainedToolResultStore.makeRoom 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 · SandboxWriteFileTool.execute (cyclomatic 20) · ×1
  • SandboxWriteFileTool.execute (cyclomatic 20) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2158 — SandboxWriteFileTool.execute 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 · SandboxInstallTool.execute (cyclomatic 20) · ×1
  • SandboxInstallTool.execute (cyclomatic 20) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3588 — SandboxInstallTool.execute 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 · ConfigApplier.applyDefaultAgent (cyclomatic 20) · ×1
  • ConfigApplier.applyDefaultAgent (cyclomatic 20) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:340 — ConfigApplier.applyDefaultAgent 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 · ConfigApplier.patchToolSelection (cyclomatic 20) · ×1
  • ConfigApplier.patchToolSelection (cyclomatic 20) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:969 — ConfigApplier.patchToolSelection 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 · ConfigApplier.addProvider (cyclomatic 20) · ×1
  • ConfigApplier.addProvider (cyclomatic 20) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:2315 — ConfigApplier.addProvider has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ChatWindowState.setupNotificationObservers (cyclomatic 20) · ×1
  • ChatWindowState.setupNotificationObservers (cyclomatic 20) Packages/OsaurusCore/Managers/Chat/ChatWindowState.swift:3154 — ChatWindowState.setupNotificationObservers 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 · FileDiff.partialPythonStringValue (cyclomatic 20) · ×1
  • FileDiff.partialPythonStringValue (cyclomatic 20) Packages/OsaurusCore/Models/Chat/FileDiff.swift:404 — FileDiff.partialPythonStringValue 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 · FileDiff.stringValue (cyclomatic 20) · ×1
  • FileDiff.stringValue (cyclomatic 20) Packages/OsaurusCore/Models/Chat/FileDiff.swift:468 — FileDiff.stringValue 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 · OpenResponsesSSEWriter.writeProviderEvent (cyclomatic 20) · ×1
  • OpenResponsesSSEWriter.writeProviderEvent (cyclomatic 20) Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1725 — OpenResponsesSSEWriter.writeProviderEvent has cyclomatic complexity 20 (threshold 15). Of this number, 15 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModelPickerItem.generateMockModels (cyclomatic 20) · ×1
  • ModelPickerItem.generateMockModels (cyclomatic 20) Packages/OsaurusCore/Models/Configuration/ModelPickerItem.swift:1043 — ModelPickerItem.generateMockModels 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 · Template.document (cyclomatic 20) · ×1
  • Template.document (cyclomatic 20) Packages/OsaurusCore/Models/Template/Template+Agent.swift:88 — Template.document 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 · BindingTypeResolver.type (cyclomatic 20) · ×1
  • BindingTypeResolver.type (cyclomatic 20) Packages/OsaurusCore/Models/Workflow/BindingTypeResolver.swift:81 — BindingTypeResolver.type has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · WorkflowDiff.plainLines (cyclomatic 20) · ×1
  • WorkflowDiff.plainLines (cyclomatic 20) Packages/OsaurusCore/Models/Workflow/WorkflowDraft.swift:721 — WorkflowDiff.plainLines has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: WorkflowDiff.plainLines::fieldName (cyclomatic 42) 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 · CodeBlockMasker.mask (cyclomatic 20) · ×1
  • CodeBlockMasker.mask (cyclomatic 20) Packages/OsaurusCore/PrivacyFilter/Core/CodeBlockMasker.swift:42 — CodeBlockMasker.mask 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 · AgentChannelWebhookIngress.handleTaskPoll (cyclomatic 20) · ×1
  • AgentChannelWebhookIngress.handleTaskPoll (cyclomatic 20) Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:497 — AgentChannelWebhookIngress.handleTaskPoll 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 · PairedDeviceChannel.wire (cyclomatic 20) · ×1
  • PairedDeviceChannel.wire (cyclomatic 20) Packages/OsaurusCore/Services/Attention/NotificationChannels.swift:116 — PairedDeviceChannel.wire 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 · ChatImportApplier.rollBack (cyclomatic 20) · ×1
  • ChatImportApplier.rollBack (cyclomatic 20) Packages/OsaurusCore/Services/ChatImport/ChatImportApplier.swift:393 — ChatImportApplier.rollBack 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 · MicroPerfEvaluator.runCancellation (cyclomatic 20) · ×1
  • MicroPerfEvaluator.runCancellation (cyclomatic 20) Packages/OsaurusCore/Services/Context/MicroPerfEvaluator.swift:316 — MicroPerfEvaluator.runCancellation 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 · XLSXPackageArchive.readCentralDirectory (cyclomatic 20) · ×1
  • XLSXPackageArchive.readCentralDirectory (cyclomatic 20) Packages/OsaurusCore/Services/Documents/XLSXAdapter.swift:1012 — XLSXPackageArchive.readCentralDirectory 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 · EventManager.replyWithWorkflowOutputIfNeeded (cyclomatic 20) · ×1
  • EventManager.replyWithWorkflowOutputIfNeeded (cyclomatic 20) Packages/OsaurusCore/Services/Event/EventManager.swift:897 — EventManager.replyWithWorkflowOutputIfNeeded 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 · EventManager.syncTask (cyclomatic 20) · ×1
  • EventManager.syncTask (cyclomatic 20) Packages/OsaurusCore/Services/Event/EventManager.swift:969 — EventManager.syncTask 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 · EventManager.ingestChannelMessage (cyclomatic 20) · ×1
  • EventManager.ingestChannelMessage (cyclomatic 20) Packages/OsaurusCore/Services/Event/ChannelMessageEventSource.swift:91 — EventManager.ingestChannelMessage 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 · EventMatcher.rankChannelEvents (cyclomatic 20) · ×1
  • EventMatcher.rankChannelEvents (cyclomatic 20) Packages/OsaurusCore/Services/Event/EventMatcher.swift:39 — EventMatcher.rankChannelEvents 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 · WebhookEventSource.receive (cyclomatic 20) · ×1
  • WebhookEventSource.receive (cyclomatic 20) Packages/OsaurusCore/Services/Event/WebhookEventSource.swift:135 — WebhookEventSource.receive 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 · PhoneAgentEditing.apply (cyclomatic 20) · ×1
  • PhoneAgentEditing.apply (cyclomatic 20) Packages/OsaurusCore/Services/MobileConnect/PhoneAgentEditing.swift:175 — PhoneAgentEditing.apply 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 · TokenizerBridge.compactCompletedDSV4ToolHistory (cyclomatic 20) · ×1
  • TokenizerBridge.compactCompletedDSV4ToolHistory (cyclomatic 20) Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.swift:1029 — TokenizerBridge.compactCompletedDSV4ToolHistory 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 · InboundSharedRunBridge.resolveHostedSession (cyclomatic 20) · ×1
  • InboundSharedRunBridge.resolveHostedSession (cyclomatic 20) Packages/OsaurusCore/Services/Router/InboundSharedRunBridge.swift:239 — InboundSharedRunBridge.resolveHostedSession has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · SearchReadability.fetchAndExtract (cyclomatic 20) · ×1
  • SearchReadability.fetchAndExtract (cyclomatic 20) Packages/OsaurusCore/Services/Search/SearchReadability.swift:95 — SearchReadability.fetchAndExtract 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 · ClaudePluginInstaller.fetchArtifacts (cyclomatic 20) · ×1
  • ClaudePluginInstaller.fetchArtifacts (cyclomatic 20) Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:868 — ClaudePluginInstaller.fetchArtifacts 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 · ClaudePluginInstaller.rewriteSkillBody (cyclomatic 20) · ×1
  • ClaudePluginInstaller.rewriteSkillBody (cyclomatic 20) Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:1197 — ClaudePluginInstaller.rewriteSkillBody 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 · WhatsAppConnectionService.startPairing (cyclomatic 20) · ×1
  • WhatsAppConnectionService.startPairing (cyclomatic 20) Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:310 — WhatsAppConnectionService.startPairing 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 · ArchitectInlineEvaluator.runScoped (cyclomatic 20) · ×1
  • ArchitectInlineEvaluator.runScoped (cyclomatic 20) Packages/OsaurusCore/Services/Workflow/ArchitectInlineEvaluator.swift:100 — ArchitectInlineEvaluator.runScoped 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 · BrowserUseKind.run (cyclomatic 20) · ×1
  • BrowserUseKind.run (cyclomatic 20) Packages/OsaurusCore/Subagent/Kinds/BrowserUseKind.swift:163 — BrowserUseKind.run has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ImageSubagentKind.run (cyclomatic 20) · ×1
  • ImageSubagentKind.run (cyclomatic 20) Packages/OsaurusCore/Subagent/Kinds/ImageSubagentKind.swift:366 — ImageSubagentKind.run 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 · FloatingInputCard.handleFileDrop (cyclomatic 20) · ×1
  • FloatingInputCard.handleFileDrop (cyclomatic 20) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5342 — FloatingInputCard.handleFileDrop 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 · NativeMarkdownTableView.updateCells (cyclomatic 20) · ×1
  • NativeMarkdownTableView.updateCells (cyclomatic 20) Packages/OsaurusCore/Views/Chat/NativeBlockViews.swift:1264 — NativeMarkdownTableView.updateCells 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 · AnchoredCardCoordinator.handle (cyclomatic 20) · ×1
  • AnchoredCardCoordinator.handle (cyclomatic 20) Packages/OsaurusCore/Views/Common/AnchoredCardPresenter.swift:564 — AnchoredCardCoordinator.handle 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 · ModelDetailView.detailsCard (cyclomatic 20) · ×1
  • ModelDetailView.detailsCard (cyclomatic 20) Packages/OsaurusCore/Views/Model/ModelDetailView.swift:551 — ModelDetailView.detailsCard 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 · PluginConfigView.validateField (cyclomatic 20) · ×1
  • PluginConfigView.validateField (cyclomatic 20) Packages/OsaurusCore/Views/Plugin/PluginConfigView.swift:528 — PluginConfigView.validateField 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 · XLSXEditor.dropCachedFormulaResults (cyclomatic 20) · ×1
  • XLSXEditor.dropCachedFormulaResults (cyclomatic 20) Packages/OsaurusCore/Services/Documents/OOXML/XLSXEditor.swift:88 — XLSXEditor.dropCachedFormulaResults has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EmailMIME.addresses (cyclomatic 20) · ×1
  • EmailMIME.addresses (cyclomatic 20) Packages/OsaurusCore/Services/Event/Email/EmailMIME.swift:194 — EmailMIME.addresses 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 · EmailMIME.split (cyclomatic 20) · ×1
  • EmailMIME.split (cyclomatic 20) Packages/OsaurusCore/Services/Event/Email/EmailMIME.swift:299 — EmailMIME.split 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 · MCPWWWAuthenticate.parseParams (cyclomatic 20) · ×1
  • MCPWWWAuthenticate.parseParams (cyclomatic 20) Packages/OsaurusCore/Services/MCP/OAuth/MCPWWWAuthenticate.swift:80 — MCPWWWAuthenticate.parseParams 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 · ImportCommand.runRemove (cyclomatic 19) · ×1
  • ImportCommand.runRemove (cyclomatic 19) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Import/ImportCommand.swift:513 — ImportCommand.runRemove 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 · OsaurusEvalsCLI.runMatrix (cyclomatic 19) · ×1
  • OsaurusEvalsCLI.runMatrix (cyclomatic 19) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalDiffMatrixCLI.swift:132 — OsaurusEvalsCLI.runMatrix 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 · EvalReport.formatAggregatedTelemetry (cyclomatic 19) · ×1
  • EvalReport.formatAggregatedTelemetry (cyclomatic 19) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReport.swift:970 — EvalReport.formatAggregatedTelemetry 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 · EvalRunner.scoreTranscriptAssertions (cyclomatic 19) · ×1
  • EvalRunner.scoreTranscriptAssertions (cyclomatic 19) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerAgentLoop.swift:1342 — EvalRunner.scoreTranscriptAssertions 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 · OsaurusBundle.contentHash (cyclomatic 19) · ×1
  • OsaurusBundle.contentHash (cyclomatic 19) Packages/OsaurusRepository/ImportQueue.swift:394 — OsaurusBundle.contentHash 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 · HTTPHandler.decryptSecureCall (cyclomatic 19) · ×1
  • HTTPHandler.decryptSecureCall (cyclomatic 19) Packages/OsaurusCore/Networking/HTTPHandler.swift:9162 — HTTPHandler.decryptSecureCall 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 · SecureChannelResponseEncryptor.write (cyclomatic 19) · ×1
  • SecureChannelResponseEncryptor.write (cyclomatic 19) Packages/OsaurusCore/Networking/SecureChannelResponseEncryptor.swift:65 — SecureChannelResponseEncryptor.write 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 · DeclaredReasoningEffort.parseReasoningModes (cyclomatic 19) · ×1
  • DeclaredReasoningEffort.parseReasoningModes (cyclomatic 19) Packages/OsaurusCore/Services/DeclaredReasoningEffort.swift:366 — DeclaredReasoningEffort.parseReasoningModes 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 · GitHubSkillService.buildManifest (cyclomatic 19) · ×1
  • GitHubSkillService.buildManifest (cyclomatic 19) Packages/OsaurusCore/Services/GitHubSkillService.swift:1581 — GitHubSkillService.buildManifest 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 · LocalGenerationDefaults.repairOrnith15A3BManualMTPBlockIfNeeded (cyclomatic 19) · ×1
  • LocalGenerationDefaults.repairOrnith15A3BManualMTPBlockIfNeeded (cyclomatic 19) Packages/OsaurusCore/Services/LocalGenerationDefaults.swift:333 — LocalGenerationDefaults.repairOrnith15A3BManualMTPBlockIfNeeded 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 · RetainedToolResultStore.compactionContext (cyclomatic 19) · ×1
  • RetainedToolResultStore.compactionContext (cyclomatic 19) Packages/OsaurusCore/Storage/RetainedToolResultStore.swift:65 — RetainedToolResultStore.compactionContext 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 · TaskQuery.matches (cyclomatic 19) · ×1
  • TaskQuery.matches (cyclomatic 19) Packages/OsaurusCore/Storage/TaskDatabase.swift:70 — TaskQuery.matches 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 · SubagentAdmissionLease.suspending (cyclomatic 19) · ×1
  • SubagentAdmissionLease.suspending (cyclomatic 19) Packages/OsaurusCore/Subagent/SubagentAdmissionLease.swift:32 — SubagentAdmissionLease.suspending 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 · SubagentSession.localInPlaceCapacityDecision (cyclomatic 19) · ×1
  • SubagentSession.localInPlaceCapacityDecision (cyclomatic 19) Packages/OsaurusCore/Subagent/SubagentSession.swift:1424 — SubagentSession.localInPlaceCapacityDecision 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 · UpdateKnowledgeTicketTool.execute (cyclomatic 19) · ×1
  • UpdateKnowledgeTicketTool.execute (cyclomatic 19) Packages/OsaurusCore/Tools/KnowledgeCurationTools.swift:331 — UpdateKnowledgeTicketTool.execute 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 · SandboxSecretSetTool.execute (cyclomatic 19) · ×1
  • SandboxSecretSetTool.execute (cyclomatic 19) Packages/OsaurusCore/Tools/SandboxSecretTools.swift:149 — SandboxSecretSetTool.execute 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 · CronParser.nextDate (cyclomatic 19) · ×1
  • CronParser.nextDate (cyclomatic 19) Packages/OsaurusCore/Utils/CronParser.swift:48 — CronParser.nextDate 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 · MockAppleScriptWorld.handle (cyclomatic 19) · ×1
  • MockAppleScriptWorld.handle (cyclomatic 19) Packages/OsaurusCore/AppleScript/Exec/MockAppleScriptWorld.swift:81 — MockAppleScriptWorld.handle 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 · AppleScriptToolDispatch.literalContractViolation (cyclomatic 19) · ×1
  • AppleScriptToolDispatch.literalContractViolation (cyclomatic 19) Packages/OsaurusCore/AppleScript/Tool/AppleScriptToolDispatch.swift:659 — AppleScriptToolDispatch.literalContractViolation 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 · ScreenContextDistiller.focusedElement (cyclomatic 19) · ×1
  • ScreenContextDistiller.focusedElement (cyclomatic 19) Packages/OsaurusCore/ComputerUse/Perception/ScreenContextDistiller.swift:302 — ScreenContextDistiller.focusedElement 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 · ConfigApplier.applyAgents (cyclomatic 19) · ×1
  • ConfigApplier.applyAgents (cyclomatic 19) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:581 — ConfigApplier.applyAgents 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 · ConfigApplier.applyChannels (cyclomatic 19) · ×1
  • ConfigApplier.applyChannels (cyclomatic 19) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:1482 — ConfigApplier.applyChannels 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 · ModelManager.mergeAvailable (cyclomatic 19) · ×1
  • ModelManager.mergeAvailable (cyclomatic 19) Packages/OsaurusCore/Managers/Model/ModelManager.swift:1725 — ModelManager.mergeAvailable 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 · ModelManager.refreshAutomaticModelUpdates (cyclomatic 19) · ×1
  • ModelManager.refreshAutomaticModelUpdates (cyclomatic 19) Packages/OsaurusCore/Managers/Model/ModelUpdatePolling.swift:143 — ModelManager.refreshAutomaticModelUpdates 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 · AgentCapabilityReadiness.subagent (cyclomatic 19) · ×1
  • AgentCapabilityReadiness.subagent (cyclomatic 19) Packages/OsaurusCore/Models/Agent/AgentCapabilityReadiness.swift:133 — AgentCapabilityReadiness.subagent 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 · AgentChannelCustomHTTPResponseMapping.validatePath (cyclomatic 19) · ×1
  • AgentChannelCustomHTTPResponseMapping.validatePath (cyclomatic 19) Packages/OsaurusCore/Models/AgentChannel/AgentChannelCustomJSONModels.swift:86 — AgentChannelCustomHTTPResponseMapping.validatePath 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 · MLXModel.localBundleWeightSizeBytes (cyclomatic 19) · ×1
  • MLXModel.localBundleWeightSizeBytes (cyclomatic 19) Packages/OsaurusCore/Models/Configuration/MLXModel.swift:191 — MLXModel.localBundleWeightSizeBytes 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 · AgentChannelCustomJSONRunner.prepareRequest (cyclomatic 19) · ×1
  • AgentChannelCustomJSONRunner.prepareRequest (cyclomatic 19) Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:864 — AgentChannelCustomJSONRunner.prepareRequest has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: AgentChannelCustomJSONRunnerError.errorDescription (cyclomatic 20) 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 · AgentChannelCustomJSONRunner.renderedURL (cyclomatic 19) · ×1
  • AgentChannelCustomJSONRunner.renderedURL (cyclomatic 19) Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:1723 — AgentChannelCustomJSONRunner.renderedURL 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. This is NOT this file's highest cyclomatic complexity: AgentChannelCustomJSONRunnerError.errorDescription (cyclomatic 20) 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 · AgentChannelCustomJSONRunner.blockedHostReason (cyclomatic 19) · ×1
  • AgentChannelCustomJSONRunner.blockedHostReason (cyclomatic 19) Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:1848 — AgentChannelCustomJSONRunner.blockedHostReason has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: AgentChannelCustomJSONRunnerError.errorDescription (cyclomatic 20) 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 · AgentChannelWebhookIngress.handleInbound (cyclomatic 19) · ×1
  • AgentChannelWebhookIngress.handleInbound (cyclomatic 19) Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:216 — AgentChannelWebhookIngress.handleInbound has cyclomatic complexity 19 (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 · OwnerDeviceAccessHost.redeem (cyclomatic 19) · ×1
  • OwnerDeviceAccessHost.redeem (cyclomatic 19) Packages/OsaurusCore/Services/Auth/OwnerDeviceAccessHost.swift:380 — OwnerDeviceAccessHost.redeem 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 · AgentTaskState.classify (cyclomatic 19) · ×1
  • AgentTaskState.classify (cyclomatic 19) Packages/OsaurusCore/Services/Chat/AgentTaskState.swift:1196 — AgentTaskState.classify 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 · SystemPromptComposer.appendProjectMemory (cyclomatic 19) · ×1
  • SystemPromptComposer.appendProjectMemory (cyclomatic 19) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:397 — SystemPromptComposer.appendProjectMemory 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 · ToolResultMediaBridge.mime (cyclomatic 19) · ×1
  • ToolResultMediaBridge.mime (cyclomatic 19) Packages/OsaurusCore/Services/Chat/ToolResultMediaBridge.swift:211 — ToolResultMediaBridge.mime 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 · CredentialStore.save (cyclomatic 19) · ×1
  • CredentialStore.save (cyclomatic 19) Packages/OsaurusCore/Services/Credentials/CredentialStore.swift:380 — CredentialStore.save 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 · CSVRowParser.parseRows (cyclomatic 19) · ×1
  • CSVRowParser.parseRows (cyclomatic 19) Packages/OsaurusCore/Services/Documents/CSVRowParser.swift:22 — CSVRowParser.parseRows 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 · FolderEventSource.processCurrentState (cyclomatic 19) · ×1
  • FolderEventSource.processCurrentState (cyclomatic 19) Packages/OsaurusCore/Services/Event/FolderEventSource.swift:235 — FolderEventSource.processCurrentState 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 · JSONMemberScanner.valueEnd (cyclomatic 19) · ×1
  • JSONMemberScanner.valueEnd (cyclomatic 19) Packages/OsaurusCore/Services/Inference/LocalGrammarTokenizerProbe.swift:275 — JSONMemberScanner.valueEnd 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 · ResponsesToolChoiceContract.validate (cyclomatic 19) · ×1
  • ResponsesToolChoiceContract.validate (cyclomatic 19) Packages/OsaurusCore/Services/Inference/ResponsesToolChoiceContract.swift:93 — ResponsesToolChoiceContract.validate 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 · ResponsesToolChoiceContract.enforce (cyclomatic 19) · ×1
  • ResponsesToolChoiceContract.enforce (cyclomatic 19) Packages/OsaurusCore/Services/Inference/ResponsesToolChoiceContract.swift:130 — ResponsesToolChoiceContract.enforce 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 · StructuredOutputSchema.dropNullOptionals (cyclomatic 19) · ×1
  • StructuredOutputSchema.dropNullOptionals (cyclomatic 19) Packages/OsaurusCore/Services/Inference/StructuredOutput.swift:238 — StructuredOutputSchema.dropNullOptionals 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 · PhoneAgentEditing.patch (cyclomatic 19) · ×1
  • PhoneAgentEditing.patch (cyclomatic 19) Packages/OsaurusCore/Services/MobileConnect/PhoneAgentEditing.swift:123 — PhoneAgentEditing.patch has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · OnboardingFirstRun.runRequest (cyclomatic 19) · ×1
  • OnboardingFirstRun.runRequest (cyclomatic 19) Packages/OsaurusCore/Services/Onboarding/OnboardingFirstRun.swift:616 — OnboardingFirstRun.runRequest 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 · OnboardingPanel.fillFirstTask (cyclomatic 19) · ×1
  • OnboardingPanel.fillFirstTask (cyclomatic 19) Packages/OsaurusCore/Services/Onboarding/OnboardingPanel.swift:170 — OnboardingPanel.fillFirstTask 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 · RemoteProviderService.enforcingToolUseResultPairing (cyclomatic 19) · ×1
  • RemoteProviderService.enforcingToolUseResultPairing (cyclomatic 19) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:4550 — RemoteProviderService.enforcingToolUseResultPairing 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 · SearchEngine.raceFree (cyclomatic 19) · ×1
  • SearchEngine.raceFree (cyclomatic 19) Packages/OsaurusCore/Services/Search/SearchEngine.swift:242 — SearchEngine.raceFree has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TaskScheduler.submit (cyclomatic 19) · ×1
  • TaskScheduler.submit (cyclomatic 19) Packages/OsaurusCore/Services/Task/TaskScheduler.swift:162 — TaskScheduler.submit 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 · WorkflowsRegistryAPIClient.registryTemplate (cyclomatic 19) · ×1
  • WorkflowsRegistryAPIClient.registryTemplate (cyclomatic 19) Packages/OsaurusCore/Services/Template/WorkflowsRegistryAPIClient.swift:710 — WorkflowsRegistryAPIClient.registryTemplate has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: WorkflowsRegistryAPIError.errorDescription (cyclomatic 35) 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 · WhatsAppConnectionService.normalizeInbound (cyclomatic 19) · ×1
  • WhatsAppConnectionService.normalizeInbound (cyclomatic 19) Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:1324 — WhatsAppConnectionService.normalizeInbound 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 · HTTPNodeExecutor.fetch (cyclomatic 19) · ×1
  • HTTPNodeExecutor.fetch (cyclomatic 19) Packages/OsaurusCore/Services/Workflow/HTTPNodeExecutor.swift:224 — HTTPNodeExecutor.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 · MediaNodeExecutor.runRemote (cyclomatic 19) · ×1
  • MediaNodeExecutor.runRemote (cyclomatic 19) Packages/OsaurusCore/Services/Workflow/MediaNodeExecutor.swift:792 — MediaNodeExecutor.runRemote 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 · WorkflowCallFeed.apply (cyclomatic 19) · ×1
  • WorkflowCallFeed.apply (cyclomatic 19) Packages/OsaurusCore/Services/Workflow/WorkflowCallFeed.swift:75 — WorkflowCallFeed.apply 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 · DatabaseImport.parseDelimited (cyclomatic 19) · ×1
  • DatabaseImport.parseDelimited (cyclomatic 19) Packages/OsaurusCore/Tools/Database/DatabaseImport.swift:176 — DatabaseImport.parseDelimited 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 · WorkflowDraftTool.execute (cyclomatic 19) · ×1
  • WorkflowDraftTool.execute (cyclomatic 19) Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift:301 — WorkflowDraftTool.execute 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 · ChatSessionSidebar.workspaceSections (cyclomatic 19) · ×1
  • ChatSessionSidebar.workspaceSections (cyclomatic 19) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:1115 — ChatSessionSidebar.workspaceSections 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 · FloatingInputCard.sandboxToggleChip (cyclomatic 19) · ×1
  • FloatingInputCard.sandboxToggleChip (cyclomatic 19) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:4039 — FloatingInputCard.sandboxToggleChip 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 · FloatingInputCard.catalogMediaComposerChips (cyclomatic 19) · ×1
  • FloatingInputCard.catalogMediaComposerChips (cyclomatic 19) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5491 — FloatingInputCard.catalogMediaComposerChips 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 · NativeCodeBlockView.configure (cyclomatic 19) · ×1
  • NativeCodeBlockView.configure (cyclomatic 19) Packages/OsaurusCore/Views/Chat/NativeBlockViews.swift:559 — NativeCodeBlockView.configure 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 · NativeMarkdownView.scheduleImageLoad (cyclomatic 19) · ×1
  • NativeMarkdownView.scheduleImageLoad (cyclomatic 19) Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:1392 — NativeMarkdownView.scheduleImageLoad 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 · NativeToolCallRowView.markdownForConfigResult (cyclomatic 19) · ×1
  • NativeToolCallRowView.markdownForConfigResult (cyclomatic 19) Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:1862 — NativeToolCallRowView.markdownForConfigResult 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 · OverviewTab.workflowSection (cyclomatic 19) · ×1
  • OverviewTab.workflowSection (cyclomatic 19) Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:1376 — OverviewTab.workflowSection 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. This is NOT this file's highest cyclomatic complexity: OverviewTab.systemDetailLabel (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ChatPickerRow.body (cyclomatic 19) · ×1
  • ChatPickerRow.body (cyclomatic 19) Packages/OsaurusCore/Views/Model/ChatModelPickerCard.swift:831 — ChatPickerRow.body 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 · SkillsView.body (cyclomatic 19) · ×1
  • SkillsView.body (cyclomatic 19) Packages/OsaurusCore/Views/Skill/SkillsView.swift:70 — SkillsView.body has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AccessibilityManager.traverse (cyclomatic 19) · ×1
  • AccessibilityManager.traverse (cyclomatic 19) Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:592 — AccessibilityManager.traverse 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 · CatalogComponentSpec.defaults (cyclomatic 19) · ×1
  • CatalogComponentSpec.defaults (cyclomatic 19) Packages/OsaurusCore/Models/Theme/DesignLibrary/DesignLibraryDefaults.swift:53 — CatalogComponentSpec.defaults 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 · DOCXEditor.applyParagraphRun (cyclomatic 19) · ×1
  • DOCXEditor.applyParagraphRun (cyclomatic 19) Packages/OsaurusCore/Services/Documents/OOXML/DOCXEditor.swift:611 — DOCXEditor.applyParagraphRun 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 · DOCXEditor.insertParagraph (cyclomatic 19) · ×1
  • DOCXEditor.insertParagraph (cyclomatic 19) Packages/OsaurusCore/Services/Documents/OOXML/DOCXEditor.swift:761 — DOCXEditor.insertParagraph 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 · PPTXEditor.deleteSlide (cyclomatic 19) · ×1
  • PPTXEditor.deleteSlide (cyclomatic 19) Packages/OsaurusCore/Services/Documents/OOXML/PPTXEditor.swift:354 — PPTXEditor.deleteSlide 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 · XMLFeedReader.parser (cyclomatic 19) · ×1
  • XMLFeedReader.parser (cyclomatic 19) Packages/OsaurusCore/Services/Event/Feed/FeedParser.swift:196 — XMLFeedReader.parser 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 · SaveAgentTemplateSheet.preview (cyclomatic 19) · ×1
  • SaveAgentTemplateSheet.preview (cyclomatic 19) Packages/OsaurusCore/Views/Agent/Templates/AgentTemplateSheets.swift:274 — SaveAgentTemplateSheet.preview 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 · WorkflowSecretsStep.row (cyclomatic 19) · ×1
  • WorkflowSecretsStep.row (cyclomatic 19) Packages/OsaurusCore/Views/Workflow/Library/WorkflowSetupWizardView.swift:996 — WorkflowSecretsStep.row 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 · OsaurusEvalsCLI.forensicsLabel (cyclomatic 18) · ×1
  • OsaurusEvalsCLI.forensicsLabel (cyclomatic 18) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/OsaurusEvalsCLI.swift:751 — OsaurusEvalsCLI.forensicsLabel 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 · EvalRunner.runComputerUseCase (cyclomatic 18) · ×1
  • EvalRunner.runComputerUseCase (cyclomatic 18) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:1107 — EvalRunner.runComputerUseCase has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: EvalRunner.dispatchCase (cyclomatic 33) 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 · EvalRunner.scoreBrowserUseLane (cyclomatic 18) · ×1
  • EvalRunner.scoreBrowserUseLane (cyclomatic 18) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:678 — EvalRunner.scoreBrowserUseLane has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, 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 · BoundedArchiveExtractor.validatedPath (cyclomatic 18) · ×1
  • BoundedArchiveExtractor.validatedPath (cyclomatic 18) Packages/OsaurusRepository/BoundedArchiveExtractor.swift:419 — BoundedArchiveExtractor.validatedPath 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 · MinisignVerifier.parseSignature (cyclomatic 18) · ×1
  • MinisignVerifier.parseSignature (cyclomatic 18) Packages/OsaurusRepository/MinisignVerifier.swift:95 — MinisignVerifier.parseSignature 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 · CatalogAssignmentRow.body (cyclomatic 18) · ×1
  • CatalogAssignmentRow.body (cyclomatic 18) Packages/OsaurusCore/DevelopmentDesign/CatalogComponents.swift:242 — CatalogAssignmentRow.body 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 · FileWriteDocumentRouting.workbook (cyclomatic 18) · ×1
  • FileWriteDocumentRouting.workbook (cyclomatic 18) Packages/OsaurusCore/Folder/FileWriteDocumentRouting.swift:323 — FileWriteDocumentRouting.workbook 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 · FolderToolHelpers.resolvePath (cyclomatic 18) · ×1
  • FolderToolHelpers.resolvePath (cyclomatic 18) Packages/OsaurusCore/Folder/FolderTools.swift:179 — FolderToolHelpers.resolvePath 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 · HTTPHandler.handleMemoryIngest (cyclomatic 18) · ×1
  • HTTPHandler.handleMemoryIngest (cyclomatic 18) Packages/OsaurusCore/Networking/HTTPHandler.swift:4703 — HTTPHandler.handleMemoryIngest 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 · HTTPHandler.handleHostedWorkflowEndpoint (cyclomatic 18) · ×1
  • HTTPHandler.handleHostedWorkflowEndpoint (cyclomatic 18) Packages/OsaurusCore/Networking/HTTPHandler.swift:7261 — HTTPHandler.handleHostedWorkflowEndpoint 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 · ExternalModelLocator.reconciledRegistry (cyclomatic 18) · ×1
  • ExternalModelLocator.reconciledRegistry (cyclomatic 18) Packages/OsaurusCore/Services/ExternalModelLocator.swift:457 — ExternalModelLocator.reconciledRegistry 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DirectDownloader.download (cyclomatic 18) · ×1
  • DirectDownloader.download (cyclomatic 18) Packages/OsaurusCore/Services/ModelDownloadService.swift:1874 — DirectDownloader.download 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 · SubagentBatchAdmissionPlanner.planInternal (cyclomatic 18) · ×1
  • SubagentBatchAdmissionPlanner.planInternal (cyclomatic 18) Packages/OsaurusCore/Subagent/SubagentBatchAdmissionPlanner.swift:471 — SubagentBatchAdmissionPlanner.planInternal 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 · CapabilitiesLoadTool.execute (cyclomatic 18) · ×1
  • CapabilitiesLoadTool.execute (cyclomatic 18) Packages/OsaurusCore/Tools/CapabilityTools.swift:1013 — CapabilitiesLoadTool.execute 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 · ScreenContextSnapshot.render (cyclomatic 18) · ×1
  • ScreenContextSnapshot.render (cyclomatic 18) Packages/OsaurusCore/ComputerUse/Perception/ScreenContextSnapshot.swift:131 — ScreenContextSnapshot.render 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 · ConfigDiff.walk (cyclomatic 18) · ×1
  • ConfigDiff.walk (cyclomatic 18) Packages/OsaurusCore/Configuration/Declarative/ConfigDiff.swift:116 — ConfigDiff.walk has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ConfigManifest.jsonSchema (cyclomatic 18) · ×1
  • ConfigManifest.jsonSchema (cyclomatic 18) Packages/OsaurusCore/Configuration/Declarative/ConfigManifest.swift:1085 — ConfigManifest.jsonSchema 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 · ConfigPlanner.planDelegation (cyclomatic 18) · ×1
  • ConfigPlanner.planDelegation (cyclomatic 18) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1730 — ConfigPlanner.planDelegation 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 · ChatSessionImporter.parse (cyclomatic 18) · ×1
  • ChatSessionImporter.parse (cyclomatic 18) Packages/OsaurusCore/Managers/Chat/ChatSessionImporter.swift:88 — ChatSessionImporter.parse 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 · ModelManager.loadOsaurusAIOrgModels (cyclomatic 18) · ×1
  • ModelManager.loadOsaurusAIOrgModels (cyclomatic 18) Packages/OsaurusCore/Managers/Model/ModelManager.swift:1874 — ModelManager.loadOsaurusAIOrgModels 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 · OsaurusEvent.sourceSummary (cyclomatic 18) · ×1
  • OsaurusEvent.sourceSummary (cyclomatic 18) Packages/OsaurusCore/Models/Event/OsaurusEvent.swift:1043 — OsaurusEvent.sourceSummary 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 · ActivityFilterToken.tokens (cyclomatic 18) · ×1
  • ActivityFilterToken.tokens (cyclomatic 18) Packages/OsaurusCore/Models/Insights/InsightsScope.swift:119 — ActivityFilterToken.tokens 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 · WorkflowCondition.issues (cyclomatic 18) · ×1
  • WorkflowCondition.issues (cyclomatic 18) Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:1823 — WorkflowCondition.issues 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 · WorkflowRequirementsDeriver.derive · ×1
  • WorkflowRequirementsDeriver.derive::visit (cyclomatic 18) Packages/OsaurusCore/Models/Workflow/WorkflowRequirementsDeriver.swift:40 — WorkflowRequirementsDeriver.derive::visit 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 · AgentChannelConnectionService.diagnostics (cyclomatic 18) · ×1
  • AgentChannelConnectionService.diagnostics (cyclomatic 18) Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:105 — AgentChannelConnectionService.diagnostics 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 · AgentCreationEvalHarness.run (cyclomatic 18) · ×1
  • AgentCreationEvalHarness.run (cyclomatic 18) Packages/OsaurusCore/Services/AgentCreation/AgentCreationEvalHarness.swift:63 — AgentCreationEvalHarness.run 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 · WorkspaceDelegationEvaluator.run (cyclomatic 18) · ×1
  • WorkspaceDelegationEvaluator.run (cyclomatic 18) Packages/OsaurusCore/Services/AgentDelegation/WorkspaceDelegationEvaluator.swift:92 — WorkspaceDelegationEvaluator.run 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 · ContextCompactionService.summarize (cyclomatic 18) · ×1
  • ContextCompactionService.summarize (cyclomatic 18) Packages/OsaurusCore/Services/Chat/ContextCompactionService.swift:386 — ContextCompactionService.summarize 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 · AppleScriptEvaluator.run (cyclomatic 18) · ×1
  • AppleScriptEvaluator.run (cyclomatic 18) Packages/OsaurusCore/Services/Context/AppleScriptEvaluator.swift:226 — AppleScriptEvaluator.run 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 · SignInSessionActions.status (cyclomatic 18) · ×1
  • SignInSessionActions.status (cyclomatic 18) Packages/OsaurusCore/Services/Credentials/SignInSessionActions.swift:22 — SignInSessionActions.status 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 · DocumentEditService.prepare (cyclomatic 18) · ×1
  • DocumentEditService.prepare (cyclomatic 18) Packages/OsaurusCore/Services/Documents/DocumentEditService.swift:114 — DocumentEditService.prepare 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 · AutomationHistoryFeed.merge (cyclomatic 18) · ×1
  • AutomationHistoryFeed.merge (cyclomatic 18) Packages/OsaurusCore/Services/Event/AutomationHistoryFeed.swift:90 — AutomationHistoryFeed.merge 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 · FileChangeJournal.convertSandboxChanges (cyclomatic 18) · ×1
  • FileChangeJournal.convertSandboxChanges (cyclomatic 18) Packages/OsaurusCore/Services/FileHistory/FileChangeJournal.swift:1037 — FileChangeJournal.convertSandboxChanges 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 · FileChangeJournal.apply (cyclomatic 18) · ×1
  • FileChangeJournal.apply (cyclomatic 18) Packages/OsaurusCore/Services/FileHistory/FileChangeJournal+Revert.swift:427 — FileChangeJournal.apply has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FileDiffEngine.lineDiff (cyclomatic 18) · ×1
  • FileDiffEngine.lineDiff (cyclomatic 18) Packages/OsaurusCore/Services/FileHistory/FileDiffEngine.swift:195 — FileDiffEngine.lineDiff has cyclomatic complexity 18 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · IMessageHelperInstaller.machOArchitectures (cyclomatic 18) · ×1
  • IMessageHelperInstaller.machOArchitectures (cyclomatic 18) Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift:325 — IMessageHelperInstaller.machOArchitectures has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StructuredOutputSchema.matchesType (cyclomatic 18) · ×1
  • StructuredOutputSchema.matchesType (cyclomatic 18) Packages/OsaurusCore/Services/Inference/StructuredOutput.swift:279 — StructuredOutputSchema.matchesType has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · MCPProviderProbeService.mapFailure (cyclomatic 18) · ×1
  • MCPProviderProbeService.mapFailure (cyclomatic 18) Packages/OsaurusCore/Services/MCP/MCPProviderProbeService.swift:441 — MCPProviderProbeService.mapFailure 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 · PluginProcessHostCallbacks.handle (cyclomatic 18) · ×1
  • PluginProcessHostCallbacks.handle (cyclomatic 18) Packages/OsaurusCore/Services/Plugin/PluginProcessHost.swift:404 — PluginProcessHostCallbacks.handle has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RemoteProviderService.streamResponses (cyclomatic 18) · ×1
  • RemoteProviderService.streamResponses (cyclomatic 18) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:748 — RemoteProviderService.streamResponses 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 · ClaudePluginInstaller.extractSiblingSkillNames (cyclomatic 18) · ×1
  • ClaudePluginInstaller.extractSiblingSkillNames (cyclomatic 18) Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:1367 — ClaudePluginInstaller.extractSiblingSkillNames 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 · SyncRunProgressContract.snapshot (cyclomatic 18) · ×1
  • SyncRunProgressContract.snapshot (cyclomatic 18) Packages/OsaurusCore/Services/Sync/SyncRunProgress.swift:102 — SyncRunProgressContract.snapshot 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 · OAuth2ConnectionFlow.signIn (cyclomatic 18) · ×1
  • OAuth2ConnectionFlow.signIn (cyclomatic 18) Packages/OsaurusCore/Services/Workflow/WorkflowConnections.swift:418 — OAuth2ConnectionFlow.signIn 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 · WorkflowDraftStore.applyArchitectPatch (cyclomatic 18) · ×1
  • WorkflowDraftStore.applyArchitectPatch (cyclomatic 18) Packages/OsaurusCore/Services/Workflow/WorkflowDraftStore.swift:180 — WorkflowDraftStore.applyArchitectPatch 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 · ImageSubagentKind.localPermission (cyclomatic 18) · ×1
  • ImageSubagentKind.localPermission (cyclomatic 18) Packages/OsaurusCore/Subagent/Kinds/ImageSubagentKind.swift:274 — ImageSubagentKind.localPermission has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · DatabaseImport.isDecimalLiteral (cyclomatic 18) · ×1
  • DatabaseImport.isDecimalLiteral (cyclomatic 18) Packages/OsaurusCore/Tools/Database/DatabaseImport.swift:590 — DatabaseImport.isDecimalLiteral 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 · ChatEmptyState.greetingBlock (cyclomatic 18) · ×1
  • ChatEmptyState.greetingBlock (cyclomatic 18) Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:335 — ChatEmptyState.greetingBlock 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 · SessionRow.sourceBadgeHelp (cyclomatic 18) · ×1
  • SessionRow.sourceBadgeHelp (cyclomatic 18) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:3695 — SessionRow.sourceBadgeHelp has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ChatHistoryList.body (cyclomatic 18) · ×1
  • ChatHistoryList.body (cyclomatic 18) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:4279 — ChatHistoryList.body 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 · ChatSession.runRemoteImageGeneration (cyclomatic 18) · ×1
  • ChatSession.runRemoteImageGeneration (cyclomatic 18) Packages/OsaurusCore/Views/Chat/ChatView.swift:7055 — ChatSession.runRemoteImageGeneration 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 · FloatingInputCard.handleBuiltInSlashAction (cyclomatic 18) · ×1
  • FloatingInputCard.handleBuiltInSlashAction (cyclomatic 18) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:2249 — FloatingInputCard.handleBuiltInSlashAction 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 · NativeMarkdownTableView.relayoutImpl (cyclomatic 18) · ×1
  • NativeMarkdownTableView.relayoutImpl (cyclomatic 18) Packages/OsaurusCore/Views/Chat/NativeBlockViews.swift:1407 — NativeMarkdownTableView.relayoutImpl 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 · NativeMarkdownView.configure (cyclomatic 18) · ×1
  • NativeMarkdownView.configure (cyclomatic 18) Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:534 — NativeMarkdownView.configure 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 · NativeThinkingView.configure (cyclomatic 18) · ×1
  • NativeThinkingView.configure (cyclomatic 18) Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift:99 — NativeThinkingView.configure 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 · SettingsSheetFooter.body (cyclomatic 18) · ×1
  • SettingsSheetFooter.body (cyclomatic 18) Packages/OsaurusCore/Views/DesignSystem/SettingsSheet.swift:184 — SettingsSheetFooter.body 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 · OverviewTab.commonFacts (cyclomatic 18) · ×1
  • OverviewTab.commonFacts (cyclomatic 18) Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:1088 — OverviewTab.commonFacts has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: OverviewTab.systemDetailLabel (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · OverviewTab.whereRows (cyclomatic 18) · ×1
  • OverviewTab.whereRows (cyclomatic 18) Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:1228 — OverviewTab.whereRows has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: OverviewTab.systemDetailLabel (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · OverviewTab.interactionSection (cyclomatic 18) · ×1
  • OverviewTab.interactionSection (cyclomatic 18) Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:1312 — OverviewTab.interactionSection has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: OverviewTab.systemDetailLabel (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · OverviewTab.whoRows (cyclomatic 18) · ×1
  • OverviewTab.whoRows (cyclomatic 18) Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:1684 — OverviewTab.whoRows has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: OverviewTab.systemDetailLabel (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · KnowledgeView.body (cyclomatic 18) · ×1
  • KnowledgeView.body (cyclomatic 18) Packages/OsaurusCore/Views/Knowledge/KnowledgeView.swift:83 — KnowledgeView.body 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 · MemoryView.diagnosticHeadline (cyclomatic 18) · ×1
  • MemoryView.diagnosticHeadline (cyclomatic 18) Packages/OsaurusCore/Views/Memory/MemoryDiagnosticsViews.swift:942 — MemoryView.diagnosticHeadline 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 · ModelRowCellView.layout (cyclomatic 18) · ×1
  • ModelRowCellView.layout (cyclomatic 18) Packages/OsaurusCore/Views/Model/ModelPickerTableRepresentable.swift:842 — ModelRowCellView.layout 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 · PluginConfigView.readConfig (cyclomatic 18) · ×1
  • PluginConfigView.readConfig (cyclomatic 18) Packages/OsaurusCore/Views/Plugin/PluginConfigView.swift:398 — PluginConfigView.readConfig 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 · ToolsManagerView.allToolsTabContent (cyclomatic 18) · ×1
  • ToolsManagerView.allToolsTabContent (cyclomatic 18) Packages/OsaurusCore/Views/Plugin/ToolsManagerView.swift:209 — ToolsManagerView.allToolsTabContent 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 · TasksView.lane (cyclomatic 18) · ×1
  • TasksView.lane (cyclomatic 18) Packages/OsaurusCore/Views/Task/TasksView.swift:201 — TasksView.lane 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 · DesignLibraryPruning.pruned (cyclomatic 18) · ×1
  • DesignLibraryPruning.pruned (cyclomatic 18) Packages/OsaurusCore/Models/Theme/DesignLibrary/DesignLibraryPruning.swift:20 — DesignLibraryPruning.pruned 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 · AssignedMenuPanelPresenter.show (cyclomatic 18) · ×1
  • AssignedMenuPanelPresenter.show (cyclomatic 18) Packages/OsaurusCore/Models/Theme/InspectionAdapters/AssignedMenuPresentation.swift:44 — AssignedMenuPanelPresenter.show 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 · AssignedNativeMenuItems.menuRows (cyclomatic 18) · ×1
  • AssignedNativeMenuItems.menuRows (cyclomatic 18) Packages/OsaurusCore/Models/Theme/InspectionAdapters/AssignedMenuPresentation.swift:579 — AssignedNativeMenuItems.menuRows 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 · LoginAssertion.verify (cyclomatic 18) · ×1
  • LoginAssertion.verify (cyclomatic 18) Packages/OsaurusCore/Services/Auth/LoginWithOsaurus/LoginAssertion.swift:116 — LoginAssertion.verify 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 · DOCXEditor.replaceText (cyclomatic 18) · ×1
  • DOCXEditor.replaceText (cyclomatic 18) Packages/OsaurusCore/Services/Documents/OOXML/DOCXEditor.swift:190 — DOCXEditor.replaceText 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 · PPTXEditor.replaceText (cyclomatic 18) · ×1
  • PPTXEditor.replaceText (cyclomatic 18) Packages/OsaurusCore/Services/Documents/OOXML/PPTXEditor.swift:119 — PPTXEditor.replaceText 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 · XLSXEditor.setCell (cyclomatic 18) · ×1
  • XLSXEditor.setCell (cyclomatic 18) Packages/OsaurusCore/Services/Documents/OOXML/XLSXEditor.swift:231 — XLSXEditor.setCell 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 · XLSXEditor.shiftAnnotations (cyclomatic 18) · ×1
  • XLSXEditor.shiftAnnotations (cyclomatic 18) Packages/OsaurusCore/Services/Documents/OOXML/XLSXEditor.swift:628 — XLSXEditor.shiftAnnotations 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 · ImageCatalogSource.item (cyclomatic 18) · ×1
  • ImageCatalogSource.item (cyclomatic 18) Packages/OsaurusCore/Views/Model/Catalog/ImageCatalogSource.swift:110 — ImageCatalogSource.item 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 · ArchitectSidebarPanel.designSections (cyclomatic 18) · ×1
  • ArchitectSidebarPanel.designSections (cyclomatic 18) Packages/OsaurusCore/Views/Workflow/Architect/ArchitectSidebarPanel.swift:331 — ArchitectSidebarPanel.designSections 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 · WorkflowBundleSetupView.stepContent (cyclomatic 18) · ×1
  • WorkflowBundleSetupView.stepContent (cyclomatic 18) Packages/OsaurusCore/Views/Workflow/Library/WorkflowBundleSetupView.swift:241 — WorkflowBundleSetupView.stepContent 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 · PullCommand.execute (cyclomatic 17) · ×1
  • PullCommand.execute (cyclomatic 17) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:43 — PullCommand.execute 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 · InstallationDiagnostics.classify (cyclomatic 17) · ×1
  • InstallationDiagnostics.classify (cyclomatic 17) Packages/OsaurusCLI/Sources/OsaurusCLICore/Services/InstallationDiagnostics.swift:293 — InstallationDiagnostics.classify 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 · EvalDiff.classifyPerf (cyclomatic 17) · ×1
  • EvalDiff.classifyPerf (cyclomatic 17) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalDiff.swift:447 — EvalDiff.classifyPerf 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 · EvalRunner.scoreDbState (cyclomatic 17) · ×1
  • EvalRunner.scoreDbState (cyclomatic 17) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerAgentLoop.swift:1781 — EvalRunner.scoreDbState 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 · EvalRunner.scoreComputerUseLane (cyclomatic 17) · ×1
  • EvalRunner.scoreComputerUseLane (cyclomatic 17) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:548 — EvalRunner.scoreComputerUseLane has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · EvalRemoteProviderBootstrap.preset (cyclomatic 17) · ×1
  • EvalRemoteProviderBootstrap.preset (cyclomatic 17) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/RemoteProviderBootstrap.swift:93 — EvalRemoteProviderBootstrap.preset 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 · CatalogTokenButtonStyle.makeBody (cyclomatic 17) · ×1
  • CatalogTokenButtonStyle.makeBody (cyclomatic 17) Packages/OsaurusCore/DevelopmentDesign/CatalogInspector.swift:222 — CatalogTokenButtonStyle.makeBody 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 · FileTreeTool.buildTree (cyclomatic 17) · ×1
  • FileTreeTool.buildTree (cyclomatic 17) Packages/OsaurusCore/Folder/FolderTools.swift:953 — FileTreeTool.buildTree has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to one function item inside it that branches (traverse). 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 · SkillArchiveProcessRunner.run (cyclomatic 17) · ×1
  • SkillArchiveProcessRunner.run (cyclomatic 17) Packages/OsaurusCore/Managers/SkillImportPolicy.swift:306 — SkillArchiveProcessRunner.run 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 · ToastManager.handleBuiltInAction (cyclomatic 17) · ×1
  • ToastManager.handleBuiltInAction (cyclomatic 17) Packages/OsaurusCore/Managers/ToastManager.swift:378 — ToastManager.handleBuiltInAction 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 · HTTPHandler.handleUpdateAgentToolEndpoint (cyclomatic 17) · ×1
  • HTTPHandler.handleUpdateAgentToolEndpoint (cyclomatic 17) Packages/OsaurusCore/Networking/HTTPHandler.swift:6471 — HTTPHandler.handleUpdateAgentToolEndpoint 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 · HTTPHandler.handleAnswerWorkflowDialogEndpoint (cyclomatic 17) · ×1
  • HTTPHandler.handleAnswerWorkflowDialogEndpoint (cyclomatic 17) Packages/OsaurusCore/Networking/HTTPHandler.swift:7432 — HTTPHandler.handleAnswerWorkflowDialogEndpoint has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · HTTPHandler.handleAnthropicMessagesNonStreaming (cyclomatic 17) · ×1
  • HTTPHandler.handleAnthropicMessagesNonStreaming (cyclomatic 17) Packages/OsaurusCore/Networking/HTTPHandler.swift:18083 — HTTPHandler.handleAnthropicMessagesNonStreaming 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 · HTTPHandler.parseMultipartFormData (cyclomatic 17) · ×1
  • HTTPHandler.parseMultipartFormData (cyclomatic 17) Packages/OsaurusCore/Networking/HTTPHandler.swift:19013 — HTTPHandler.parseMultipartFormData 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 · BundledModelSeeder.seed (cyclomatic 17) · ×1
  • BundledModelSeeder.seed (cyclomatic 17) Packages/OsaurusCore/Services/BundledModelSeeder.swift:231 — BundledModelSeeder.seed 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 · GitHubSkillService.parseGitHubURL (cyclomatic 17) · ×1
  • GitHubSkillService.parseGitHubURL (cyclomatic 17) Packages/OsaurusCore/Services/GitHubSkillService.swift:972 — GitHubSkillService.parseGitHubURL 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 · GitHubSkillService.detectDefaultBranch (cyclomatic 17) · ×1
  • GitHubSkillService.detectDefaultBranch (cyclomatic 17) Packages/OsaurusCore/Services/GitHubSkillService.swift:1952 — GitHubSkillService.detectDefaultBranch 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 · ModelCompatibilityDiagnostics.evidenceRows (cyclomatic 17) · ×1
  • ModelCompatibilityDiagnostics.evidenceRows (cyclomatic 17) Packages/OsaurusCore/Services/ModelCompatibilityDiagnostics.swift:660 — ModelCompatibilityDiagnostics.evidenceRows 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 · AgentDatabase.createTable (cyclomatic 17) · ×1
  • AgentDatabase.createTable (cyclomatic 17) Packages/OsaurusCore/Storage/AgentDatabase.swift:636 — AgentDatabase.createTable 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 · AgentDatabase.forbiddenReason (cyclomatic 17) · ×1
  • AgentDatabase.forbiddenReason (cyclomatic 17) Packages/OsaurusCore/Storage/AgentDatabase.swift:2364 — AgentDatabase.forbiddenReason 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 · SandboxExecTool.run (cyclomatic 17) · ×1
  • SandboxExecTool.run (cyclomatic 17) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2745 — SandboxExecTool.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 · OsaurusInspectTool.statusEnvelope (cyclomatic 17) · ×1
  • OsaurusInspectTool.statusEnvelope (cyclomatic 17) Packages/OsaurusCore/Tools/ConfigurationTools.swift:477 — OsaurusInspectTool.statusEnvelope 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. This is NOT this file's highest cyclomatic complexity: ConfigurationReadNextStep.shapeSections (cyclomatic 20) 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 · SearchKnowledgeTool.execute (cyclomatic 17) · ×1
  • SearchKnowledgeTool.execute (cyclomatic 17) Packages/OsaurusCore/Tools/KnowledgeTools.swift:287 — SearchKnowledgeTool.execute 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 · ToolRegistry.normalizeToolResult (cyclomatic 17) · ×1
  • ToolRegistry.normalizeToolResult (cyclomatic 17) Packages/OsaurusCore/Tools/ToolRegistry.swift:1998 — ToolRegistry.normalizeToolResult 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 · CNContactsService.apply (cyclomatic 17) · ×1
  • CNContactsService.apply (cyclomatic 17) Packages/OsaurusCore/AppleApps/Contacts/ContactsService.swift:351 — CNContactsService.apply 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 · MapsToolFactory.placeReference (cyclomatic 17) · ×1
  • MapsToolFactory.placeReference (cyclomatic 17) Packages/OsaurusCore/AppleApps/Maps/MapsTools.swift:84 — MapsToolFactory.placeReference 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 · ScreenContextDistiller.statusToken (cyclomatic 17) · ×1
  • ScreenContextDistiller.statusToken (cyclomatic 17) Packages/OsaurusCore/ComputerUse/Perception/ScreenContextDistiller.swift:797 — ScreenContextDistiller.statusToken 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 · PluginManager._loadAll (cyclomatic 17) · ×1
  • PluginManager._loadAll (cyclomatic 17) Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:238 — PluginManager._loadAll 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 · PluginManager.deliverInitialConfig (cyclomatic 17) · ×1
  • PluginManager.deliverInitialConfig (cyclomatic 17) Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:601 — PluginManager.deliverInitialConfig 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 · ServerRuntimeSettingsStore.shouldRepairMemorySafetyOwnedCacheDefaults (cyclomatic 17) · ×1
  • ServerRuntimeSettingsStore.shouldRepairMemorySafetyOwnedCacheDefaults (cyclomatic 17) Packages/OsaurusCore/Models/Configuration/ServerRuntimeSettingsStore.swift:689 — ServerRuntimeSettingsStore.shouldRepairMemorySafetyOwnedCacheDefaults 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 · ToolApprovalPresentation.make (cyclomatic 17) · ×1
  • ToolApprovalPresentation.make (cyclomatic 17) Packages/OsaurusCore/Models/Tool/ToolApprovalPresentation.swift:238 — ToolApprovalPresentation.make 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 · JSONSchemaValidator.schemaIssues (cyclomatic 17) · ×1
  • JSONSchemaValidator.schemaIssues (cyclomatic 17) Packages/OsaurusCore/Models/Workflow/JSONSchemaValidator.swift:147 — JSONSchemaValidator.schemaIssues 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 · SpokenDigitRuns.find (cyclomatic 17) · ×1
  • SpokenDigitRuns.find (cyclomatic 17) Packages/OsaurusCore/PrivacyFilter/Core/SpokenNumberDetector.swift:81 — SpokenDigitRuns.find 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 · AgentBundleService.resolveImportIdentity (cyclomatic 17) · ×1
  • AgentBundleService.resolveImportIdentity (cyclomatic 17) Packages/OsaurusCore/Services/AgentBridge/AgentBundleService.swift:255 — AgentBundleService.resolveImportIdentity 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 · AgentChannelCustomJSONRunner.mapResult (cyclomatic 17) · ×1
  • AgentChannelCustomJSONRunner.mapResult (cyclomatic 17) Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:989 — AgentChannelCustomJSONRunner.mapResult has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: AgentChannelCustomJSONRunnerError.errorDescription (cyclomatic 20) 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 · AgentChannelInboundRelay.submit (cyclomatic 17) · ×1
  • AgentChannelInboundRelay.submit (cyclomatic 17) Packages/OsaurusCore/Services/AgentChannel/AgentChannelInboundRelay.swift:202 — AgentChannelInboundRelay.submit 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 · ChannelAccountMigration.splitTriggers (cyclomatic 17) · ×1
  • ChannelAccountMigration.splitTriggers (cyclomatic 17) Packages/OsaurusCore/Services/AgentChannel/ChannelAccountMigration.swift:241 — ChannelAccountMigration.splitTriggers 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 · AttentionActivityLogger.details (cyclomatic 17) · ×1
  • AttentionActivityLogger.details (cyclomatic 17) Packages/OsaurusCore/Services/Attention/AttentionActivityLogger.swift:263 — AttentionActivityLogger.details 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 · AgentLoopModelStep.classifyTerminal (cyclomatic 17) · ×1
  • AgentLoopModelStep.classifyTerminal (cyclomatic 17) Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:207 — AgentLoopModelStep.classifyTerminal 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 · AgentToolLoop.completedDesktopSummaryBeforeMalformedRepeat (cyclomatic 17) · ×1
  • AgentToolLoop.completedDesktopSummaryBeforeMalformedRepeat (cyclomatic 17) Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:1622 — AgentToolLoop.completedDesktopSummaryBeforeMalformedRepeat 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 · ContextCompactionService.renderTranscript (cyclomatic 17) · ×1
  • ContextCompactionService.renderTranscript (cyclomatic 17) Packages/OsaurusCore/Services/Chat/ContextCompactionService.swift:617 — ContextCompactionService.renderTranscript 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 · SystemPromptComposer.hasAnyConfiguredAgentChannel (cyclomatic 17) · ×1
  • SystemPromptComposer.hasAnyConfiguredAgentChannel (cyclomatic 17) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:1747 — SystemPromptComposer.hasAnyConfiguredAgentChannel 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 · ChatImportEvalHarness.run (cyclomatic 17) · ×1
  • ChatImportEvalHarness.run (cyclomatic 17) Packages/OsaurusCore/Services/ChatImport/ChatImportEvalHarness.swift:55 — ChatImportEvalHarness.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 · MicroPerfEvaluator.measureRep (cyclomatic 17) · ×1
  • MicroPerfEvaluator.measureRep (cyclomatic 17) Packages/OsaurusCore/Services/Context/MicroPerfEvaluator.swift:497 — MicroPerfEvaluator.measureRep 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 · WorkbookWorkflowValidator.validateCell (cyclomatic 17) · ×1
  • WorkbookWorkflowValidator.validateCell (cyclomatic 17) Packages/OsaurusCore/Services/Documents/WorkbookWorkflowService.swift:445 — WorkbookWorkflowValidator.validateCell 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 · FolderEventSource.reconcile (cyclomatic 17) · ×1
  • FolderEventSource.reconcile (cyclomatic 17) Packages/OsaurusCore/Services/Event/FolderEventSource.swift:68 — FolderEventSource.reconcile 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 · ClaudeCodeHarnessCodec.decode (cyclomatic 17) · ×1
  • ClaudeCodeHarnessCodec.decode (cyclomatic 17) Packages/OsaurusCore/Services/Harness/ClaudeCodeHarnessAdapter.swift:254 — ClaudeCodeHarnessCodec.decode 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 · PendingImportProcessor.decideSetting (cyclomatic 17) · ×1
  • PendingImportProcessor.decideSetting (cyclomatic 17) Packages/OsaurusCore/Services/Import/PendingImportProcessor.swift:444 — PendingImportProcessor.decideSetting 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 · ClaudeCodeStreamDecoder.decodeStreamEvent (cyclomatic 17) · ×1
  • ClaudeCodeStreamDecoder.decodeStreamEvent (cyclomatic 17) Packages/OsaurusCore/Services/Inference/ClaudeCodeStreamDecoder.swift:120 — ClaudeCodeStreamDecoder.decodeStreamEvent 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 · MemorySearchService.searchTranscript (cyclomatic 17) · ×1
  • MemorySearchService.searchTranscript (cyclomatic 17) Packages/OsaurusCore/Services/Memory/MemorySearchService.swift:443 — MemorySearchService.searchTranscript 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 · Registry.snapshotDiagnostics (cyclomatic 17) · ×1
  • Registry.snapshotDiagnostics (cyclomatic 17) Packages/OsaurusCore/Services/ModelRuntime/MLXBatchAdapter.swift:675 — Registry.snapshotDiagnostics 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 · OnboardingFirstRun.runEnded (cyclomatic 17) · ×1
  • OnboardingFirstRun.runEnded (cyclomatic 17) Packages/OsaurusCore/Services/Onboarding/OnboardingFirstRun.swift:689 — OnboardingFirstRun.runEnded 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 · InstalledClaudePluginsAggregator.buildPlugins (cyclomatic 17) · ×1
  • InstalledClaudePluginsAggregator.buildPlugins (cyclomatic 17) Packages/OsaurusCore/Services/Plugin/InstalledClaudePluginsAggregator.swift:495 — InstalledClaudePluginsAggregator.buildPlugins has cyclomatic complexity 17 (threshold 15). Of this number, 15 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 · PluginHostContext.ssrfBlockedIPv4 (cyclomatic 17) · ×1
  • PluginHostContext.ssrfBlockedIPv4 (cyclomatic 17) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:3071 — PluginHostContext.ssrfBlockedIPv4 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 · ProviderNetworkDiagnostics.remoteModelDiscoveryRow (cyclomatic 17) · ×1
  • ProviderNetworkDiagnostics.remoteModelDiscoveryRow (cyclomatic 17) Packages/OsaurusCore/Services/Provider/ProviderNetworkDiagnostics.swift:319 — ProviderNetworkDiagnostics.remoteModelDiscoveryRow 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 · RemoteProviderService.geminiImageGenerateContent (cyclomatic 17) · ×1
  • RemoteProviderService.geminiImageGenerateContent (cyclomatic 17) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:3949 — RemoteProviderService.geminiImageGenerateContent 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 · WorkspaceAgentLiveness.classify (cyclomatic 17) · ×1
  • WorkspaceAgentLiveness.classify (cyclomatic 17) Packages/OsaurusCore/Services/Router/WorkspaceAgentLiveness.swift:79 — WorkspaceAgentLiveness.classify 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 · WorkspaceRosterStore.refresh (cyclomatic 17) · ×1
  • WorkspaceRosterStore.refresh (cyclomatic 17) Packages/OsaurusCore/Services/Router/WorkspaceRosterStore.swift:317 — WorkspaceRosterStore.refresh 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 · WorkspaceSyncService.startStream (cyclomatic 17) · ×1
  • WorkspaceSyncService.startStream (cyclomatic 17) Packages/OsaurusCore/Services/Router/WorkspaceSyncService.swift:181 — WorkspaceSyncService.startStream 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 · SearchHTML.blockedIPv4Reason (cyclomatic 17) · ×1
  • SearchHTML.blockedIPv4Reason (cyclomatic 17) Packages/OsaurusCore/Services/Search/SearchHTMLHelpers.swift:364 — SearchHTML.blockedIPv4Reason 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 · SyncAttentionFeed.apply (cyclomatic 17) · ×1
  • SyncAttentionFeed.apply (cyclomatic 17) Packages/OsaurusCore/Services/Sync/SyncAttentionFeed.swift:237 — SyncAttentionFeed.apply 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 · SyncConversationMapper.detailWrite (cyclomatic 17) · ×1
  • SyncConversationMapper.detailWrite (cyclomatic 17) Packages/OsaurusCore/Services/Sync/SyncConversationMapper.swift:508 — SyncConversationMapper.detailWrite has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 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 · SyncConversationMapper.attachment (cyclomatic 17) · ×1
  • SyncConversationMapper.attachment (cyclomatic 17) Packages/OsaurusCore/Services/Sync/SyncConversationMapper.swift:800 — SyncConversationMapper.attachment 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 · TemplateImportRouter.fetch (cyclomatic 17) · ×1
  • TemplateImportRouter.fetch (cyclomatic 17) Packages/OsaurusCore/Services/Template/TemplateImportRouter.swift:269 — TemplateImportRouter.fetch 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 · MediaNodeExecutor.resolveParameters (cyclomatic 17) · ×1
  • MediaNodeExecutor.resolveParameters (cyclomatic 17) Packages/OsaurusCore/Services/Workflow/MediaNodeExecutor.swift:265 — MediaNodeExecutor.resolveParameters has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · WorkflowNodeError.isRetryable (cyclomatic 17) · ×1
  • WorkflowNodeError.isRetryable (cyclomatic 17) Packages/OsaurusCore/Services/Workflow/WorkflowNodeExecutor.swift:211 — WorkflowNodeError.isRetryable 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 · WorkflowRunner.attempt (cyclomatic 17) · ×1
  • WorkflowRunner.attempt (cyclomatic 17) Packages/OsaurusCore/Services/Workflow/WorkflowRunner.swift:991 — WorkflowRunner.attempt 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 · TextSubagentKind.matchesApprovedAuthority (cyclomatic 17) · ×1
  • TextSubagentKind.matchesApprovedAuthority (cyclomatic 17) Packages/OsaurusCore/Subagent/Kinds/TextSubagentKind.swift:869 — TextSubagentKind.matchesApprovedAuthority 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 · WorkflowTestTool.runFromNode (cyclomatic 17) · ×1
  • WorkflowTestTool.runFromNode (cyclomatic 17) Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift:677 — WorkflowTestTool.runFromNode 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 · WorkflowProposeSaveTool.execute (cyclomatic 17) · ×1
  • WorkflowProposeSaveTool.execute (cyclomatic 17) Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift:1101 — WorkflowProposeSaveTool.execute 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 · ChatCrossSelection.updateSelection (cyclomatic 17) · ×1
  • ChatCrossSelection.updateSelection (cyclomatic 17) Packages/OsaurusCore/Views/Chat/ChatCrossSelection.swift:187 — ChatCrossSelection.updateSelection 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 · ChatTabContextMenu.makeMenu (cyclomatic 17) · ×1
  • ChatTabContextMenu.makeMenu (cyclomatic 17) Packages/OsaurusCore/Views/Chat/ChatTabStripView.swift:880 — ChatTabContextMenu.makeMenu 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 · ChatSession.applyPickerItems (cyclomatic 17) · ×1
  • ChatSession.applyPickerItems (cyclomatic 17) Packages/OsaurusCore/Views/Chat/ChatView.swift:1975 — ChatSession.applyPickerItems 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 · ChatSession.modelVisibleAssistantMessage (cyclomatic 17) · ×1
  • ChatSession.modelVisibleAssistantMessage (cyclomatic 17) Packages/OsaurusCore/Views/Chat/ChatView.swift:2822 — ChatSession.modelVisibleAssistantMessage 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 · ChatSession.stop (cyclomatic 17) · ×1
  • ChatSession.stop (cyclomatic 17) Packages/OsaurusCore/Views/Chat/ChatView.swift:3070 — ChatSession.stop 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 · ChatView.pinRemoteAgentModelAfterConnect (cyclomatic 17) · ×1
  • ChatView.pinRemoteAgentModelAfterConnect (cyclomatic 17) Packages/OsaurusCore/Views/Chat/ChatView.swift:12425 — ChatView.pinRemoteAgentModelAfterConnect 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 · ComputerUseConfirmOverlay.confirmCard (cyclomatic 17) · ×1
  • ComputerUseConfirmOverlay.confirmCard (cyclomatic 17) Packages/OsaurusCore/Views/Chat/ComputerUseConfirmOverlay.swift:86 — ComputerUseConfirmOverlay.confirmCard 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 · FloatingInputCard.refreshMTPLayoutAdvisory (cyclomatic 17) · ×1
  • FloatingInputCard.refreshMTPLayoutAdvisory (cyclomatic 17) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:4588 — FloatingInputCard.refreshMTPLayoutAdvisory 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 · VoiceStateSyncObservers.body (cyclomatic 17) · ×1
  • VoiceStateSyncObservers.body (cyclomatic 17) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:9052 — VoiceStateSyncObservers.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 · NativeArtifactCardView.buildPreview (cyclomatic 17) · ×1
  • NativeArtifactCardView.buildPreview (cyclomatic 17) Packages/OsaurusCore/Views/Chat/NativeArtifactCardView.swift:374 — NativeArtifactCardView.buildPreview 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 · NativeCompactionMarkerView.configure (cyclomatic 17) · ×1
  • NativeCompactionMarkerView.configure (cyclomatic 17) Packages/OsaurusCore/Views/Chat/NativeCompactionMarkerView.swift:84 — NativeCompactionMarkerView.configure 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 · NativeMarkdownView.configureWithBlocks (cyclomatic 17) · ×1
  • NativeMarkdownView.configureWithBlocks (cyclomatic 17) Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:635 — NativeMarkdownView.configureWithBlocks 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 · NativeMarkdownView.measureMixedSegmentHeight (cyclomatic 17) · ×1
  • NativeMarkdownView.measureMixedSegmentHeight (cyclomatic 17) Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:800 — NativeMarkdownView.measureMixedSegmentHeight 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 · PreviewGenerator.resultPreview (cyclomatic 17) · ×1
  • PreviewGenerator.resultPreview (cyclomatic 17) Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:245 — PreviewGenerator.resultPreview 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 · NativeToolCallGroupView.configure (cyclomatic 17) · ×1
  • NativeToolCallGroupView.configure (cyclomatic 17) Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:698 — NativeToolCallGroupView.configure 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 · CredentialEditorSheet.body (cyclomatic 17) · ×1
  • CredentialEditorSheet.body (cyclomatic 17) Packages/OsaurusCore/Views/Credentials/CredentialEditorSheet.swift:126 — CredentialEditorSheet.body 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 · SettingsLanding.prepare (cyclomatic 17) · ×1
  • SettingsLanding.prepare (cyclomatic 17) Packages/OsaurusCore/Views/Management/SettingsLanding.swift:16 — SettingsLanding.prepare 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 · SidebarLensBar.segmentButton (cyclomatic 17) · ×1
  • SidebarLensBar.segmentButton (cyclomatic 17) Packages/OsaurusCore/Views/Management/SharedSidebarComponents.swift:281 — SidebarLensBar.segmentButton 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 · MemoryConsoleInspectSheet.metadataGrid (cyclomatic 17) · ×1
  • MemoryConsoleInspectSheet.metadataGrid (cyclomatic 17) Packages/OsaurusCore/Views/Memory/MemoryManagementConsoleView.swift:666 — MemoryConsoleInspectSheet.metadataGrid 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 · ModelDetailView.manifestStatus (cyclomatic 17) · ×1
  • ModelDetailView.manifestStatus (cyclomatic 17) Packages/OsaurusCore/Views/Model/ModelDetailView.swift:1114 — ModelDetailView.manifestStatus 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 · ModelPickerView.thinkingOptionRow (cyclomatic 17) · ×1
  • ModelPickerView.thinkingOptionRow (cyclomatic 17) Packages/OsaurusCore/Views/Model/ModelPickerView.swift:916 — ModelPickerView.thinkingOptionRow 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 · CommandLineToolSection.resolveCLIExecutableURL (cyclomatic 17) · ×1
  • CommandLineToolSection.resolveCLIExecutableURL (cyclomatic 17) Packages/OsaurusCore/Views/Settings/CommandLineToolSection.swift:87 — CommandLineToolSection.resolveCLIExecutableURL 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 · PublishedWorkflowDashboard.saveListing (cyclomatic 17) · ×1
  • PublishedWorkflowDashboard.saveListing (cyclomatic 17) Packages/OsaurusCore/Views/Template/PublishedWorkflowDashboard.swift:791 — PublishedWorkflowDashboard.saveListing 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 · WorkspaceDetailView.poolSection (cyclomatic 17) · ×1
  • WorkspaceDetailView.poolSection (cyclomatic 17) Packages/OsaurusCore/Views/Workspaces/WorkspaceDetailView.swift:396 — WorkspaceDetailView.poolSection 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 · CreateWorkspaceSheet.body (cyclomatic 17) · ×1
  • CreateWorkspaceSheet.body (cyclomatic 17) Packages/OsaurusCore/Views/Workspaces/WorkspaceSheets.swift:244 — CreateWorkspaceSheet.body 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 · ActivateWorkspaceSheet.body (cyclomatic 17) · ×1
  • ActivateWorkspaceSheet.body (cyclomatic 17) Packages/OsaurusCore/Views/Workspaces/WorkspaceSheets.swift:490 — ActivateWorkspaceSheet.body 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 · ScreenshotController.capture (cyclomatic 17) · ×1
  • ScreenshotController.capture (cyclomatic 17) Packages/OsaurusCore/ComputerUse/Driver/Mac/Screenshot.swift:151 — ScreenshotController.capture 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 · InspectorAssignedTextField.updateNSView (cyclomatic 17) · ×1
  • InspectorAssignedTextField.updateNSView (cyclomatic 17) Packages/OsaurusCore/Models/Theme/DesignLibrary/InspectorAssignedTextField.swift:63 — InspectorAssignedTextField.updateNSView 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 · XLSXEditor.expandSharedFormulas (cyclomatic 17) · ×1
  • XLSXEditor.expandSharedFormulas (cyclomatic 17) Packages/OsaurusCore/Services/Documents/OOXML/XLSXEditor.swift:586 — XLSXEditor.expandSharedFormulas 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 · EmailMIME.collect (cyclomatic 17) · ×1
  • EmailMIME.collect (cyclomatic 17) Packages/OsaurusCore/Services/Event/Email/EmailMIME.swift:262 — EmailMIME.collect 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 · WorkflowDetailPage.beforeItRuns (cyclomatic 17) · ×1
  • WorkflowDetailPage.beforeItRuns (cyclomatic 17) Packages/OsaurusCore/Views/Workflow/Library/WorkflowDetailPage.swift:388 — WorkflowDetailPage.beforeItRuns 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 · main.swift.buildHelperHostAPI (cyclomatic 17) · ×1
  • main.swift.buildHelperHostAPI (cyclomatic 17) Packages/OsaurusCore/PluginHost/main.swift:269 — main.swift.buildHelperHostAPI 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 · MarkdownMessageView.swift.groupBlocksIntoSegments · ×1
  • MarkdownMessageView.swift.groupBlocksIntoSegments::emitBlock (cyclomatic 17) Packages/OsaurusCore/Views/Chat/MarkdownMessageView.swift:320 — MarkdownMessageView.swift.groupBlocksIntoSegments::emitBlock has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · Accessibility.swift.focusedViewport (cyclomatic 17) · ×1
  • Accessibility.swift.focusedViewport (cyclomatic 17) Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:1217 — Accessibility.swift.focusedViewport 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 · Accessibility.swift.listWindowsForPid (cyclomatic 17) · ×1
  • Accessibility.swift.listWindowsForPid (cyclomatic 17) Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:1651 — Accessibility.swift.listWindowsForPid 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 · CoordCommand.runLock (cyclomatic 16) · ×1
  • CoordCommand.runLock (cyclomatic 16) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Coord/CoordCommand.swift:115 — CoordCommand.runLock has cyclomatic complexity 16 (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 · OsaurusEvalsCLI.runCompat (cyclomatic 16) · ×1
  • OsaurusEvalsCLI.runCompat (cyclomatic 16) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalDiffMatrixCLI.swift:210 — OsaurusEvalsCLI.runCompat 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 · EvalBootstrap.applyKVRegimeOverrideIfRequested (cyclomatic 16) · ×1
  • EvalBootstrap.applyKVRegimeOverrideIfRequested (cyclomatic 16) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalBootstrap.swift:737 — EvalBootstrap.applyKVRegimeOverrideIfRequested 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 · EvalMatrix.comparabilityWarnings (cyclomatic 16) · ×1
  • EvalMatrix.comparabilityWarnings (cyclomatic 16) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalMatrix.swift:310 — EvalMatrix.comparabilityWarnings 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 · EvalRunner.runArchitectInlineCase (cyclomatic 16) · ×1
  • EvalRunner.runArchitectInlineCase (cyclomatic 16) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerArchitectInline.swift:18 — EvalRunner.runArchitectInlineCase 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, 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 · GlobalProxyConfiguration.init (cyclomatic 16) · ×1
  • GlobalProxyConfiguration.init (cyclomatic 16) Packages/OsaurusNetworking/Sources/GlobalProxyConfiguration.swift:67 — GlobalProxyConfiguration.init 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 · BundleSetting.originProblem (cyclomatic 16) · ×1
  • BundleSetting.originProblem (cyclomatic 16) Packages/OsaurusRepository/BundleSettings.swift:144 — BundleSetting.originProblem 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 · CatalogExpandedAssignments.sharedParts (cyclomatic 16) · ×1
  • CatalogExpandedAssignments.sharedParts (cyclomatic 16) Packages/OsaurusCore/DevelopmentDesign/CatalogComponents.swift:130 — CatalogExpandedAssignments.sharedParts 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 · CatalogContentView.body (cyclomatic 16) · ×1
  • CatalogContentView.body (cyclomatic 16) Packages/OsaurusCore/DevelopmentDesign/CatalogInspector.swift:290 — CatalogContentView.body 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 · FileReadImageSupport.load (cyclomatic 16) · ×1
  • FileReadImageSupport.load (cyclomatic 16) Packages/OsaurusCore/Folder/FileReadImageSupport.swift:54 — FileReadImageSupport.load 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 · FileTreeTool.entries · ×1
  • FileTreeTool.entries::traverse (cyclomatic 16) Packages/OsaurusCore/Folder/FolderTools.swift:879 — FileTreeTool.entries::traverse 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 · BackgroundTaskManager.schedulingStatusChanged (cyclomatic 16) · ×1
  • BackgroundTaskManager.schedulingStatusChanged (cyclomatic 16) Packages/OsaurusCore/Managers/BackgroundTaskManager.swift:1653 — BackgroundTaskManager.schedulingStatusChanged 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 · OpenAICompatibleTTSClient.decodeCompressedAudio (cyclomatic 16) · ×1
  • OpenAICompatibleTTSClient.decodeCompressedAudio (cyclomatic 16) Packages/OsaurusCore/Managers/OpenAICompatibleTTSClient.swift:164 — OpenAICompatibleTTSClient.decodeCompressedAudio 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 · HTTPHandler.pickerModels (cyclomatic 16) · ×1
  • HTTPHandler.pickerModels (cyclomatic 16) Packages/OsaurusCore/Networking/HTTPHandler.swift:5529 — HTTPHandler.pickerModels 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 · HTTPHandler.handleWorkspaceAgentRunEndpoint (cyclomatic 16) · ×1
  • HTTPHandler.handleWorkspaceAgentRunEndpoint (cyclomatic 16) Packages/OsaurusCore/Networking/HTTPHandler.swift:6588 — HTTPHandler.handleWorkspaceAgentRunEndpoint 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 · HTTPHandler.handleAnswerPhonePromptEndpoint (cyclomatic 16) · ×1
  • HTTPHandler.handleAnswerPhonePromptEndpoint (cyclomatic 16) Packages/OsaurusCore/Networking/HTTPHandler.swift:7674 — HTTPHandler.handleAnswerPhonePromptEndpoint 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 · HTTPHandler.handleEventWebhookEndpoint (cyclomatic 16) · ×1
  • HTTPHandler.handleEventWebhookEndpoint (cyclomatic 16) Packages/OsaurusCore/Networking/HTTPHandler.swift:9901 — HTTPHandler.handleEventWebhookEndpoint has cyclomatic complexity 16 (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 · HTTPHandler.handleImageGenerations (cyclomatic 16) · ×1
  • HTTPHandler.handleImageGenerations (cyclomatic 16) Packages/OsaurusCore/Networking/HTTPHandler.swift:13601 — HTTPHandler.handleImageGenerations 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 · RelayTunnelManager.handleMessage (cyclomatic 16) · ×1
  • RelayTunnelManager.handleMessage (cyclomatic 16) Packages/OsaurusCore/Networking/RelayTunnelManager.swift:599 — RelayTunnelManager.handleMessage has cyclomatic complexity 16 (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 · RelayTunnelManager.relayStreamingResponse (cyclomatic 16) · ×1
  • RelayTunnelManager.relayStreamingResponse (cyclomatic 16) Packages/OsaurusCore/Networking/RelayTunnelManager.swift:995 — RelayTunnelManager.relayStreamingResponse 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 · SchemaJSONSlices.valueEnd (cyclomatic 16) · ×1
  • SchemaJSONSlices.valueEnd (cyclomatic 16) Packages/OsaurusCore/Networking/RequestValidator.swift:166 — SchemaJSONSlices.valueEnd 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 · DeclaredReasoningEffort.fixedNativeEffort (cyclomatic 16) · ×1
  • DeclaredReasoningEffort.fixedNativeEffort (cyclomatic 16) Packages/OsaurusCore/Services/DeclaredReasoningEffort.swift:409 — DeclaredReasoningEffort.fixedNativeEffort 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 · ModelRuntime.resolveLocalModelDirectory (cyclomatic 16) · ×1
  • ModelRuntime.resolveLocalModelDirectory (cyclomatic 16) Packages/OsaurusCore/Services/ModelRuntime.swift:8700 — ModelRuntime.resolveLocalModelDirectory has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 3 function items inside it that branch (scan, loadableBundle, withoutCrackSuffix). 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 · ActivityLogStore.verify (cyclomatic 16) · ×1
  • ActivityLogStore.verify (cyclomatic 16) Packages/OsaurusCore/Storage/ActivityLogStore.swift:575 — ActivityLogStore.verify 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 · MemoryDatabase.searchTranscriptText (cyclomatic 16) · ×1
  • MemoryDatabase.searchTranscriptText (cyclomatic 16) Packages/OsaurusCore/Storage/MemoryDatabase.swift:2377 — MemoryDatabase.searchTranscriptText 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 · StorageExportService.recoverInterruptedRotation (cyclomatic 16) · ×1
  • StorageExportService.recoverInterruptedRotation (cyclomatic 16) Packages/OsaurusCore/Storage/StorageExportService.swift:305 — StorageExportService.recoverInterruptedRotation 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 · CapabilitiesLoadTool.loadSkill (cyclomatic 16) · ×1
  • CapabilitiesLoadTool.loadSkill (cyclomatic 16) Packages/OsaurusCore/Tools/CapabilityTools.swift:1569 — CapabilitiesLoadTool.loadSkill 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 · EditKnowledgeTool.execute (cyclomatic 16) · ×1
  • EditKnowledgeTool.execute (cyclomatic 16) Packages/OsaurusCore/Tools/KnowledgeWriteTools.swift:822 — EditKnowledgeTool.execute 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 · RenderChartTool.unwrapQuotedDelimitedPayload (cyclomatic 16) · ×1
  • RenderChartTool.unwrapQuotedDelimitedPayload (cyclomatic 16) Packages/OsaurusCore/Tools/RenderChartTool.swift:802 — RenderChartTool.unwrapQuotedDelimitedPayload 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 · SecretArgumentScrubber.scrubForPersistence (cyclomatic 16) · ×1
  • SecretArgumentScrubber.scrubForPersistence (cyclomatic 16) Packages/OsaurusCore/Tools/SandboxSecretTools.swift:387 — SecretArgumentScrubber.scrubForPersistence 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 · LoginShellPath.probe (cyclomatic 16) · ×1
  • LoginShellPath.probe (cyclomatic 16) Packages/OsaurusCore/Utils/LoginShellPath.swift:64 — LoginShellPath.probe has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CalendarUpdateEventTool.run (cyclomatic 16) · ×1
  • CalendarUpdateEventTool.run (cyclomatic 16) Packages/OsaurusCore/AppleApps/Calendar/CalendarTools.swift:297 — CalendarUpdateEventTool.run 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 · ChatDBMessagesService.send (cyclomatic 16) · ×1
  • ChatDBMessagesService.send (cyclomatic 16) Packages/OsaurusCore/AppleApps/Messages/MessagesService.swift:490 — ChatDBMessagesService.send 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 · NativeMacDriver.perform (cyclomatic 16) · ×1
  • NativeMacDriver.perform (cyclomatic 16) Packages/OsaurusCore/ComputerUse/Driver/NativeMacDriver.swift:192 — NativeMacDriver.perform 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 · AgentToolSelectionResolver.apply (cyclomatic 16) · ×1
  • AgentToolSelectionResolver.apply (cyclomatic 16) Packages/OsaurusCore/Configuration/Declarative/AgentToolSelectionResolver.swift:124 — AgentToolSelectionResolver.apply 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 · ConfigApplier.normalizeAgentEntry (cyclomatic 16) · ×1
  • ConfigApplier.normalizeAgentEntry (cyclomatic 16) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:731 — ConfigApplier.normalizeAgentEntry 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 · ChatSessionImportCoordinator.run (cyclomatic 16) · ×1
  • ChatSessionImportCoordinator.run (cyclomatic 16) Packages/OsaurusCore/Managers/Chat/ChatSessionImportCoordinator.swift:120 — ChatSessionImportCoordinator.run 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 · ModelManager.scanLocalModels · ×1
  • ModelManager.scanLocalModels::scanDir (cyclomatic 16) Packages/OsaurusCore/Managers/Model/ModelManager.swift:2472 — ModelManager.scanLocalModels::scanDir 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 · AgentChannelLiveProofReadiness.telegram (cyclomatic 16) · ×1
  • AgentChannelLiveProofReadiness.telegram (cyclomatic 16) Packages/OsaurusCore/Models/AgentChannel/AgentChannelLiveProofReadiness.swift:40 — AgentChannelLiveProofReadiness.telegram 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 · AgentChannelLiveProofReadiness.imessage (cyclomatic 16) · ×1
  • AgentChannelLiveProofReadiness.imessage (cyclomatic 16) Packages/OsaurusCore/Models/AgentChannel/AgentChannelLiveProofReadiness.swift:203 — AgentChannelLiveProofReadiness.imessage 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 · ModelInfo.findModelDirectory (cyclomatic 16) · ×1
  • ModelInfo.findModelDirectory (cyclomatic 16) Packages/OsaurusCore/Models/Configuration/ModelInfo.swift:324 — ModelInfo.findModelDirectory 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 · ActivityFilter.activeCount (cyclomatic 16) · ×1
  • ActivityFilter.activeCount (cyclomatic 16) Packages/OsaurusCore/Models/Insights/ActivityFilter.swift:99 — ActivityFilter.activeCount 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 · AgentChannelCustomJSONRunner.blockedIPv4Reason (cyclomatic 16) · ×1
  • AgentChannelCustomJSONRunner.blockedIPv4Reason (cyclomatic 16) Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:1902 — AgentChannelCustomJSONRunner.blockedIPv4Reason has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: AgentChannelCustomJSONRunnerError.errorDescription (cyclomatic 20) 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 · AgentChannelMessageFormatter.stripInlineMarkdown (cyclomatic 16) · ×1
  • AgentChannelMessageFormatter.stripInlineMarkdown (cyclomatic 16) Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:124 — AgentChannelMessageFormatter.stripInlineMarkdown 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 (AgentChannelMessageFormatter.telegramInlineHTML) 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 · AgentChannelMessageFormatter.markdownBlocks (cyclomatic 16) · ×1
  • AgentChannelMessageFormatter.markdownBlocks (cyclomatic 16) Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:181 — AgentChannelMessageFormatter.markdownBlocks has cyclomatic complexity 16 (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 · AgentChannelMessageFormatter.telegramInlineHTML (cyclomatic 16) · ×1
  • AgentChannelMessageFormatter.telegramInlineHTML (cyclomatic 16) Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:330 — AgentChannelMessageFormatter.telegramInlineHTML 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 (AgentChannelMessageFormatter.stripInlineMarkdown) 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 · AgentChannelPublishService.operatorSend (cyclomatic 16) · ×1
  • AgentChannelPublishService.operatorSend (cyclomatic 16) Packages/OsaurusCore/Services/AgentChannel/AgentChannelPublishService.swift:594 — AgentChannelPublishService.operatorSend 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 · ChannelAccountMigration.runIfNeeded (cyclomatic 16) · ×1
  • ChannelAccountMigration.runIfNeeded (cyclomatic 16) Packages/OsaurusCore/Services/AgentChannel/ChannelAccountMigration.swift:69 — ChannelAccountMigration.runIfNeeded 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 · DesktopNotificationChannel.handle (cyclomatic 16) · ×1
  • DesktopNotificationChannel.handle (cyclomatic 16) Packages/OsaurusCore/Services/Attention/DesktopNotificationChannel.swift:122 — DesktopNotificationChannel.handle 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 · OwnerDeviceAccessHost.handle (cyclomatic 16) · ×1
  • OwnerDeviceAccessHost.handle (cyclomatic 16) Packages/OsaurusCore/Services/Auth/OwnerDeviceAccessHost.swift:291 — OwnerDeviceAccessHost.handle 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 · ChannelReplyTokenService.validateToken (cyclomatic 16) · ×1
  • ChannelReplyTokenService.validateToken (cyclomatic 16) Packages/OsaurusCore/Services/Channels/ChannelReplyTokenService.swift:96 — ChannelReplyTokenService.validateToken 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 · DiscordGatewayPresenceRuntime.runSession (cyclomatic 16) · ×1
  • DiscordGatewayPresenceRuntime.runSession (cyclomatic 16) Packages/OsaurusCore/Services/Discord/DiscordGatewayPresenceRuntime.swift:193 — DiscordGatewayPresenceRuntime.runSession 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 · PDFAdapter.glyphs (cyclomatic 16) · ×1
  • PDFAdapter.glyphs (cyclomatic 16) Packages/OsaurusCore/Services/Documents/PDFAdapter.swift:182 — PDFAdapter.glyphs 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 · PPTXAdapter.securityMetadata (cyclomatic 16) · ×1
  • PPTXAdapter.securityMetadata (cyclomatic 16) Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:714 — PPTXAdapter.securityMetadata 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 · EmailChannelTransportRuntime.tick (cyclomatic 16) · ×1
  • EmailChannelTransportRuntime.tick (cyclomatic 16) Packages/OsaurusCore/Services/Email/EmailChannelTransportRuntime.swift:189 — EmailChannelTransportRuntime.tick 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 · EventMatcher.filterRejection (cyclomatic 16) · ×1
  • EventMatcher.filterRejection (cyclomatic 16) Packages/OsaurusCore/Services/Event/EventMatcher.swift:118 — EventMatcher.filterRejection 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 · FileChangeJournal.markEntries (cyclomatic 16) · ×1
  • FileChangeJournal.markEntries (cyclomatic 16) Packages/OsaurusCore/Services/FileHistory/FileChangeJournal+Revert.swift:343 — FileChangeJournal.markEntries 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 · FileDiffEngine.wordRanges (cyclomatic 16) · ×1
  • FileDiffEngine.wordRanges (cyclomatic 16) Packages/OsaurusCore/Services/FileHistory/FileDiffEngine.swift:412 — FileDiffEngine.wordRanges 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 · AgentDescriptionBackfill.run (cyclomatic 16) · ×1
  • AgentDescriptionBackfill.run (cyclomatic 16) Packages/OsaurusCore/Services/Inference/AgentDescriptionBackfill.swift:114 — AgentDescriptionBackfill.run 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 · DecisionService.execute (cyclomatic 16) · ×1
  • DecisionService.execute (cyclomatic 16) Packages/OsaurusCore/Services/Inference/DecisionService.swift:132 — DecisionService.execute 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 · TokenizerMetadata.init (cyclomatic 16) · ×1
  • TokenizerMetadata.init (cyclomatic 16) Packages/OsaurusCore/Services/Inference/LocalGrammarTokenizerProbe.swift:100 — TokenizerMetadata.init has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StreamingStatsHint.encode (cyclomatic 16) · ×1
  • StreamingStatsHint.encode (cyclomatic 16) Packages/OsaurusCore/Services/Inference/ModelService.swift:617 — StreamingStatsHint.encode 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 · MediaJob.finish (cyclomatic 16) · ×1
  • MediaJob.finish (cyclomatic 16) Packages/OsaurusCore/Services/Insights/MediaActivityLogger.swift:250 — MediaJob.finish 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 · MediaGenerationCoordinator.scheduleRecovery (cyclomatic 16) · ×1
  • MediaGenerationCoordinator.scheduleRecovery (cyclomatic 16) Packages/OsaurusCore/Services/MediaGeneration/MediaGenerationCoordinator.swift:390 — MediaGenerationCoordinator.scheduleRecovery 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 · PluginHostContext.taskStateDict (cyclomatic 16) · ×1
  • PluginHostContext.taskStateDict (cyclomatic 16) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:3205 — PluginHostContext.taskStateDict 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 · RemoteChatRequest.isStrictResponsesToolSchema · ×1
  • RemoteChatRequest.isStrictResponsesToolSchema::isStrict (cyclomatic 16) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:5977 — RemoteChatRequest.isStrictResponsesToolSchema::isStrict 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 · InboundSharedRunBridge.isUnchangedPrefix (cyclomatic 16) · ×1
  • InboundSharedRunBridge.isUnchangedPrefix (cyclomatic 16) Packages/OsaurusCore/Services/Router/InboundSharedRunBridge.swift:365 — InboundSharedRunBridge.isUnchangedPrefix 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 · WorkspacesService.migrateShares (cyclomatic 16) · ×1
  • WorkspacesService.migrateShares (cyclomatic 16) Packages/OsaurusCore/Services/Router/WorkspacesService.swift:1056 — WorkspacesService.migrateShares has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: WorkspacesService.message (cyclomatic 30) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · WorkspacesService.pollConfirmation (cyclomatic 16) · ×1
  • WorkspacesService.pollConfirmation (cyclomatic 16) Packages/OsaurusCore/Services/Router/WorkspacesService.swift:1681 — WorkspacesService.pollConfirmation has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: WorkspacesService.message (cyclomatic 30) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SyncConversationMapper.attachment (cyclomatic 16) · ×1
  • SyncConversationMapper.attachment (cyclomatic 16) Packages/OsaurusCore/Services/Sync/SyncConversationMapper.swift:855 — SyncConversationMapper.attachment has cyclomatic complexity 16 (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 · SyncTurnStreamer.tick (cyclomatic 16) · ×1
  • SyncTurnStreamer.tick (cyclomatic 16) Packages/OsaurusCore/Services/Sync/SyncTurnStreamer.swift:75 — SyncTurnStreamer.tick 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 · TelegramConnectionService.processUpdates (cyclomatic 16) · ×1
  • TelegramConnectionService.processUpdates (cyclomatic 16) Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:1070 — TelegramConnectionService.processUpdates 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 · TemplateCascadePlan.make (cyclomatic 16) · ×1
  • TemplateCascadePlan.make (cyclomatic 16) Packages/OsaurusCore/Services/Template/TemplateCascadePlan.swift:107 — TemplateCascadePlan.make 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 · WorkflowDraftTester.reusePlan (cyclomatic 16) · ×1
  • WorkflowDraftTester.reusePlan (cyclomatic 16) Packages/OsaurusCore/Services/Workflow/WorkflowDraftTester.swift:74 — WorkflowDraftTester.reusePlan 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 · AgentDraftTool.patch (cyclomatic 16) · ×1
  • AgentDraftTool.patch (cyclomatic 16) Packages/OsaurusCore/Tools/Agent/AgentDraftTool.swift:179 — AgentDraftTool.patch 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 · WorkflowDiscoverTool.execute (cyclomatic 16) · ×1
  • WorkflowDiscoverTool.execute (cyclomatic 16) Packages/OsaurusCore/Tools/Workflow/WorkflowDiscoverTool.swift:144 — WorkflowDiscoverTool.execute has cyclomatic complexity 16 (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 · WorkflowRunsTool.execute (cyclomatic 16) · ×1
  • WorkflowRunsTool.execute (cyclomatic 16) Packages/OsaurusCore/Tools/Workflow/WorkflowRunsTool.swift:78 — WorkflowRunsTool.execute has cyclomatic complexity 16 (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 · AgentGenerationInheritedValues.resolve (cyclomatic 16) · ×1
  • AgentGenerationInheritedValues.resolve (cyclomatic 16) Packages/OsaurusCore/Views/Agent/AgentGenerationInheritedValues.swift:18 — AgentGenerationInheritedValues.resolve has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 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 · AgentGenerationSettingsEditor.body (cyclomatic 16) · ×1
  • AgentGenerationSettingsEditor.body (cyclomatic 16) Packages/OsaurusCore/Views/Agent/AgentGenerationSettingsEditor.swift:60 — AgentGenerationSettingsEditor.body 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 · AgentsView.body (cyclomatic 16) · ×1
  • AgentsView.body (cyclomatic 16) Packages/OsaurusCore/Views/Agent/AgentsView.swift:103 — AgentsView.body 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 · EmptyStateContent.== (cyclomatic 16) · ×1
  • EmptyStateContent.== (cyclomatic 16) Packages/OsaurusCore/Views/Chat/ChatView.swift:93 — EmptyStateContent.== 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 · FloatingInputCard.checkForSilenceTimeout (cyclomatic 16) · ×1
  • FloatingInputCard.checkForSilenceTimeout (cyclomatic 16) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:1723 — FloatingInputCard.checkForSilenceTimeout 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 · FloatingInputCard.textInputArea (cyclomatic 16) · ×1
  • FloatingInputCard.textInputArea (cyclomatic 16) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:6069 — FloatingInputCard.textInputArea 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 · PasteMonitorView.handlePasteIfImage (cyclomatic 16) · ×1
  • PasteMonitorView.handlePasteIfImage (cyclomatic 16) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:6643 — PasteMonitorView.handlePasteIfImage 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 · VaultSessionSheet.add (cyclomatic 16) · ×1
  • VaultSessionSheet.add (cyclomatic 16) Packages/OsaurusCore/Views/Credentials/VaultAccountsView.swift:573 — VaultSessionSheet.add 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 · SlackSettingsView.body (cyclomatic 16) · ×1
  • SlackSettingsView.body (cyclomatic 16) Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:109 — SlackSettingsView.body 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 · TaskDetailSheet.summary (cyclomatic 16) · ×1
  • TaskDetailSheet.summary (cyclomatic 16) Packages/OsaurusCore/Views/Task/TaskDetailSheet.swift:59 — TaskDetailSheet.summary 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 · TaskPresentation.statusLine (cyclomatic 16) · ×1
  • TaskPresentation.statusLine (cyclomatic 16) Packages/OsaurusCore/Views/Task/TaskRow.swift:49 — TaskPresentation.statusLine 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 · PublishedWorkflowDashboard.whoCanSeeIt (cyclomatic 16) · ×1
  • PublishedWorkflowDashboard.whoCanSeeIt (cyclomatic 16) Packages/OsaurusCore/Views/Template/PublishedWorkflowDashboard.swift:524 — PublishedWorkflowDashboard.whoCanSeeIt 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 · ShareWorkflowSheet.liveView (cyclomatic 16) · ×1
  • ShareWorkflowSheet.liveView (cyclomatic 16) Packages/OsaurusCore/Views/Template/ShareWorkflowSheet.swift:717 — ShareWorkflowSheet.liveView 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 · ShareWorkflowSheet.footer (cyclomatic 16) · ×1
  • ShareWorkflowSheet.footer (cyclomatic 16) Packages/OsaurusCore/Views/Template/ShareWorkflowSheet.swift:957 — ShareWorkflowSheet.footer has cyclomatic complexity 16 (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 · WorkspaceSharedAgentRow.statusText (cyclomatic 16) · ×1
  • WorkspaceSharedAgentRow.statusText (cyclomatic 16) Packages/OsaurusCore/Views/Workspaces/WorkspaceDetailView.swift:1581 — WorkspaceSharedAgentRow.statusText 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 · XLSXFormula.scan · ×1
  • XLSXFormula.scan::readCell (cyclomatic 16) Packages/OsaurusCore/Services/Documents/OOXML/XLSXFormula.swift:79 — XLSXFormula.scan::readCell has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: one other method here (XLSXFormula.scan) 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 · MCPOAuthService.performRefresh (cyclomatic 16) · ×1
  • MCPOAuthService.performRefresh (cyclomatic 16) Packages/OsaurusCore/Services/MCP/OAuth/MCPOAuthService.swift:337 — MCPOAuthService.performRefresh 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 · AgentSetupWizardView.finish (cyclomatic 16) · ×1
  • AgentSetupWizardView.finish (cyclomatic 16) Packages/OsaurusCore/Views/Agent/Setup/AgentSetupWizardView.swift:297 — AgentSetupWizardView.finish 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 · ArchitectSidebarPanel.normalBody (cyclomatic 16) · ×1
  • ArchitectSidebarPanel.normalBody (cyclomatic 16) Packages/OsaurusCore/Views/Workflow/Architect/ArchitectSidebarPanel.swift:68 — ArchitectSidebarPanel.normalBody 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 · DraftStepList.card (cyclomatic 16) · ×1
  • DraftStepList.card (cyclomatic 16) Packages/OsaurusCore/Views/Workflow/Architect/ArchitectSidebarPanel.swift:964 — DraftStepList.card 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 · MediaStepEditor.imageParameters (cyclomatic 16) · ×1
  • MediaStepEditor.imageParameters (cyclomatic 16) Packages/OsaurusCore/Views/Workflow/Architect/MediaStepEditor.swift:215 — MediaStepEditor.imageParameters 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 · WorkflowDetailPage.hero (cyclomatic 16) · ×1
  • WorkflowDetailPage.hero (cyclomatic 16) Packages/OsaurusCore/Views/Workflow/Library/WorkflowDetailPage.swift:112 — WorkflowDetailPage.hero 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 · main.swift.handleRequest (cyclomatic 16) · ×1
  • main.swift.handleRequest (cyclomatic 16) Packages/OsaurusCore/PluginHost/main.swift:473 — main.swift.handleRequest 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 · RemoteProviderEditSheet.swift.parsePastedEndpoint (cyclomatic 16) · ×1
  • RemoteProviderEditSheet.swift.parsePastedEndpoint (cyclomatic 16) Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:52 — RemoteProviderEditSheet.swift.parsePastedEndpoint 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.
D15 · Churn × Complexity Hotspots · Repeated repair · ×1
  • Repeated repair: Packages/OsaurusCore/Views/Common/CodeBlockView.swift Packages/OsaurusCore/Views/Common/CodeBlockView.swift:519 — Packages/OsaurusCore/Views/Common/CodeBlockView.swift changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is CodeNSTextView.draw at line 519), AT OR 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 right-click copy dropping the chat drag selection (#2899)”; “fix theme editor color picker jitter and hex input (#2673)”; “fixed main thread hangs (#2619)”. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 00:30:28 -08:00' --until='2026-11-14 00:30:28 -08:00' --full-history --no-merges -- Packages/OsaurusCore/Views/Common/CodeBlockView.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.
D17 · Explicit Debt · HackComment · ×1
  • HackComment Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalBootstrap.swift:779 — // hack the resolved plan can undo. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
D2 · Cognitive Complexity · AgentToolLoop.runHoldingResidency (cognitive 448) · ×1
  • AgentToolLoop.runHoldingResidency (cognitive 448) Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:2359 — AgentToolLoop.runHoldingResidency has cognitive complexity 448 (threshold 15). Drivers by points: if/else 100 (362 pts), boolean chains 57, loops 6 (21 pts), ternaries 2 (6 pts), match/switch 1 (2 pts) (nesting depth added 282). Of this number, 439 points are the body's own statements and 9 belong to 4 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 · ConfigPlanner.validate (cognitive 406) · ×1
  • ConfigPlanner.validate (cognitive 406) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:423 — ConfigPlanner.validate has cognitive complexity 406 (threshold 15). Drivers by points: if/else 103 (294 pts), loops 22 (54 pts), boolean chains 43, match/switch 2 (7 pts), ternaries 1 (5 pts), error handling 1 (3 pts) (nesting depth added 234). Of this number, 403 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ConfigEvents.build (cognitive 337) · ×1
  • ConfigEvents.build (cognitive 337) Packages/OsaurusCore/Configuration/Declarative/ConfigEvents.swift:383 — ConfigEvents.build has cognitive complexity 337 (threshold 15). Drivers by points: if/else 113 (239 pts), ternaries 15 (41 pts), boolean chains 36, match/switch 5 (13 pts), loops 3 (8 pts) (nesting depth added 165). 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 · HTTPHandler.channelRead (cognitive 319) · ×1
  • HTTPHandler.channelRead (cognitive 319) Packages/OsaurusCore/Networking/HTTPHandler.swift:495 — HTTPHandler.channelRead has cognitive complexity 319 (threshold 15). Drivers by points: if/else 118 (157 pts), boolean chains 145, ternaries 3 (10 pts), match/switch 2 (5 pts), loops 1 (2 pts) (nesting depth added 50). 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 · AppleScriptLoop.run (cognitive 307) · ×1
  • AppleScriptLoop.run (cognitive 307) Packages/OsaurusCore/AppleScript/Loop/AppleScriptLoop.swift:310 — AppleScriptLoop.run has cognitive complexity 307 (threshold 15). Drivers by points: if/else 82 (176 pts), boolean chains 66, ternaries 20 (51 pts), match/switch 4 (11 pts), error handling 1 (2 pts), loops 1 (nesting depth added 133). Of this number, 305 points are the body's own statements and 2 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 · SubagentSession.runPreparedHost (cognitive 292) · ×1
  • SubagentSession.runPreparedHost (cognitive 292) Packages/OsaurusCore/Subagent/SubagentSession.swift:549 — SubagentSession.runPreparedHost has cognitive complexity 292 (threshold 15). Drivers by points: if/else 75 (189 pts), ternaries 17 (54 pts), boolean chains 20, error handling 8 (16 pts), match/switch 4 (13 pts) (nesting depth added 168). 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 · WorkflowValidator.validateNode (cognitive 289) · ×1
  • WorkflowValidator.validateNode (cognitive 289) Packages/OsaurusCore/Models/Workflow/WorkflowValidator.swift:413 — WorkflowValidator.validateNode has cognitive complexity 289 (threshold 15). Drivers by points: if/else 89 (212 pts), boolean chains 32, loops 14 (31 pts), match/switch 6 (11 pts), ternaries 1 (3 pts) (nesting depth added 147). 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 · HTTPHandler.handleAgentRunEndpoint (cognitive 279) · ×1
  • HTTPHandler.handleAgentRunEndpoint (cognitive 279) Packages/OsaurusCore/Networking/HTTPHandler.swift:10496 — HTTPHandler.handleAgentRunEndpoint has cognitive complexity 279 (threshold 15). Drivers by points: if/else 121 (167 pts), boolean chains 47, ternaries 30 (46 pts), loops 7 (11 pts), error handling 3 (4 pts), match/switch 3 (4 pts) (nesting depth added 68). Of this number, 270 points are the body's own statements and 9 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClaudePluginInstaller.install (cognitive 219) · ×1
  • ClaudePluginInstaller.install (cognitive 219) Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:221 — ClaudePluginInstaller.install has cognitive complexity 219 (threshold 15). Drivers by points: if/else 26 (120 pts), loops 12 (51 pts), ternaries 4 (18 pts), match/switch 4 (14 pts), boolean chains 12, error handling 1 (4 pts) (nesting depth added 160). 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 · ChatSession.processStreamDeltas (cognitive 218) · ×1
  • ChatSession.processStreamDeltas (cognitive 218) Packages/OsaurusCore/Views/Chat/ChatView.swift:6167 — ChatSession.processStreamDeltas has cognitive complexity 218 (threshold 15). Drivers by points: if/else 61 (162 pts), ternaries 7 (21 pts), boolean chains 14, match/switch 3 (12 pts), loops 2 (8 pts), error handling 1 (nesting depth added 130). 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 · CapabilityClaimsEvaluator.runConversation (cognitive 203) · ×1
  • CapabilityClaimsEvaluator.runConversation (cognitive 203) Packages/OsaurusCore/Services/Context/CapabilityClaimsEvaluator.swift:215 — CapabilityClaimsEvaluator.runConversation has cognitive complexity 203 (threshold 15). Drivers by points: if/else 42 (127 pts), ternaries 15 (29 pts), boolean chains 23, loops 4 (11 pts), error handling 4 (10 pts), match/switch 1 (3 pts) (nesting depth added 114). Of this number, 195 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigApplier.applyMCPServers (cognitive 199) · ×1
  • ConfigApplier.applyMCPServers (cognitive 199) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:1636 — ConfigApplier.applyMCPServers has cognitive complexity 199 (threshold 15). Drivers by points: if/else 46 (140 pts), ternaries 8 (28 pts), loops 6 (17 pts), boolean chains 11, match/switch 1 (3 pts) (nesting depth added 127). 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 · SystemPromptComposer.resolveTools (cognitive 188) · ×1
  • SystemPromptComposer.resolveTools (cognitive 188) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:2766 — SystemPromptComposer.resolveTools has cognitive complexity 188 (threshold 15). Drivers by points: if/else 65 (112 pts), loops 21 (44 pts), boolean chains 27, ternaries 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 72). Of this number, 184 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 · RemoteProviderService._streamRemote (cognitive 188) · ×1
  • RemoteProviderService._streamRemote (cognitive 188) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:2946 — RemoteProviderService._streamRemote has cognitive complexity 188 (threshold 15). Drivers by points: if/else 45 (143 pts), boolean chains 18, loops 5 (16 pts), error handling 3 (9 pts), ternaries 2 (nesting depth added 115). 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 · XLSXEditor.shiftRows (cognitive 185) · ×1
  • XLSXEditor.shiftRows (cognitive 185) Packages/OsaurusCore/Services/Documents/OOXML/XLSXEditor.swift:328 — XLSXEditor.shiftRows has cognitive complexity 185 (threshold 15). Drivers by points: if/else 54 (105 pts), loops 26 (40 pts), boolean chains 30, ternaries 7 (10 pts) (nesting depth added 68). Of this number, 182 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 · ComputerUseLoop.run (cognitive 172) · ×1
  • ComputerUseLoop.run (cognitive 172) Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:209 — ComputerUseLoop.run has cognitive complexity 172 (threshold 15). Drivers by points: if/else 51 (132 pts), match/switch 4 (14 pts), boolean chains 9, error handling 4 (9 pts), ternaries 3 (7 pts), loops 1 (nesting depth added 100). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OsaurusBundle.load (cognitive 169) · ×1
  • OsaurusBundle.load (cognitive 169) Packages/OsaurusRepository/OsaurusBundle.swift:379 — OsaurusBundle.load has cognitive complexity 169 (threshold 15). Drivers by points: if/else 66 (124 pts), loops 14 (21 pts), boolean chains 14, error handling 5 (7 pts), match/switch 1 (2 pts), ternaries 1 (nesting depth added 68). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatView.chatModeContent (cognitive 163) · ×1
  • ChatView.chatModeContent (cognitive 163) Packages/OsaurusCore/Views/Chat/ChatView.swift:11698 — ChatView.chatModeContent has cognitive complexity 163 (threshold 15). Drivers by points: if/else 58 (94 pts), ternaries 30 (44 pts), boolean chains 23, loops 1 (2 pts) (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ContentBlock.generateBlocks (cognitive 160) · ×1
  • ContentBlock.generateBlocks (cognitive 160) Packages/OsaurusCore/Models/Chat/ContentBlock.swift:646 — ContentBlock.generateBlocks has cognitive complexity 160 (threshold 15). Drivers by points: boolean chains 72, if/else 30 (61 pts), ternaries 8 (20 pts), loops 3 (7 pts) (nesting depth added 47). Of this number, 157 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 · EvalRunner.runAgentLoopCaseWithSettings (cognitive 138) · ×1
  • EvalRunner.runAgentLoopCaseWithSettings (cognitive 138) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerAgentLoop.swift:33 — EvalRunner.runAgentLoopCaseWithSettings has cognitive complexity 138 (threshold 15). Drivers by points: if/else 54 (77 pts), boolean chains 27, loops 15 (20 pts), ternaries 5 (7 pts), match/switch 2 (4 pts), error handling 2 (3 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TokenizerBridge.applyChatTemplate (cognitive 137) · ×1
  • TokenizerBridge.applyChatTemplate (cognitive 137) Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.swift:211 — TokenizerBridge.applyChatTemplate has cognitive complexity 137 (threshold 15). Drivers by points: boolean chains 76, if/else 30 (40 pts), ternaries 4 (10 pts), error handling 5 (9 pts), loops 1 (2 pts) (nesting depth added 21). Of this number, 135 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 · MarkdownBlockParsing.swift.parseBlocks (cognitive 135) · ×1
  • MarkdownBlockParsing.swift.parseBlocks (cognitive 135) Packages/OsaurusCore/Utils/MarkdownBlockParsing.swift:151 — MarkdownBlockParsing.swift.parseBlocks has cognitive complexity 135 (threshold 15). Drivers by points: if/else 33 (88 pts), loops 8 (22 pts), boolean chains 18, ternaries 3 (7 pts) (nesting depth added 73). Of this number, 125 points are the body's own statements and 10 belong to 4 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 · ChatEngine.completeChat (cognitive 132) · ×1
  • ChatEngine.completeChat (cognitive 132) Packages/OsaurusCore/Services/Chat/ChatEngine.swift:1832 — ChatEngine.completeChat has cognitive complexity 132 (threshold 15). Drivers by points: if/else 19 (72 pts), ternaries 10 (33 pts), boolean chains 14, error handling 2 (6 pts), loops 2 (6 pts), match/switch 1 (nesting depth added 84). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelDownloadService.runOrchestration (cognitive 125) · ×1
  • ModelDownloadService.runOrchestration (cognitive 125) Packages/OsaurusCore/Services/ModelDownloadService.swift:381 — ModelDownloadService.runOrchestration has cognitive complexity 125 (threshold 15). Drivers by points: if/else 35 (80 pts), ternaries 7 (17 pts), boolean chains 12, loops 3 (7 pts), match/switch 2 (6 pts), error handling 3 (nesting depth added 63). 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 · HTTPHandler.handleChatCompletions (cognitive 123) · ×1
  • HTTPHandler.handleChatCompletions (cognitive 123) Packages/OsaurusCore/Networking/HTTPHandler.swift:15297 — HTTPHandler.handleChatCompletions has cognitive complexity 123 (threshold 15). Drivers by points: if/else 34 (86 pts), loops 4 (12 pts), boolean chains 8, match/switch 2 (7 pts), error handling 3 (5 pts), ternaries 2 (5 pts) (nesting depth added 70). Of this number, 119 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · SystemPromptComposer.appendGatedSections (cognitive 123) · ×1
  • SystemPromptComposer.appendGatedSections (cognitive 123) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:972 — SystemPromptComposer.appendGatedSections has cognitive complexity 123 (threshold 15). Drivers by points: if/else 45 (70 pts), boolean chains 30, ternaries 8 (21 pts), loops 1 (2 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 · ChatEngine.wrapStreamWithLogging (cognitive 121) · ×1
  • ChatEngine.wrapStreamWithLogging (cognitive 121) Packages/OsaurusCore/Services/Chat/ChatEngine.swift:1376 — ChatEngine.wrapStreamWithLogging has cognitive complexity 121 (threshold 15). Drivers by points: if/else 38 (100 pts), boolean chains 11, ternaries 2 (4 pts), error handling 3, loops 1 (2 pts), match/switch 1 (nesting depth added 65). Of this number, 119 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ModelRuntime.loadContainer (cognitive 116) · ×1
  • ModelRuntime.loadContainer (cognitive 116) Packages/OsaurusCore/Services/ModelRuntime.swift:4841 — ModelRuntime.loadContainer has cognitive complexity 116 (threshold 15). Drivers by points: if/else 39 (83 pts), error handling 8 (16 pts), boolean chains 11, ternaries 2 (4 pts), loops 2 (nesting depth added 54). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HTTPHandler.handleOpenResponsesStreaming (cognitive 115) · ×1
  • HTTPHandler.handleOpenResponsesStreaming (cognitive 115) Packages/OsaurusCore/Networking/HTTPHandler.swift:18604 — HTTPHandler.handleOpenResponsesStreaming has cognitive complexity 115 (threshold 15). Drivers by points: if/else 28 (78 pts), boolean chains 11, ternaries 4 (10 pts), match/switch 2 (6 pts), error handling 2 (5 pts), loops 2 (5 pts) (nesting depth added 66). Of this number, 112 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocalVisionEvidence.read (cognitive 112) · ×1
  • LocalVisionEvidence.read (cognitive 112) Packages/OsaurusCore/Models/Configuration/LocalVisionEvidence.swift:136 — LocalVisionEvidence.read has cognitive complexity 112 (threshold 15). Drivers by points: if/else 38 (56 pts), boolean chains 44, ternaries 4 (7 pts), error handling 3 (5 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentLoopEvaluator.runConversation (cognitive 110) · ×1
  • AgentLoopEvaluator.runConversation (cognitive 110) Packages/OsaurusCore/Services/Context/AgentLoopEvaluator.swift:715 — AgentLoopEvaluator.runConversation has cognitive complexity 110 (threshold 15). Drivers by points: if/else 42 (59 pts), boolean chains 21, ternaries 17, error handling 4 (6 pts), loops 3 (4 pts), match/switch 2 (3 pts) (nesting depth added 21). Of this number, 78 points are the body's own statements and 32 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, 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 · AgentTaskState.record (cognitive 109) · ×1
  • AgentTaskState.record (cognitive 109) Packages/OsaurusCore/Services/Chat/AgentTaskState.swift:662 — AgentTaskState.record has cognitive complexity 109 (threshold 15). Drivers by points: if/else 40 (58 pts), boolean chains 33, ternaries 8 (15 pts), loops 1 (2 pts), match/switch 1 (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 · EvalRunner.runCacheProofCase (cognitive 108) · ×1
  • EvalRunner.runCacheProofCase (cognitive 108) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerCacheProof.swift:158 — EvalRunner.runCacheProofCase has cognitive complexity 108 (threshold 15). Drivers by points: if/else 49 (56 pts), boolean chains 32, ternaries 8 (14 pts), loops 5, match/switch 1 (nesting depth added 13). Of this number, 105 points are the body's own statements and 3 belong to 2 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 · ImageGenerationService.drive (cognitive 108) · ×1
  • ImageGenerationService.drive (cognitive 108) Packages/OsaurusCore/Services/ModelRuntime/ImageGenerationService.swift:724 — ImageGenerationService.drive has cognitive complexity 108 (threshold 15). Drivers by points: if/else 33 (84 pts), error handling 4 (7 pts), boolean chains 6, loops 2 (5 pts), match/switch 1 (4 pts), ternaries 1 (2 pts) (nesting depth added 61). Of this number, 104 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · NativeMessageCellView.configureAsUserMessage (cognitive 108) · ×1
  • NativeMessageCellView.configureAsUserMessage (cognitive 108) Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2996 — NativeMessageCellView.configureAsUserMessage has cognitive complexity 108 (threshold 15). Drivers by points: if/else 36 (64 pts), boolean chains 20, loops 6 (12 pts), ternaries 7 (12 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 · ConfigPlanner.planMCPServers (cognitive 107) · ×1
  • ConfigPlanner.planMCPServers (cognitive 107) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2115 — ConfigPlanner.planMCPServers has cognitive complexity 107 (threshold 15). Drivers by points: if/else 22 (71 pts), loops 6 (18 pts), boolean chains 12, match/switch 1 (3 pts), ternaries 1 (3 pts) (nesting depth added 65). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RemoteChatRequest.toOpenResponsesRequest (cognitive 107) · ×1
  • RemoteChatRequest.toOpenResponsesRequest (cognitive 107) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:6050 — RemoteChatRequest.toOpenResponsesRequest has cognitive complexity 107 (threshold 15). Drivers by points: if/else 32 (68 pts), boolean chains 16, loops 3 (9 pts), match/switch 3 (9 pts), ternaries 4 (5 pts) (nesting depth added 49). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CalculatorNode.exactInteger (cognitive 106) · ×1
  • CalculatorNode.exactInteger (cognitive 106) Packages/OsaurusCore/Utils/CalculatorEngine.swift:360 — CalculatorNode.exactInteger has cognitive complexity 106 (threshold 15). Drivers by points: if/else 19 (51 pts), ternaries 11 (32 pts), loops 4 (11 pts), boolean chains 7, match/switch 3 (5 pts) (nesting depth added 62). 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 · GenerationEventMapper.map (cognitive 104) · ×1
  • GenerationEventMapper.map (cognitive 104) Packages/OsaurusCore/Services/ModelRuntime/GenerationEventMapper.swift:67 — GenerationEventMapper.map has cognitive complexity 104 (threshold 15). Drivers by points: if/else 33 (74 pts), boolean chains 15, ternaries 6 (12 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 48). Of this number, 94 points are the body's own statements and 10 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NativeCellHeightEstimator.estimatedHeight (cognitive 102) · ×1
  • NativeCellHeightEstimator.estimatedHeight (cognitive 102) Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:4290 — NativeCellHeightEstimator.estimatedHeight has cognitive complexity 102 (threshold 15). Drivers by points: if/else 31 (65 pts), ternaries 8 (20 pts), boolean chains 12, loops 2 (4 pts), match/switch 1 (nesting depth added 48). 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 · OpenAPISummary.parse (cognitive 99) · ×1
  • OpenAPISummary.parse (cognitive 99) Packages/OsaurusCore/Tools/Workflow/WorkflowDiscoverTool.swift:626 — OpenAPISummary.parse has cognitive complexity 99 (threshold 15). Drivers by points: if/else 25 (66 pts), boolean chains 16, loops 5 (11 pts), ternaries 2 (6 pts) (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileReadTool.readResolved (cognitive 98) · ×1
  • FileReadTool.readResolved (cognitive 98) Packages/OsaurusCore/Folder/FolderTools.swift:1535 — FileReadTool.readResolved has cognitive complexity 98 (threshold 15). Drivers by points: if/else 48 (65 pts), boolean chains 18, ternaries 3 (7 pts), error handling 2 (4 pts), loops 2, match/switch 1 (2 pts) (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 · SetupChecker.check (cognitive 95) · ×1
  • SetupChecker.check (cognitive 95) Packages/OsaurusCore/Services/Template/SetupChecker.swift:398 — SetupChecker.check has cognitive complexity 95 (threshold 15). Drivers by points: if/else 27 (53 pts), boolean chains 15, ternaries 6 (15 pts), loops 8 (9 pts), match/switch 1 (3 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SyncManageFeed.perform (cognitive 93) · ×1
  • SyncManageFeed.perform (cognitive 93) Packages/OsaurusCore/Services/Sync/SyncManageFeed.swift:550 — SyncManageFeed.perform has cognitive complexity 93 (threshold 15). Drivers by points: if/else 22 (47 pts), error handling 7 (17 pts), boolean chains 11, match/switch 4 (10 pts), ternaries 3 (8 pts) (nesting depth added 46). Of this number, 92 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 · EvalRunner.runToolResultGroundingCase (cognitive 91) · ×1
  • EvalRunner.runToolResultGroundingCase (cognitive 91) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerToolResultGrounding.swift:14 — EvalRunner.runToolResultGroundingCase has cognitive complexity 91 (threshold 15). Drivers by points: if/else 34 (73 pts), loops 7 (13 pts), boolean chains 3, ternaries 2 (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SearchAndExtractTool.enrichedResults (cognitive 91) · ×1
  • SearchAndExtractTool.enrichedResults (cognitive 91) Packages/OsaurusCore/Tools/WebSearchTools.swift:650 — SearchAndExtractTool.enrichedResults has cognitive complexity 91 (threshold 15). Drivers by points: if/else 22 (69 pts), boolean chains 15, ternaries 1 (6 pts), loops 1 (nesting depth added 52). 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 · RemoteChatRequest.toGeminiRequest (cognitive 91) · ×1
  • RemoteChatRequest.toGeminiRequest (cognitive 91) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:5622 — RemoteChatRequest.toGeminiRequest has cognitive complexity 91 (threshold 15). Drivers by points: if/else 23 (57 pts), boolean chains 18, loops 3 (9 pts), match/switch 2 (4 pts), ternaries 3 (nesting depth added 42). Of this number, 90 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 · HTTPHandler.handlePluginRoute (cognitive 89) · ×1
  • HTTPHandler.handlePluginRoute (cognitive 89) Packages/OsaurusCore/Networking/HTTPHandler.swift:2959 — HTTPHandler.handlePluginRoute has cognitive complexity 89 (threshold 15). Drivers by points: if/else 32 (64 pts), boolean chains 11, ternaries 2 (8 pts), loops 2 (4 pts), error handling 1, match/switch 1 (nesting depth added 40). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ToolRegistry.runPermissionGate (cognitive 87) · ×1
  • ToolRegistry.runPermissionGate (cognitive 87) Packages/OsaurusCore/Tools/ToolRegistry.swift:982 — ToolRegistry.runPermissionGate has cognitive complexity 87 (threshold 15). Drivers by points: if/else 30 (59 pts), boolean chains 12, loops 2 (6 pts), match/switch 2 (6 pts), ternaries 1 (4 pts) (nesting depth added 40). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ToolRegistry.execute (cognitive 87) · ×1
  • ToolRegistry.execute (cognitive 87) Packages/OsaurusCore/Tools/ToolRegistry.swift:1251 — ToolRegistry.execute has cognitive complexity 87 (threshold 15). Drivers by points: if/else 30 (48 pts), boolean chains 20, ternaries 6 (18 pts), match/switch 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DesignWorkingStore.validate (cognitive 86) · ×1
  • DesignWorkingStore.validate (cognitive 86) Packages/OsaurusCore/DevelopmentDesign/DesignWorkingStore.swift:309 — DesignWorkingStore.validate has cognitive complexity 86 (threshold 15). Drivers by points: if/else 18 (44 pts), boolean chains 30, loops 5 (12 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MediaNodeExecutor.settings (cognitive 85) · ×1
  • MediaNodeExecutor.settings (cognitive 85) Packages/OsaurusCore/Services/Workflow/MediaNodeExecutor.swift:961 — MediaNodeExecutor.settings has cognitive complexity 85 (threshold 15). Drivers by points: if/else 37 (70 pts), boolean chains 13, ternaries 2 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelRowCellView.configure (cognitive 83) · ×1
  • ModelRowCellView.configure (cognitive 83) Packages/OsaurusCore/Views/Model/ModelPickerTableRepresentable.swift:556 — ModelRowCellView.configure has cognitive complexity 83 (threshold 15). Drivers by points: if/else 36 (46 pts), boolean chains 23, ternaries 5 (10 pts), match/switch 2 (4 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 · ChatImportApplier.apply (cognitive 82) · ×1
  • ChatImportApplier.apply (cognitive 82) Packages/OsaurusCore/Services/ChatImport/ChatImportApplier.swift:55 — ChatImportApplier.apply has cognitive complexity 82 (threshold 15). Drivers by points: if/else 18 (34 pts), ternaries 7 (16 pts), loops 9 (14 pts), boolean chains 10, error handling 3 (6 pts), match/switch 1 (2 pts) (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Functions.call (cognitive 80) · ×1
  • Functions.call (cognitive 80) Packages/OsaurusCore/Utils/CalculatorEngine.swift:700 — Functions.call has cognitive complexity 80 (threshold 15). Drivers by points: if/else 24 (49 pts), ternaries 10 (18 pts), loops 3 (8 pts), boolean chains 4, match/switch 1 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PDFEditor.fillForm (cognitive 80) · ×1
  • PDFEditor.fillForm (cognitive 80) Packages/OsaurusCore/Services/Documents/PDFEditor.swift:346 — PDFEditor.fillForm has cognitive complexity 80 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 8 (23 pts), ternaries 6 (19 pts), boolean chains 7, match/switch 3 (7 pts) (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AppDelegate.applicationDidFinishLaunching (cognitive 79) · ×1
  • AppDelegate.applicationDidFinishLaunching (cognitive 79) Packages/OsaurusCore/AppDelegate.swift:178 — AppDelegate.applicationDidFinishLaunching has cognitive complexity 79 (threshold 15). Drivers by points: if/else 43 (52 pts), boolean chains 10, error handling 5 (7 pts), loops 4 (7 pts), ternaries 2 (3 pts) (nesting depth added 15). 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 · Solver.polynomial (cognitive 79) · ×1
  • Solver.polynomial (cognitive 79) Packages/OsaurusCore/Utils/CalculatorEngine.swift:892 — Solver.polynomial has cognitive complexity 79 (threshold 15). Drivers by points: if/else 18 (45 pts), loops 4 (11 pts), boolean chains 10, ternaries 3 (10 pts), match/switch 2 (3 pts) (nesting depth added 42). Of this number, 75 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 · MLXBatchAdapter.additionalContext (cognitive 79) · ×1
  • MLXBatchAdapter.additionalContext (cognitive 79) Packages/OsaurusCore/Services/ModelRuntime/MLXBatchAdapter.swift:1320 — MLXBatchAdapter.additionalContext has cognitive complexity 79 (threshold 15). Drivers by points: if/else 37 (49 pts), boolean chains 12, match/switch 3 (8 pts), ternaries 3 (7 pts), loops 1 (3 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CompatibilityReport.formatMarkdown (cognitive 78) · ×1
  • CompatibilityReport.formatMarkdown (cognitive 78) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCompat.swift:187 — CompatibilityReport.formatMarkdown has cognitive complexity 78 (threshold 15). Drivers by points: if/else 20 (49 pts), loops 8 (16 pts), ternaries 3 (8 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RenderChartTool.execute (cognitive 77) · ×1
  • RenderChartTool.execute (cognitive 77) Packages/OsaurusCore/Tools/RenderChartTool.swift:141 — RenderChartTool.execute has cognitive complexity 77 (threshold 15). Drivers by points: if/else 33 (45 pts), ternaries 6 (13 pts), boolean chains 12, loops 3 (4 pts), match/switch 1 (2 pts), error handling 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 · XLSXFormula.scan (cognitive 77) · ×1
  • XLSXFormula.scan (cognitive 77) Packages/OsaurusCore/Services/Documents/OOXML/XLSXFormula.swift:69 — XLSXFormula.scan has cognitive complexity 77 (threshold 15). Drivers by points: if/else 17 (40 pts), boolean chains 25, loops 6 (12 pts) (nesting depth added 29). Of this number, 54 points are the body's own statements and 23 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 · WorkflowDraftOp.parse (cognitive 76) · ×1
  • WorkflowDraftOp.parse (cognitive 76) Packages/OsaurusCore/Models/Workflow/WorkflowDraft.swift:355 — WorkflowDraftOp.parse has cognitive complexity 76 (threshold 15). Drivers by points: if/else 27 (55 pts), boolean chains 12, error handling 4, match/switch 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 30). Of this number, 70 points are the body's own statements and 6 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 · ChatView.setupKeyMonitor (cognitive 76) · ×1
  • ChatView.setupKeyMonitor (cognitive 76) Packages/OsaurusCore/Views/Chat/ChatView.swift:13538 — ChatView.setupKeyMonitor has cognitive complexity 76 (threshold 15). Drivers by points: if/else 27 (57 pts), boolean chains 17, loops 1 (2 pts) (nesting depth added 31). 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 · ZipArchive.entries (cognitive 75) · ×1
  • ZipArchive.entries (cognitive 75) Packages/OsaurusCore/Utils/ZipArchive.swift:67 — ZipArchive.entries has cognitive complexity 75 (threshold 15). Drivers by points: if/else 19 (61 pts), boolean chains 9, loops 3 (5 pts) (nesting depth added 44). 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 · SharedArtifact.resolveSourcePathDetailed (cognitive 75) · ×1
  • SharedArtifact.resolveSourcePathDetailed (cognitive 75) Packages/OsaurusCore/Models/Chat/SharedArtifact.swift:776 — SharedArtifact.resolveSourcePathDetailed has cognitive complexity 75 (threshold 15). Drivers by points: if/else 20 (57 pts), ternaries 2 (7 pts), loops 2 (6 pts), boolean chains 4, match/switch 1 (nesting depth added 46). 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 · WorkflowDraftPatcher.apply (cognitive 75) · ×1
  • WorkflowDraftPatcher.apply (cognitive 75) Packages/OsaurusCore/Models/Workflow/WorkflowDraft.swift:558 — WorkflowDraftPatcher.apply has cognitive complexity 75 (threshold 15). Drivers by points: if/else 20 (52 pts), loops 4 (11 pts), boolean chains 7, ternaries 1 (3 pts), match/switch 1 (2 pts) (nesting depth added 42). Of this number, 74 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 · CacheProofEvaluator.runConversation (cognitive 75) · ×1
  • CacheProofEvaluator.runConversation (cognitive 75) Packages/OsaurusCore/Services/Context/CacheProofEvaluator.swift:304 — CacheProofEvaluator.runConversation has cognitive complexity 75 (threshold 15). Drivers by points: if/else 20 (38 pts), boolean chains 10, ternaries 5 (10 pts), error handling 3 (8 pts), match/switch 3 (8 pts), loops 1 (nesting depth added 33). Of this number, 70 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 · PendingImportProcessor.install (cognitive 75) · ×1
  • PendingImportProcessor.install (cognitive 75) Packages/OsaurusCore/Services/Import/PendingImportProcessor.swift:524 — PendingImportProcessor.install has cognitive complexity 75 (threshold 15). Drivers by points: if/else 17 (33 pts), ternaries 11 (21 pts), boolean chains 13, error handling 3 (4 pts), match/switch 3 (4 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CatalogLibraryFixture.activityContent (cognitive 74) · ×1
  • CatalogLibraryFixture.activityContent (cognitive 74) Packages/OsaurusCore/DevelopmentDesign/CatalogComponents.swift:559 — CatalogLibraryFixture.activityContent has cognitive complexity 74 (threshold 15). Drivers by points: ternaries 27 (54 pts), if/else 9 (17 pts), boolean chains 2, match/switch 1 (nesting depth added 35). 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 · SchemaValidator.validateValue (cognitive 74) · ×1
  • SchemaValidator.validateValue (cognitive 74) Packages/OsaurusCore/Tools/SchemaValidator.swift:178 — SchemaValidator.validateValue has cognitive complexity 74 (threshold 15). Drivers by points: if/else 26 (60 pts), boolean chains 8, loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RemoteAnthropicNativeStream.consume (cognitive 74) · ×1
  • RemoteAnthropicNativeStream.consume (cognitive 74) Packages/OsaurusCore/Services/Provider/RemoteAnthropicNativeStream.swift:38 — RemoteAnthropicNativeStream.consume has cognitive complexity 74 (threshold 15). Drivers by points: if/else 24 (53 pts), boolean chains 9, match/switch 4 (7 pts), loops 2 (5 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RemoteProviderService.buildChatRequest (cognitive 74) · ×1
  • RemoteProviderService.buildChatRequest (cognitive 74) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:3466 — RemoteProviderService.buildChatRequest has cognitive complexity 74 (threshold 15). Drivers by points: boolean chains 27, if/else 20 (24 pts), ternaries 19 (20 pts), loops 1 (3 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Skill.parseYaml (cognitive 73) · ×1
  • Skill.parseYaml (cognitive 73) Packages/OsaurusCore/Models/Agent/Skill.swift:672 — Skill.parseYaml has cognitive complexity 73 (threshold 15). Drivers by points: if/else 20 (53 pts), loops 4 (12 pts), boolean chains 8 (nesting depth added 41). 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 · RemoteResponsesNativeStream.consume (cognitive 73) · ×1
  • RemoteResponsesNativeStream.consume (cognitive 73) Packages/OsaurusCore/Services/Provider/RemoteResponsesNativeStream.swift:26 — RemoteResponsesNativeStream.consume has cognitive complexity 73 (threshold 15). Drivers by points: if/else 27 (53 pts), boolean chains 10, loops 2 (6 pts), ternaries 1 (3 pts), match/switch 1 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BoundedArchiveExtractor.inspect (cognitive 72) · ×1
  • BoundedArchiveExtractor.inspect (cognitive 72) Packages/OsaurusRepository/BoundedArchiveExtractor.swift:139 — BoundedArchiveExtractor.inspect has cognitive complexity 72 (threshold 15). Drivers by points: if/else 29 (49 pts), boolean chains 20, error handling 2, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileSearchTool.execute (cognitive 72) · ×1
  • FileSearchTool.execute (cognitive 72) Packages/OsaurusCore/Folder/FolderTools.swift:4846 — FileSearchTool.execute has cognitive complexity 72 (threshold 15). Drivers by points: if/else 31 (52 pts), ternaries 4 (7 pts), boolean chains 6, match/switch 2 (5 pts), loops 1 (2 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SafeDiskCachePurge.clear (cognitive 72) · ×1
  • SafeDiskCachePurge.clear (cognitive 72) Packages/OsaurusCore/Services/SafeDiskCachePurge.swift:13 — SafeDiskCachePurge.clear has cognitive complexity 72 (threshold 15). Drivers by points: if/else 18 (42 pts), boolean chains 21, loops 4 (8 pts), error handling 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigPlanner.planAgents (cognitive 71) · ×1
  • ConfigPlanner.planAgents (cognitive 71) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1471 — ConfigPlanner.planAgents has cognitive complexity 71 (threshold 15). Drivers by points: if/else 20 (55 pts), ternaries 2 (7 pts), boolean chains 6, loops 2 (3 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 · PrivacyFilterPipeline.applyOutbound (cognitive 71) · ×1
  • PrivacyFilterPipeline.applyOutbound (cognitive 71) Packages/OsaurusCore/PrivacyFilter/Core/PrivacyFilterPipeline.swift:333 — PrivacyFilterPipeline.applyOutbound has cognitive complexity 71 (threshold 15). Drivers by points: if/else 27 (44 pts), error handling 3 (11 pts), loops 4 (7 pts), match/switch 3 (4 pts), ternaries 2 (3 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 · RemoteChatRequest.toAnthropicRequest (cognitive 71) · ×1
  • RemoteChatRequest.toAnthropicRequest (cognitive 71) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:5366 — RemoteChatRequest.toAnthropicRequest has cognitive complexity 71 (threshold 15). Drivers by points: if/else 17 (41 pts), match/switch 3 (9 pts), loops 3 (8 pts), boolean chains 7, ternaries 5 (6 pts) (nesting depth added 36). Of this number, 70 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 · CatalogLibraryFixture.baseContent (cognitive 70) · ×1
  • CatalogLibraryFixture.baseContent (cognitive 70) Packages/OsaurusCore/DevelopmentDesign/CatalogComponents.swift:394 — CatalogLibraryFixture.baseContent has cognitive complexity 70 (threshold 15). Drivers by points: ternaries 25 (56 pts), if/else 7 (12 pts), boolean chains 1, match/switch 1 (nesting depth added 36). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · RemoteProviderManager.testConnection (cognitive 70) · ×1
  • RemoteProviderManager.testConnection (cognitive 70) Packages/OsaurusCore/Managers/RemoteProviderManager.swift:1682 — RemoteProviderManager.testConnection has cognitive complexity 70 (threshold 15). Drivers by points: if/else 22 (48 pts), error handling 7 (15 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NativeToolCallRowView.configure (cognitive 70) · ×1
  • NativeToolCallRowView.configure (cognitive 70) Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:1094 — NativeToolCallRowView.configure has cognitive complexity 70 (threshold 15). Drivers by points: if/else 31 (43 pts), boolean chains 20, ternaries 2 (5 pts), match/switch 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.
D2 · Cognitive Complexity · ConfigChannelPlatform.apply (cognitive 69) · ×1
  • ConfigChannelPlatform.apply (cognitive 69) Packages/OsaurusCore/Configuration/Declarative/ConfigChannelDetails.swift:87 — ConfigChannelPlatform.apply has cognitive complexity 69 (threshold 15). Drivers by points: if/else 33 (66 pts), boolean chains 2, match/switch 1 (nesting depth added 33). 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 · EvalMatrixBuilder.build (cognitive 68) · ×1
  • EvalMatrixBuilder.build (cognitive 68) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalMatrix.swift:811 — EvalMatrixBuilder.build has cognitive complexity 68 (threshold 15). Drivers by points: ternaries 21 (23 pts), boolean chains 18, if/else 8 (15 pts), loops 8 (12 pts) (nesting depth added 13). Of this number, 67 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 · EvalRunner.scoreSpawnWave (cognitive 68) · ×1
  • EvalRunner.scoreSpawnWave (cognitive 68) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerAgentLoop.swift:1615 — EvalRunner.scoreSpawnWave has cognitive complexity 68 (threshold 15). Drivers by points: if/else 23 (47 pts), boolean chains 14, loops 3 (7 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HTTPHandler.handleConfigAdminEndpoint (cognitive 68) · ×1
  • HTTPHandler.handleConfigAdminEndpoint (cognitive 68) Packages/OsaurusCore/Networking/HTTPHandler.swift:2307 — HTTPHandler.handleConfigAdminEndpoint has cognitive complexity 68 (threshold 15). Drivers by points: if/else 22 (39 pts), error handling 5 (10 pts), boolean chains 9, match/switch 4 (9 pts), ternaries 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RemoteProviderService.buildURLRequest (cognitive 67) · ×1
  • RemoteProviderService.buildURLRequest (cognitive 67) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:4101 — RemoteProviderService.buildURLRequest has cognitive complexity 67 (threshold 15). Drivers by points: if/else 34 (48 pts), boolean chains 12, ternaries 3 (5 pts), loops 1, match/switch 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 · EvalRunner.runAppleScriptCase (cognitive 65) · ×1
  • EvalRunner.runAppleScriptCase (cognitive 65) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerAppleScript.swift:36 — EvalRunner.runAppleScriptCase has cognitive complexity 65 (threshold 15). Drivers by points: if/else 20 (35 pts), loops 10 (13 pts), ternaries 7 (13 pts), boolean chains 4 (nesting depth added 24). Of this number, 63 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 · ModelRuntime.unloadClaimed (cognitive 65) · ×1
  • ModelRuntime.unloadClaimed (cognitive 65) Packages/OsaurusCore/Services/ModelRuntime.swift:2435 — ModelRuntime.unloadClaimed has cognitive complexity 65 (threshold 15). Drivers by points: if/else 32 (49 pts), boolean chains 16 (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 · OsaurusInspectTool.describeItem (cognitive 65) · ×1
  • OsaurusInspectTool.describeItem (cognitive 65) Packages/OsaurusCore/Tools/ConfigurationTools.swift:1280 — OsaurusInspectTool.describeItem has cognitive complexity 65 (threshold 15). Drivers by points: if/else 30 (48 pts), boolean chains 10, match/switch 3 (4 pts), ternaries 1 (2 pts), error handling 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentChannelCustomJSONRunner.execute (cognitive 65) · ×1
  • AgentChannelCustomJSONRunner.execute (cognitive 65) Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:539 — AgentChannelCustomJSONRunner.execute has cognitive complexity 65 (threshold 15). Drivers by points: if/else 22 (37 pts), ternaries 9 (18 pts), error handling 5, boolean chains 3, match/switch 1 (2 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 · AssignedPickerHostingView.applyRecipe · ×1
  • AssignedPickerHostingView.applyRecipe::visit (cognitive 65) Packages/OsaurusCore/Models/Theme/InspectionAdapters/AssignedNativePicker.swift:239 — AssignedPickerHostingView.applyRecipe::visit has cognitive complexity 65 (threshold 15). Drivers by points: if/else 21 (53 pts), loops 3 (7 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 38). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · OsaurusBundle.select (cognitive 63) · ×1
  • OsaurusBundle.select (cognitive 63) Packages/OsaurusRepository/OsaurusBundle.swift:930 — OsaurusBundle.select has cognitive complexity 63 (threshold 15). Drivers by points: if/else 16 (34 pts), boolean chains 12, loops 6 (10 pts), match/switch 2 (6 pts), ternaries 1 (nesting depth added 26). Of this number, 58 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 · ActivityExportService.renderMarkdown (cognitive 63) · ×1
  • ActivityExportService.renderMarkdown (cognitive 63) Packages/OsaurusCore/Services/Insights/ActivityExportService.swift:222 — ActivityExportService.renderMarkdown has cognitive complexity 63 (threshold 15). Drivers by points: if/else 15 (30 pts), ternaries 6 (13 pts), loops 6 (12 pts), boolean chains 8 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAICompatibleStreamParser.processChoice (cognitive 63) · ×1
  • OpenAICompatibleStreamParser.processChoice (cognitive 63) Packages/OsaurusCore/Services/Provider/OpenAICompatibleStreamParser.swift:645 — OpenAICompatibleStreamParser.processChoice has cognitive complexity 63 (threshold 15). Drivers by points: if/else 16 (41 pts), boolean chains 11, match/switch 2 (6 pts), loops 2 (5 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RedactFileTool.execute (cognitive 62) · ×1
  • RedactFileTool.execute (cognitive 62) Packages/OsaurusCore/Folder/RedactionTools.swift:272 — RedactFileTool.execute has cognitive complexity 62 (threshold 15). Drivers by points: if/else 28 (44 pts), boolean chains 8, loops 5 (7 pts), match/switch 2, ternaries 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 · AgentChannelInboundRelay.deliverReply (cognitive 62) · ×1
  • AgentChannelInboundRelay.deliverReply (cognitive 62) Packages/OsaurusCore/Services/AgentChannel/AgentChannelInboundRelay.swift:670 — AgentChannelInboundRelay.deliverReply has cognitive complexity 62 (threshold 15). Drivers by points: ternaries 9 (26 pts), if/else 6 (18 pts), error handling 3 (11 pts), loops 1 (4 pts), boolean chains 2, match/switch 1 (nesting depth added 40). 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 · HTTPHandler.handleCompletions (cognitive 61) · ×1
  • HTTPHandler.handleCompletions (cognitive 61) Packages/OsaurusCore/Networking/HTTPHandler.swift:14835 — HTTPHandler.handleCompletions has cognitive complexity 61 (threshold 15). Drivers by points: if/else 17 (41 pts), ternaries 5 (10 pts), loops 2 (5 pts), error handling 2 (3 pts), boolean chains 2 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentDelegationDispatcher.run (cognitive 61) · ×1
  • AgentDelegationDispatcher.run (cognitive 61) Packages/OsaurusCore/Services/AgentDelegation/AgentDelegationDispatcher.swift:506 — AgentDelegationDispatcher.run has cognitive complexity 61 (threshold 15). Drivers by points: if/else 19 (42 pts), ternaries 6, match/switch 3 (5 pts), boolean chains 4, loops 2 (4 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 · KnowledgeSearchService.search (cognitive 61) · ×1
  • KnowledgeSearchService.search (cognitive 61) Packages/OsaurusCore/Services/Knowledge/KnowledgeSearchService.swift:214 — KnowledgeSearchService.search has cognitive complexity 61 (threshold 15). Drivers by points: if/else 11 (36 pts), loops 5 (18 pts), error handling 2 (4 pts), boolean chains 3 (nesting depth added 40). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · CatalogElementAssignments.extendMappings (cognitive 61) · ×1
  • CatalogElementAssignments.extendMappings (cognitive 61) Packages/OsaurusCore/Models/Theme/DesignLibrary/CatalogElementAssignments.swift:65 — CatalogElementAssignments.extendMappings has cognitive complexity 61 (threshold 15). Drivers by points: if/else 10 (27 pts), loops 14 (21 pts), ternaries 3 (10 pts), boolean chains 3 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigApplier.applyProviders (cognitive 60) · ×1
  • ConfigApplier.applyProviders (cognitive 60) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:2060 — ConfigApplier.applyProviders has cognitive complexity 60 (threshold 15). Drivers by points: if/else 14 (44 pts), boolean chains 10, loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RequestLog.title (cognitive 60) · ×1
  • RequestLog.title (cognitive 60) Packages/OsaurusCore/Models/Chat/RequestLog.swift:889 — RequestLog.title has cognitive complexity 60 (threshold 15). Drivers by points: if/else 14 (26 pts), ternaries 10 (21 pts), match/switch 4 (8 pts), boolean chains 5 (nesting depth added 27). 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 · OsaurusEvalsCLI.runCommand (cognitive 59) · ×1
  • OsaurusEvalsCLI.runCommand (cognitive 59) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/OsaurusEvalsCLI.swift:148 — OsaurusEvalsCLI.runCommand has cognitive complexity 59 (threshold 15). Drivers by points: if/else 19 (39 pts), error handling 5 (10 pts), loops 2 (6 pts), boolean chains 3, ternaries 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JSONSchemaValidator.check (cognitive 59) · ×1
  • JSONSchemaValidator.check (cognitive 59) Packages/OsaurusCore/Models/Workflow/JSONSchemaValidator.swift:67 — JSONSchemaValidator.check has cognitive complexity 59 (threshold 15). Drivers by points: if/else 20 (33 pts), boolean chains 12, loops 4 (9 pts), match/switch 2 (5 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RemoteProviderService.handleOpenResponsesEvent (cognitive 59) · ×1
  • RemoteProviderService.handleOpenResponsesEvent (cognitive 59) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:2427 — RemoteProviderService.handleOpenResponsesEvent has cognitive complexity 59 (threshold 15). Drivers by points: if/else 18 (37 pts), boolean chains 14, match/switch 3 (6 pts), ternaries 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MCPProviderManager.performConnect (cognitive 58) · ×1
  • MCPProviderManager.performConnect (cognitive 58) Packages/OsaurusCore/Managers/MCPProviderManager.swift:307 — MCPProviderManager.performConnect has cognitive complexity 58 (threshold 15). Drivers by points: if/else 16 (43 pts), boolean chains 6, error handling 2 (5 pts), loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 32). 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 · ShellCommandRiskScanner.parse (cognitive 57) · ×1
  • ShellCommandRiskScanner.parse (cognitive 57) Packages/OsaurusCore/Tools/ShellCommandRiskScanner.swift:330 — ShellCommandRiskScanner.parse has cognitive complexity 57 (threshold 15). Drivers by points: if/else 17 (35 pts), boolean chains 11, loops 3 (7 pts), match/switch 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 24). Of this number, 55 points are the body's own statements and 2 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 · EvalRunner.runDefaultAgentCase (cognitive 56) · ×1
  • EvalRunner.runDefaultAgentCase (cognitive 56) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:1760 — EvalRunner.runDefaultAgentCase has cognitive complexity 56 (threshold 15). Drivers by points: if/else 27 (33 pts), boolean chains 10, loops 5 (7 pts), ternaries 3 (4 pts), error handling 1 (2 pts) (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, 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 · ModelRuntime.bridgeToolEventStream (cognitive 56) · ×1
  • ModelRuntime.bridgeToolEventStream (cognitive 56) Packages/OsaurusCore/Services/ModelRuntime.swift:6743 — ModelRuntime.bridgeToolEventStream has cognitive complexity 56 (threshold 15). Drivers by points: if/else 17 (46 pts), match/switch 1 (3 pts), boolean chains 2, error handling 2, loops 1 (2 pts), ternaries 1 (nesting depth added 32). Of this number, 53 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 · RetainedToolResultStore.read (cognitive 56) · ×1
  • RetainedToolResultStore.read (cognitive 56) Packages/OsaurusCore/Storage/RetainedToolResultStore.swift:199 — RetainedToolResultStore.read has cognitive complexity 56 (threshold 15). Drivers by points: if/else 12 (29 pts), boolean chains 13, ternaries 4 (9 pts), loops 2 (4 pts), error handling 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PendingImportProcessor.prepare (cognitive 56) · ×1
  • PendingImportProcessor.prepare (cognitive 56) Packages/OsaurusCore/Services/Import/PendingImportProcessor.swift:260 — PendingImportProcessor.prepare has cognitive complexity 56 (threshold 15). Drivers by points: if/else 12 (23 pts), error handling 6 (12 pts), ternaries 5 (11 pts), boolean chains 7, match/switch 2 (3 pts) (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 · WorkflowStepRisk.badges (cognitive 56) · ×1
  • WorkflowStepRisk.badges (cognitive 56) Packages/OsaurusCore/Services/Workflow/WorkflowTrust.swift:94 — WorkflowStepRisk.badges has cognitive complexity 56 (threshold 15). Drivers by points: if/else 26 (34 pts), ternaries 7 (14 pts), boolean chains 4, match/switch 3 (4 pts) (nesting depth added 16). Of this number, 39 points are the body's own statements and 17 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatSession.init (cognitive 56) · ×1
  • ChatSession.init (cognitive 56) Packages/OsaurusCore/Views/Chat/ChatView.swift:1090 — ChatSession.init has cognitive complexity 56 (threshold 15). Drivers by points: if/else 32 (35 pts), boolean chains 19, 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 · NativeMarkdownView.applyMixedSegments (cognitive 56) · ×1
  • NativeMarkdownView.applyMixedSegments (cognitive 56) Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:997 — NativeMarkdownView.applyMixedSegments has cognitive complexity 56 (threshold 15). Drivers by points: if/else 21 (41 pts), boolean chains 6, ternaries 2 (6 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RunCommand.execute (cognitive 55) · ×1
  • RunCommand.execute (cognitive 55) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Run.swift:13 — RunCommand.execute has cognitive complexity 55 (threshold 15). Drivers by points: if/else 12 (34 pts), loops 3 (9 pts), error handling 3 (8 pts), boolean chains 4 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAICompatibleTTSClient.synthesizeStreaming (cognitive 55) · ×1
  • OpenAICompatibleTTSClient.synthesizeStreaming (cognitive 55) Packages/OsaurusCore/Managers/OpenAICompatibleTTSClient.swift:234 — OpenAICompatibleTTSClient.synthesizeStreaming has cognitive complexity 55 (threshold 15). Drivers by points: if/else 13 (37 pts), loops 3 (8 pts), boolean chains 5, match/switch 1 (4 pts), error handling 1 (nesting depth added 32). Of this number, 53 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 · AgentChannelConnectionService.actionStatus (cognitive 55) · ×1
  • AgentChannelConnectionService.actionStatus (cognitive 55) Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1739 — AgentChannelConnectionService.actionStatus has cognitive complexity 55 (threshold 15). Drivers by points: if/else 16 (42 pts), match/switch 3 (5 pts), boolean chains 4, ternaries 1 (4 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DBImportTool.execute (cognitive 55) · ×1
  • DBImportTool.execute (cognitive 55) Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:1239 — DBImportTool.execute has cognitive complexity 55 (threshold 15). Drivers by points: if/else 17 (35 pts), error handling 3 (6 pts), boolean chains 5, ternaries 2 (5 pts), loops 1 (3 pts), match/switch 1 (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 · PromotionGate.evaluate (cognitive 54) · ×1
  • PromotionGate.evaluate (cognitive 54) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/PromotionGate.swift:47 — PromotionGate.evaluate has cognitive complexity 54 (threshold 15). Drivers by points: if/else 18 (31 pts), boolean chains 15, ternaries 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 · ModelRuntime.decodeWAVAudioSamples (cognitive 54) · ×1
  • ModelRuntime.decodeWAVAudioSamples (cognitive 54) Packages/OsaurusCore/Services/ModelRuntime.swift:7779 — ModelRuntime.decodeWAVAudioSamples has cognitive complexity 54 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 22, loops 3 (4 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 · ComputerUseLoop.act (cognitive 54) · ×1
  • ComputerUseLoop.act (cognitive 54) Packages/OsaurusCore/ComputerUse/Loop/ComputerUseLoop.swift:1334 — ComputerUseLoop.act has cognitive complexity 54 (threshold 15). Drivers by points: if/else 26 (36 pts), match/switch 4 (7 pts), ternaries 4 (6 pts), boolean chains 5 (nesting depth added 15). Of this number, 52 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 · FolderContextService.buildFileTree · ×1
  • FolderContextService.buildFileTree::traverse (cognitive 53) Packages/OsaurusCore/Folder/FolderContextService.swift:266 — FolderContextService.buildFileTree::traverse has cognitive complexity 53 (threshold 15). Drivers by points: if/else 15 (29 pts), ternaries 5 (15 pts), loops 3 (6 pts), boolean chains 3 (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 · FileEditTool.editDocument (cognitive 52) · ×1
  • FileEditTool.editDocument (cognitive 52) Packages/OsaurusCore/Folder/FolderTools.swift:3999 — FileEditTool.editDocument has cognitive complexity 52 (threshold 15). Drivers by points: if/else 14 (20 pts), ternaries 6 (17 pts), boolean chains 10, loops 1 (3 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 · PluginHostContext.httpRequest (cognitive 52) · ×1
  • PluginHostContext.httpRequest (cognitive 52) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:2665 — PluginHostContext.httpRequest has cognitive complexity 52 (threshold 15). Drivers by points: if/else 17 (37 pts), loops 3 (7 pts), boolean chains 4, error handling 2, match/switch 1 (2 pts) (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 · WorkflowNodeEditor.form (cognitive 52) · ×1
  • WorkflowNodeEditor.form (cognitive 52) Packages/OsaurusCore/Views/Workflow/Architect/WorkflowNodeEditor.swift:90 — WorkflowNodeEditor.form has cognitive complexity 52 (threshold 15). Drivers by points: if/else 18 (40 pts), ternaries 3 (9 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HTTPHandler.handleAnthropicMessagesStreaming (cognitive 51) · ×1
  • HTTPHandler.handleAnthropicMessagesStreaming (cognitive 51) Packages/OsaurusCore/Networking/HTTPHandler.swift:17931 — HTTPHandler.handleAnthropicMessagesStreaming has cognitive complexity 51 (threshold 15). Drivers by points: if/else 13 (26 pts), loops 4 (11 pts), match/switch 2 (5 pts), boolean chains 4, ternaries 2 (4 pts), error handling 1 (nesting depth added 25). Of this number, 41 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 · ModelPickerItem.generateMockModels (cognitive 51) · ×1
  • ModelPickerItem.generateMockModels (cognitive 51) Packages/OsaurusCore/Models/Configuration/ModelPickerItem.swift:1043 — ModelPickerItem.generateMockModels has cognitive complexity 51 (threshold 15). Drivers by points: if/else 6 (21 pts), loops 9 (18 pts), ternaries 2 (10 pts), boolean chains 2 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowValidator.mediaIssues (cognitive 51) · ×1
  • WorkflowValidator.mediaIssues (cognitive 51) Packages/OsaurusCore/Models/Workflow/WorkflowValidator.swift:754 — WorkflowValidator.mediaIssues has cognitive complexity 51 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 18, loops 3 (5 pts), match/switch 2 (nesting depth added 10). Of this number, 47 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 · ChatSession.runHarnessTurn (cognitive 51) · ×1
  • ChatSession.runHarnessTurn (cognitive 51) Packages/OsaurusCore/Views/Chat/ChatSession+Harness.swift:34 — ChatSession.runHarnessTurn has cognitive complexity 51 (threshold 15). Drivers by points: if/else 18 (35 pts), boolean chains 5, ternaries 2 (4 pts), match/switch 1 (3 pts), error handling 2, loops 1 (2 pts) (nesting depth added 22). Of this number, 47 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 · EvalMatrix.formatMarkdown (cognitive 50) · ×1
  • EvalMatrix.formatMarkdown (cognitive 50) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalMatrix.swift:389 — EvalMatrix.formatMarkdown has cognitive complexity 50 (threshold 15). Drivers by points: if/else 17 (33 pts), loops 7 (14 pts), boolean chains 3 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatImportMCPBuilder.item (cognitive 50) · ×1
  • ChatImportMCPBuilder.item (cognitive 50) Packages/OsaurusCore/Services/ChatImport/ChatImportFastPaths.swift:405 — ChatImportMCPBuilder.item has cognitive complexity 50 (threshold 15). Drivers by points: if/else 16 (34 pts), boolean chains 8, loops 3 (6 pts), ternaries 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 · WorkflowFlowCanvas.draw (cognitive 50) · ×1
  • WorkflowFlowCanvas.draw (cognitive 50) Packages/OsaurusCore/Views/Workflow/FlowViewer/WorkflowFlowCanvas.swift:270 — WorkflowFlowCanvas.draw has cognitive complexity 50 (threshold 15). Drivers by points: ternaries 9 (19 pts), if/else 8 (14 pts), boolean chains 11, loops 4 (6 pts) (nesting depth added 18). Of this number, 43 points are the body's own statements and 7 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 · ConfigCommand.runPlanOrApply (cognitive 49) · ×1
  • ConfigCommand.runPlanOrApply (cognitive 49) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Config.swift:149 — ConfigCommand.runPlanOrApply has cognitive complexity 49 (threshold 15). Drivers by points: if/else 21 (33 pts), loops 4 (7 pts), boolean chains 3, ternaries 2 (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 · AppDelegate.updateStatusItemAndMenu (cognitive 49) · ×1
  • AppDelegate.updateStatusItemAndMenu (cognitive 49) Packages/OsaurusCore/AppDelegate.swift:2125 — AppDelegate.updateStatusItemAndMenu has cognitive complexity 49 (threshold 15). Drivers by points: if/else 15 (40 pts), match/switch 2 (5 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 30). 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 · PluginHostContext.completeStream (cognitive 49) · ×1
  • PluginHostContext.completeStream (cognitive 49) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1820 — PluginHostContext.completeStream has cognitive complexity 49 (threshold 15). Drivers by points: if/else 29 (35 pts), boolean chains 4, ternaries 2 (4 pts), loops 3, match/switch 1 (2 pts), error handling 1 (nesting depth added 9). 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 · WorkflowTestTool.runExamples (cognitive 49) · ×1
  • WorkflowTestTool.runExamples (cognitive 49) Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift:806 — WorkflowTestTool.runExamples has cognitive complexity 49 (threshold 15). Drivers by points: if/else 21 (41 pts), loops 3 (4 pts), boolean chains 2, match/switch 1, ternaries 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 · WorkspaceAuditRow.subtitle (cognitive 49) · ×1
  • WorkspaceAuditRow.subtitle (cognitive 49) Packages/OsaurusCore/Views/Workspaces/WorkspaceAuditView.swift:439 — WorkspaceAuditRow.subtitle has cognitive complexity 49 (threshold 15). Drivers by points: if/else 18 (34 pts), boolean chains 10, ternaries 2 (4 pts), 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 · AccessibilityManager.traverseElement (cognitive 49) · ×1
  • AccessibilityManager.traverseElement (cognitive 49) Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:769 — AccessibilityManager.traverseElement has cognitive complexity 49 (threshold 15). Drivers by points: boolean chains 23, if/else 14 (19 pts), ternaries 3 (5 pts), 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 · CatalogLibraryFixture.chatContent (cognitive 48) · ×1
  • CatalogLibraryFixture.chatContent (cognitive 48) Packages/OsaurusCore/DevelopmentDesign/CatalogComponents.swift:489 — CatalogLibraryFixture.chatContent has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 13 (28 pts), if/else 10 (16 pts), boolean chains 3, match/switch 1 (nesting depth added 21). 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 · RemoteProviderManager.connect (cognitive 48) · ×1
  • RemoteProviderManager.connect (cognitive 48) Packages/OsaurusCore/Managers/RemoteProviderManager.swift:409 — RemoteProviderManager.connect has cognitive complexity 48 (threshold 15). Drivers by points: if/else 18 (37 pts), boolean chains 6, error handling 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 21). 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 · Tokenizer.number (cognitive 48) · ×1
  • Tokenizer.number (cognitive 48) Packages/OsaurusCore/Utils/CalculatorEngine.swift:277 — Tokenizer.number has cognitive complexity 48 (threshold 15). Drivers by points: boolean chains 23, if/else 12 (18 pts), loops 3 (6 pts), ternaries 1 (nesting depth added 9). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · DispatchEnvelope.badges (cognitive 48) · ×1
  • DispatchEnvelope.badges (cognitive 48) Packages/OsaurusCore/Models/Chat/DispatchEnvelope.swift:456 — DispatchEnvelope.badges has cognitive complexity 48 (threshold 15). Drivers by points: if/else 12 (24 pts), ternaries 9 (22 pts), boolean chains 1, match/switch 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 · ImageGenerationService.generateVideo (cognitive 48) · ×1
  • ImageGenerationService.generateVideo (cognitive 48) Packages/OsaurusCore/Services/ModelRuntime/ImageGenerationService.swift:323 — ImageGenerationService.generateVideo has cognitive complexity 48 (threshold 15). Drivers by points: if/else 13 (31 pts), ternaries 2 (7 pts), boolean chains 4, match/switch 1 (3 pts), loops 1 (2 pts), error handling 1 (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 · RemoteProviderService.parseResponse (cognitive 47) · ×1
  • RemoteProviderService.parseResponse (cognitive 47) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:4840 — RemoteProviderService.parseResponse has cognitive complexity 47 (threshold 15). Drivers by points: match/switch 5 (16 pts), ternaries 6 (12 pts), loops 4 (11 pts), if/else 3 (8 pts) (nesting depth added 29). 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 · SyncConversationMapper.fitTurnObject (cognitive 47) · ×1
  • SyncConversationMapper.fitTurnObject (cognitive 47) Packages/OsaurusCore/Services/Sync/SyncConversationMapper.swift:384 — SyncConversationMapper.fitTurnObject has cognitive complexity 47 (threshold 15). Drivers by points: if/else 13 (30 pts), loops 6 (10 pts), boolean chains 7 (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 · FileWriteTool.execute (cognitive 46) · ×1
  • FileWriteTool.execute (cognitive 46) Packages/OsaurusCore/Folder/FolderTools.swift:2766 — FileWriteTool.execute has cognitive complexity 46 (threshold 15). Drivers by points: if/else 25 (34 pts), match/switch 3 (6 pts), boolean chains 5, ternaries 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 · SpeechService.startStreamingTranscription (cognitive 46) · ×1
  • SpeechService.startStreamingTranscription (cognitive 46) Packages/OsaurusCore/Managers/SpeechService.swift:925 — SpeechService.startStreamingTranscription has cognitive complexity 46 (threshold 15). Drivers by points: if/else 19 (34 pts), boolean chains 7, error handling 2 (4 pts), ternaries 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocalGenerationDefaults.repairLagunaXS21TopKIfNeeded (cognitive 46) · ×1
  • LocalGenerationDefaults.repairLagunaXS21TopKIfNeeded (cognitive 46) Packages/OsaurusCore/Services/LocalGenerationDefaults.swift:160 — LocalGenerationDefaults.repairLagunaXS21TopKIfNeeded has cognitive complexity 46 (threshold 15). Drivers by points: if/else 21 (38 pts), error handling 3 (5 pts), boolean chains 2, loops 1 (nesting depth added 19). Of this number, 42 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 · ToolEnvelope.fromError (cognitive 46) · ×1
  • ToolEnvelope.fromError (cognitive 46) Packages/OsaurusCore/Tools/ToolEnvelope.swift:222 — ToolEnvelope.fromError has cognitive complexity 46 (threshold 15). Drivers by points: if/else 15 (31 pts), match/switch 4 (8 pts), ternaries 2 (7 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 · ConfigApplier.applyChannels (cognitive 46) · ×1
  • ConfigApplier.applyChannels (cognitive 46) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:1482 — ConfigApplier.applyChannels has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (34 pts), ternaries 2 (6 pts), error handling 2 (4 pts), loops 2 (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 · PrivacyFilterEngine.detect (cognitive 46) · ×1
  • PrivacyFilterEngine.detect (cognitive 46) Packages/OsaurusCore/PrivacyFilter/Core/PrivacyFilterEngine.swift:176 — PrivacyFilterEngine.detect has cognitive complexity 46 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 6 (13 pts), error handling 1 (4 pts), match/switch 2 (4 pts), boolean chains 2, ternaries 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatImportVerifier.verify (cognitive 46) · ×1
  • ChatImportVerifier.verify (cognitive 46) Packages/OsaurusCore/Services/ChatImport/ChatImportVerifier.swift:25 — ChatImportVerifier.verify has cognitive complexity 46 (threshold 15). Drivers by points: if/else 16 (32 pts), loops 6, boolean chains 4, ternaries 2 (4 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HTTPNodeExecutor.paginated (cognitive 46) · ×1
  • HTTPNodeExecutor.paginated (cognitive 46) Packages/OsaurusCore/Services/Workflow/HTTPNodeExecutor.swift:296 — HTTPNodeExecutor.paginated has cognitive complexity 46 (threshold 15). Drivers by points: if/else 18 (36 pts), boolean chains 6, match/switch 1 (2 pts), loops 1, ternaries 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatSession.finalizeRun (cognitive 46) · ×1
  • ChatSession.finalizeRun (cognitive 46) Packages/OsaurusCore/Views/Chat/ChatView.swift:5881 — ChatSession.finalizeRun has cognitive complexity 46 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 18, error handling 2 (6 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 · ChatModelPickerCard.modelColumn (cognitive 46) · ×1
  • ChatModelPickerCard.modelColumn (cognitive 46) Packages/OsaurusCore/Views/Model/ChatModelPickerCard.swift:538 — ChatModelPickerCard.modelColumn has cognitive complexity 46 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 13, ternaries 7 (13 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 · XLSXEditor.renameSheet (cognitive 46) · ×1
  • XLSXEditor.renameSheet (cognitive 46) Packages/OsaurusCore/Services/Documents/OOXML/XLSXEditor.swift:725 — XLSXEditor.renameSheet has cognitive complexity 46 (threshold 15). Drivers by points: if/else 11 (28 pts), loops 7 (12 pts), ternaries 4, boolean chains 2 (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 · EvalRunner.score (cognitive 45) · ×1
  • EvalRunner.score (cognitive 45) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:858 — EvalRunner.score has cognitive complexity 45 (threshold 15). Drivers by points: if/else 27 (29 pts), boolean chains 11, loops 2 (3 pts), ternaries 2 (nesting depth added 3). Of this number, 43 points are the body's own statements and 2 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 · BackgroundTaskManager.dispatchChat (cognitive 45) · ×1
  • BackgroundTaskManager.dispatchChat (cognitive 45) Packages/OsaurusCore/Managers/BackgroundTaskManager.swift:1111 — BackgroundTaskManager.dispatchChat has cognitive complexity 45 (threshold 15). Drivers by points: if/else 25 (28 pts), boolean chains 9, ternaries 4 (5 pts), error handling 2 (3 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 · ReadKnowledgeTool.execute (cognitive 45) · ×1
  • ReadKnowledgeTool.execute (cognitive 45) Packages/OsaurusCore/Tools/KnowledgeTools.swift:451 — ReadKnowledgeTool.execute has cognitive complexity 45 (threshold 15). Drivers by points: if/else 24 (32 pts), boolean chains 8, ternaries 2 (3 pts), 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 · OsaurusConfigTool.applyDocument (cognitive 45) · ×1
  • OsaurusConfigTool.applyDocument (cognitive 45) Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool.swift:468 — OsaurusConfigTool.applyDocument has cognitive complexity 45 (threshold 15). Drivers by points: if/else 22 (26 pts), boolean chains 10, ternaries 2 (6 pts), error handling 2, 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 · AnthropicMessagesRequest.toChatCompletionRequest (cognitive 45) · ×1
  • AnthropicMessagesRequest.toChatCompletionRequest (cognitive 45) Packages/OsaurusCore/Models/API/AnthropicAPI.swift:1017 — AnthropicMessagesRequest.toChatCompletionRequest has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 5 (16 pts), if/else 8 (13 pts), match/switch 4 (9 pts), loops 3 (7 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 · LocalAgentBridge.scheduleNextRun (cognitive 45) · ×1
  • LocalAgentBridge.scheduleNextRun (cognitive 45) Packages/OsaurusCore/Services/AgentBridge/LocalAgentBridge.swift:516 — LocalAgentBridge.scheduleNextRun has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (35 pts), boolean chains 10 (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 · FoundationModelService.dynamicSchema (cognitive 45) · ×1
  • FoundationModelService.dynamicSchema (cognitive 45) Packages/OsaurusCore/Services/Inference/FoundationModelService.swift:671 — FoundationModelService.dynamicSchema has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (31 pts), match/switch 3 (6 pts), boolean chains 4, loops 1 (4 pts) (nesting depth added 23). 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 · MemorySearchService.searchTranscript (cognitive 45) · ×1
  • MemorySearchService.searchTranscript (cognitive 45) Packages/OsaurusCore/Services/Memory/MemorySearchService.swift:443 — MemorySearchService.searchTranscript has cognitive complexity 45 (threshold 15). Drivers by points: if/else 9 (29 pts), loops 3 (11 pts), error handling 2 (3 pts), boolean chains 2 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MemoryService.performDistillSession (cognitive 45) · ×1
  • MemoryService.performDistillSession (cognitive 45) Packages/OsaurusCore/Services/Memory/MemoryService.swift:829 — MemoryService.performDistillSession has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (20 pts), ternaries 5 (10 pts), error handling 6 (8 pts), match/switch 2 (5 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NativeToolCallRowView.applyAssignedLayout (cognitive 45) · ×1
  • NativeToolCallRowView.applyAssignedLayout (cognitive 45) Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:1421 — NativeToolCallRowView.applyAssignedLayout has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (28 pts), boolean chains 15, 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 · ServeCommand.execute (cognitive 44) · ×1
  • ServeCommand.execute (cognitive 44) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Serve.swift:13 — ServeCommand.execute has cognitive complexity 44 (threshold 15). Drivers by points: if/else 20 (34 pts), boolean chains 8, 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 · EvalRunner.runComputerUseLoopCase (cognitive 44) · ×1
  • EvalRunner.runComputerUseLoopCase (cognitive 44) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerComputerUseLoop.swift:21 — EvalRunner.runComputerUseLoopCase has cognitive complexity 44 (threshold 15). Drivers by points: if/else 20 (24 pts), ternaries 7 (12 pts), loops 5, boolean chains 3 (nesting depth added 9). Of this number, 42 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 · EvalRunner.runPromptSurfaceCase (cognitive 44) · ×1
  • EvalRunner.runPromptSurfaceCase (cognitive 44) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerPromptSurface.swift:19 — EvalRunner.runPromptSurfaceCase has cognitive complexity 44 (threshold 15). Drivers by points: if/else 25 (30 pts), ternaries 4 (6 pts), loops 5, boolean chains 2, error handling 1 (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 · CatalogAssignmentMenu.allows (cognitive 44) · ×1
  • CatalogAssignmentMenu.allows (cognitive 44) Packages/OsaurusCore/Models/Theme/DesignLibrary/CatalogPreviewInspection.swift:117 — CatalogAssignmentMenu.allows has cognitive complexity 44 (threshold 15). Drivers by points: boolean chains 22, if/else 12 (18 pts), ternaries 2 (4 pts) (nesting depth added 8). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ToolsInstall.installManual (cognitive 43) · ×1
  • ToolsInstall.installManual (cognitive 43) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsInstall.swift:72 — ToolsInstall.installManual has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (19 pts), error handling 7 (14 pts), loops 2 (7 pts), boolean chains 3 (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 · EvalRunner.runCapabilityClaimsCase (cognitive 43) · ×1
  • EvalRunner.runCapabilityClaimsCase (cognitive 43) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:1392 — EvalRunner.runCapabilityClaimsCase has cognitive complexity 43 (threshold 15). Drivers by points: if/else 26 (32 pts), boolean chains 7, ternaries 2 (3 pts), loops 1 (nesting depth added 7). 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, 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 · ModelRuntime.attentionLayerMix (cognitive 43) · ×1
  • ModelRuntime.attentionLayerMix (cognitive 43) Packages/OsaurusCore/Services/ModelRuntime.swift:3808 — ModelRuntime.attentionLayerMix has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 14, match/switch 2 (6 pts), loops 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ListKnowledgeTool.execute (cognitive 43) · ×1
  • ListKnowledgeTool.execute (cognitive 43) Packages/OsaurusCore/Tools/KnowledgeTools.swift:726 — ListKnowledgeTool.execute has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (28 pts), ternaries 5 (9 pts), boolean chains 5, 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 · OsaurusConfigDocument.translatingLegacyEvents (cognitive 43) · ×1
  • OsaurusConfigDocument.translatingLegacyEvents (cognitive 43) Packages/OsaurusCore/Configuration/Declarative/ConfigEvents.swift:1285 — OsaurusConfigDocument.translatingLegacyEvents has cognitive complexity 43 (threshold 15). Drivers by points: if/else 20 (35 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 17). Of this number, 40 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 · LocalVisionEvidence.tensorPayloadSizes (cognitive 43) · ×1
  • LocalVisionEvidence.tensorPayloadSizes (cognitive 43) Packages/OsaurusCore/Models/Configuration/LocalVisionEvidence.swift:459 — LocalVisionEvidence.tensorPayloadSizes has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 19, 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 · ResponsesItemPayload.transform (cognitive 43) · ×1
  • ResponsesItemPayload.transform (cognitive 43) Packages/OsaurusCore/PrivacyFilter/Core/MessageScrubbing.swift:488 — ResponsesItemPayload.transform has cognitive complexity 43 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 17, loops 1 (2 pts), match/switch 1 (nesting depth added 14). 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 · MLXBatchAdapter.generate (cognitive 43) · ×1
  • MLXBatchAdapter.generate (cognitive 43) Packages/OsaurusCore/Services/ModelRuntime/MLXBatchAdapter.swift:1643 — MLXBatchAdapter.generate has cognitive complexity 43 (threshold 15). Drivers by points: if/else 23 (31 pts), boolean chains 4, error handling 4, ternaries 2 (3 pts), loops 1 (nesting depth added 9). 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 · SyncConversationStore.saveTurns (cognitive 43) · ×1
  • SyncConversationStore.saveTurns (cognitive 43) Packages/OsaurusCore/Services/Sync/SyncConversationStore.swift:392 — SyncConversationStore.saveTurns has cognitive complexity 43 (threshold 15). Drivers by points: if/else 10 (25 pts), boolean chains 10, loops 4, error handling 1 (2 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 · ChatSession.send (cognitive 43) · ×1
  • ChatSession.send (cognitive 43) Packages/OsaurusCore/Views/Chat/ChatView.swift:7367 — ChatSession.send has cognitive complexity 43 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 18, ternaries 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 · ImageGenerationPanelView.run (cognitive 43) · ×1
  • ImageGenerationPanelView.run (cognitive 43) Packages/OsaurusCore/Views/Model/ImageGenerationPanelView.swift:728 — ImageGenerationPanelView.run has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 16 (30 pts), if/else 6 (8 pts), boolean chains 5 (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 · OOXMLText.replace (cognitive 43) · ×1
  • OOXMLText.replace (cognitive 43) Packages/OsaurusCore/Services/Documents/OOXML/OOXMLText.swift:269 — OOXMLText.replace has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (24 pts), loops 7 (12 pts), boolean chains 4, ternaries 2 (3 pts) (nesting depth added 16). Of this number, 34 points are the body's own statements and 9 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ImportCommand.parse (cognitive 42) · ×1
  • ImportCommand.parse (cognitive 42) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Import/ImportCommand.swift:185 — ImportCommand.parse has cognitive complexity 42 (threshold 15). Drivers by points: if/else 20 (29 pts), boolean chains 8, match/switch 3 (4 pts), loops 1 (nesting depth added 10). Of this number, 38 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 · HTTPHandler.parseMultipartFormData (cognitive 42) · ×1
  • HTTPHandler.parseMultipartFormData (cognitive 42) Packages/OsaurusCore/Networking/HTTPHandler.swift:19013 — HTTPHandler.parseMultipartFormData has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (37 pts), loops 3 (4 pts), boolean chains 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 · ShellCommandRiskScanner.downloadSources (cognitive 42) · ×1
  • ShellCommandRiskScanner.downloadSources (cognitive 42) Packages/OsaurusCore/Tools/ShellCommandRiskScanner.swift:241 — ShellCommandRiskScanner.downloadSources has cognitive complexity 42 (threshold 15). Drivers by points: if/else 10 (26 pts), boolean chains 13, match/switch 1 (2 pts), loops 1 (nesting depth added 17). Of this number, 41 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 · ConfigApplier.applyAgents (cognitive 42) · ×1
  • ConfigApplier.applyAgents (cognitive 42) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:581 — ConfigApplier.applyAgents has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (25 pts), ternaries 4 (12 pts), loops 2 (3 pts), boolean chains 2 (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 · ConfigYAML.walk (cognitive 42) · ×1
  • ConfigYAML.walk (cognitive 42) Packages/OsaurusCore/Configuration/Declarative/ConfigYAML.swift:160 — ConfigYAML.walk has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (28 pts), loops 4 (9 pts), boolean chains 4, match/switch 1 (nesting depth added 22). 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 · OpenAIPromptBuilder.buildPrompt (cognitive 42) · ×1
  • OpenAIPromptBuilder.buildPrompt (cognitive 42) Packages/OsaurusCore/Services/Chat/PromptBuilder.swift:13 — OpenAIPromptBuilder.buildPrompt has cognitive complexity 42 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 4 (9 pts), boolean chains 7, match/switch 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DocumentEditService.structure (cognitive 42) · ×1
  • DocumentEditService.structure (cognitive 42) Packages/OsaurusCore/Services/Documents/DocumentEditService.swift:237 — DocumentEditService.structure has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (32 pts), loops 2 (7 pts), boolean chains 2, match/switch 1 (nesting depth added 24). 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 · AssignedNativeMenuItems.body (cognitive 42) · ×1
  • AssignedNativeMenuItems.body (cognitive 42) Packages/OsaurusCore/Models/Theme/InspectionAdapters/AssignedMenuPresentation.swift:629 — AssignedNativeMenuItems.body has cognitive complexity 42 (threshold 15). Drivers by points: boolean chains 21, if/else 14 (19 pts), ternaries 2 (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 · ImportCommand.render (cognitive 41) · ×1
  • ImportCommand.render (cognitive 41) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Import/ImportCommand.swift:728 — ImportCommand.render has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (26 pts), loops 7 (11 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OsaurusEvalsCLI.runCaptureScreen (cognitive 41) · ×1
  • OsaurusEvalsCLI.runCaptureScreen (cognitive 41) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/OsaurusEvalsCaptureScreenCLI.swift:39 — OsaurusEvalsCLI.runCaptureScreen has cognitive complexity 41 (threshold 15). Drivers by points: if/else 21 (33 pts), boolean chains 3, loops 2, match/switch 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 · ConfigDiff.merge (cognitive 41) · ×1
  • ConfigDiff.merge (cognitive 41) Packages/OsaurusCore/Configuration/Declarative/ConfigDiff.swift:68 — ConfigDiff.merge has cognitive complexity 41 (threshold 15). Drivers by points: if/else 10 (20 pts), ternaries 3 (9 pts), loops 4 (8 pts), boolean chains 3, match/switch 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigPlanner.diffPortableSettings (cognitive 41) · ×1
  • ConfigPlanner.diffPortableSettings (cognitive 41) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1299 — ConfigPlanner.diffPortableSettings has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (32 pts), boolean chains 4, ternaries 1 (3 pts), match/switch 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ContentBlockKind.== (cognitive 41) · ×1
  • ContentBlockKind.== (cognitive 41) Packages/OsaurusCore/Models/Chat/ContentBlock.swift:161 — ContentBlockKind.== has cognitive complexity 41 (threshold 15). Drivers by points: boolean chains 29, if/else 6 (11 pts), match/switch 1 (nesting depth added 5). 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 · ContentBlock.knownFileContents (cognitive 41) · ×1
  • ContentBlock.knownFileContents (cognitive 41) Packages/OsaurusCore/Models/Chat/ContentBlock.swift:1283 — ContentBlock.knownFileContents has cognitive complexity 41 (threshold 15). Drivers by points: if/else 5 (15 pts), boolean chains 12, ternaries 2 (8 pts), loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DecisionService.execute (cognitive 41) · ×1
  • DecisionService.execute (cognitive 41) Packages/OsaurusCore/Services/Inference/DecisionService.swift:132 — DecisionService.execute has cognitive complexity 41 (threshold 15). Drivers by points: error handling 6 (18 pts), if/else 4 (17 pts), boolean chains 4, loops 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.
D2 · Cognitive Complexity · ResponsesGenerationStream.compatibility (cognitive 41) · ×1
  • ResponsesGenerationStream.compatibility (cognitive 41) Packages/OsaurusCore/Services/Inference/ResponsesCompatibilityStream.swift:19 — ResponsesGenerationStream.compatibility has cognitive complexity 41 (threshold 15). Drivers by points: if/else 23 (27 pts), ternaries 2 (5 pts), error handling 4, loops 2 (3 pts), boolean chains 2 (nesting depth added 8). 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 · MCPElicitationForm.convert (cognitive 41) · ×1
  • MCPElicitationForm.convert (cognitive 41) Packages/OsaurusCore/Services/MCP/MCPElicitation.swift:186 — MCPElicitationForm.convert has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (22 pts), ternaries 4 (9 pts), boolean chains 6, match/switch 2 (4 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ImageModelRequestPolicy.validate (cognitive 41) · ×1
  • ImageModelRequestPolicy.validate (cognitive 41) Packages/OsaurusCore/Services/ModelRuntime/ImageModelRequestPolicy.swift:54 — ImageModelRequestPolicy.validate has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (28 pts), boolean chains 10, loops 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SettingsFieldRow.body (cognitive 41) · ×1
  • SettingsFieldRow.body (cognitive 41) Packages/OsaurusCore/Views/DesignSystem/SettingsFields.swift:504 — SettingsFieldRow.body has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 17 (32 pts), if/else 6 (8 pts), boolean chains 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 · EventEditorSheet.build (cognitive 41) · ×1
  • EventEditorSheet.build (cognitive 41) Packages/OsaurusCore/Views/Event/EventEditorSheet.swift:762 — EventEditorSheet.build has cognitive complexity 41 (threshold 15). Drivers by points: if/else 10 (19 pts), ternaries 11 (14 pts), boolean chains 5, match/switch 2, 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 · FileEditTool.normalizingEditShapes (cognitive 40) · ×1
  • FileEditTool.normalizingEditShapes (cognitive 40) Packages/OsaurusCore/Folder/FolderTools.swift:3628 — FileEditTool.normalizingEditShapes has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 15, loops 2 (3 pts) (nesting depth added 12). Of this number, 36 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 · ModelDownloadService.transferFile (cognitive 40) · ×1
  • ModelDownloadService.transferFile (cognitive 40) Packages/OsaurusCore/Services/ModelDownloadService.swift:826 — ModelDownloadService.transferFile has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 8, 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 · ConfigScheduleFrequency.parse (cognitive 40) · ×1
  • ConfigScheduleFrequency.parse (cognitive 40) Packages/OsaurusCore/Configuration/Declarative/ConfigScheduleFrequency.swift:21 — ConfigScheduleFrequency.parse has cognitive complexity 40 (threshold 15). Drivers by points: boolean chains 20, if/else 11 (19 pts), match/switch 1 (nesting depth added 8). Of this number, 34 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.
D2 · Cognitive Complexity · NativeImageJobCoordinator.runJob (cognitive 40) · ×1
  • NativeImageJobCoordinator.runJob (cognitive 40) Packages/OsaurusCore/Services/AgentDelegation/NativeImageJobCoordinator.swift:675 — NativeImageJobCoordinator.runJob has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 8, error handling 2 (3 pts), match/switch 1 (3 pts), loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatEngine.prepareDispatch (cognitive 40) · ×1
  • ChatEngine.prepareDispatch (cognitive 40) Packages/OsaurusCore/Services/Chat/ChatEngine.swift:227 — ChatEngine.prepareDispatch has cognitive complexity 40 (threshold 15). Drivers by points: boolean chains 19, if/else 16 (18 pts), 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 · FileDiffEngine.canonicalLines (cognitive 40) · ×1
  • FileDiffEngine.canonicalLines (cognitive 40) Packages/OsaurusCore/Services/FileHistory/FileDiffEngine.swift:494 — FileDiffEngine.canonicalLines has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 4 (10 pts), ternaries 2 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 20). Of this number, 22 points are the body's own statements and 18 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 · RemoteProviderService.processEventPayload (cognitive 40) · ×1
  • RemoteProviderService.processEventPayload (cognitive 40) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:1737 — RemoteProviderService.processEventPayload has cognitive complexity 40 (threshold 15). Drivers by points: boolean chains 22, if/else 11 (14 pts), ternaries 1 (2 pts), loops 1, match/switch 1 (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · WorkspacesService.refreshSelectedWorkspace (cognitive 40) · ×1
  • WorkspacesService.refreshSelectedWorkspace (cognitive 40) Packages/OsaurusCore/Services/Router/WorkspacesService.swift:542 — WorkspacesService.refreshSelectedWorkspace has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 7, error handling 4, match/switch 1 (3 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 · MediaModelCandidate.constraintsSummary (cognitive 40) · ×1
  • MediaModelCandidate.constraintsSummary (cognitive 40) Packages/OsaurusCore/Services/Workflow/MediaModelResolver.swift:72 — MediaModelCandidate.constraintsSummary has cognitive complexity 40 (threshold 15). Drivers by points: if/else 22 (40 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 · WorkflowRunner.runMap (cognitive 40) · ×1
  • WorkflowRunner.runMap (cognitive 40) Packages/OsaurusCore/Services/Workflow/WorkflowRunner.swift:1083 — WorkflowRunner.runMap has cognitive complexity 40 (threshold 15). Drivers by points: if/else 15 (30 pts), boolean chains 5, loops 2, match/switch 1 (2 pts), ternaries 1 (nesting depth added 16). Of this number, 38 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 · BenchCommand.parseOptions (cognitive 39) · ×1
  • BenchCommand.parseOptions (cognitive 39) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Bench.swift:507 — BenchCommand.parseOptions has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (28 pts), boolean chains 6, match/switch 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 20). Of this number, 37 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 · EvalRunner.runMicroPerfCase (cognitive 39) · ×1
  • EvalRunner.runMicroPerfCase (cognitive 39) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerMicroPerf.swift:26 — EvalRunner.runMicroPerfCase has cognitive complexity 39 (threshold 15). Drivers by points: if/else 24 (33 pts), boolean chains 2, match/switch 1 (2 pts), ternaries 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 · EvalRunner.runScreenContextCase (cognitive 39) · ×1
  • EvalRunner.runScreenContextCase (cognitive 39) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerScreenContext.swift:29 — EvalRunner.runScreenContextCase has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 7 (9 pts), ternaries 3 (6 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 14). Of this number, 37 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 · TranscriptionWorker.runLoop (cognitive 39) · ×1
  • TranscriptionWorker.runLoop (cognitive 39) Packages/OsaurusCore/Managers/SpeechService.swift:1515 — TranscriptionWorker.runLoop has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 6, error handling 2 (5 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 · HTTPHandler.handleChatNDJSON (cognitive 39) · ×1
  • HTTPHandler.handleChatNDJSON (cognitive 39) Packages/OsaurusCore/Networking/HTTPHandler.swift:15863 — HTTPHandler.handleChatNDJSON has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (27 pts), boolean chains 4, match/switch 1 (3 pts), loops 1 (2 pts), ternaries 1 (2 pts), error handling 1 (nesting depth added 14). Of this number, 38 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 · ModelRuntime.estimatedArchitectureKVHeadroomBytes (cognitive 39) · ×1
  • ModelRuntime.estimatedArchitectureKVHeadroomBytes (cognitive 39) Packages/OsaurusCore/Services/ModelRuntime.swift:3593 — ModelRuntime.estimatedArchitectureKVHeadroomBytes has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 20, if/else 12 (13 pts), ternaries 5 (6 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 · Tokenizer.tokenize (cognitive 39) · ×1
  • Tokenizer.tokenize (cognitive 39) Packages/OsaurusCore/Utils/CalculatorEngine.swift:201 — Tokenizer.tokenize has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 14, loops 2 (4 pts), match/switch 1 (2 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 · WorkflowValidator.validate (cognitive 39) · ×1
  • WorkflowValidator.validate (cognitive 39) Packages/OsaurusCore/Models/Workflow/WorkflowValidator.swift:163 — WorkflowValidator.validate has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 5, loops 4, match/switch 1 (2 pts), 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 · FileChangeJournal.convertSandboxChanges (cognitive 39) · ×1
  • FileChangeJournal.convertSandboxChanges (cognitive 39) Packages/OsaurusCore/Services/FileHistory/FileChangeJournal.swift:1037 — FileChangeJournal.convertSandboxChanges has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (25 pts), ternaries 2 (6 pts), boolean chains 3, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KnowledgeIndexService.scanIndexableFiles (cognitive 39) · ×1
  • KnowledgeIndexService.scanIndexableFiles (cognitive 39) Packages/OsaurusCore/Services/Knowledge/KnowledgeIndexService.swift:347 — KnowledgeIndexService.scanIndexableFiles has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (34 pts), boolean chains 2, ternaries 1 (2 pts), 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 · RunWorkflowTool.execute (cognitive 39) · ×1
  • RunWorkflowTool.execute (cognitive 39) Packages/OsaurusCore/Tools/Workflow/WorkflowTools.swift:522 — RunWorkflowTool.execute has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (23 pts), ternaries 7 (10 pts), boolean chains 6 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · XLSXEditor.shiftAnnotations (cognitive 39) · ×1
  • XLSXEditor.shiftAnnotations (cognitive 39) Packages/OsaurusCore/Services/Documents/OOXML/XLSXEditor.swift:628 — XLSXEditor.shiftAnnotations has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 8 (15 pts), boolean chains 2 (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 · ShellArgs.split (cognitive 39) · ×1
  • ShellArgs.split (cognitive 39) Packages/OsaurusCore/Services/MCP/Stdio/ShellArgs.swift:35 — ShellArgs.split has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (29 pts), match/switch 2 (5 pts), boolean chains 4, 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 · LanguageCatalogSource.item (cognitive 39) · ×1
  • LanguageCatalogSource.item (cognitive 39) Packages/OsaurusCore/Views/Model/Catalog/LanguageCatalogSource.swift:469 — LanguageCatalogSource.item has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 7, ternaries 3 (5 pts), match/switch 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BlockMemoizer.blocks (cognitive 38) · ×1
  • BlockMemoizer.blocks (cognitive 38) Packages/OsaurusCore/Managers/BlockMemoizer.swift:118 — BlockMemoizer.blocks has cognitive complexity 38 (threshold 15). Drivers by points: boolean chains 31, 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 · HTTPHandler.handleSessionEndpoint (cognitive 38) · ×1
  • HTTPHandler.handleSessionEndpoint (cognitive 38) Packages/OsaurusCore/Networking/HTTPHandler.swift:8502 — HTTPHandler.handleSessionEndpoint has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (25 pts), ternaries 5 (9 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HTTPHandler.decodeOllamaChatRequest (cognitive 38) · ×1
  • HTTPHandler.decodeOllamaChatRequest (cognitive 38) Packages/OsaurusCore/Networking/HTTPHandler.swift:15815 — HTTPHandler.decodeOllamaChatRequest has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 3 (8 pts), boolean chains 7 (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 · ModelRuntime.computeWeightsSizeBytes (cognitive 38) · ×1
  • ModelRuntime.computeWeightsSizeBytes (cognitive 38) Packages/OsaurusCore/Services/ModelRuntime.swift:8011 — ModelRuntime.computeWeightsSizeBytes has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 10, 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 · CapabilitiesDiscoverTool.execute (cognitive 38) · ×1
  • CapabilitiesDiscoverTool.execute (cognitive 38) Packages/OsaurusCore/Tools/CapabilityTools.swift:397 — CapabilitiesDiscoverTool.execute has cognitive complexity 38 (threshold 15). Drivers by points: if/else 19 (28 pts), loops 5 (6 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BrowserSnapshotFormatter.format (cognitive 38) · ×1
  • BrowserSnapshotFormatter.format (cognitive 38) Packages/OsaurusCore/Browser/Runtime/BrowserSupport.swift:172 — BrowserSnapshotFormatter.format has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 3 (6 pts), ternaries 2 (6 pts), boolean chains 3, match/switch 1 (nesting depth added 18). 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 · FileDiffEngine.collapse (cognitive 38) · ×1
  • FileDiffEngine.collapse (cognitive 38) Packages/OsaurusCore/Services/FileHistory/FileDiffEngine.swift:312 — FileDiffEngine.collapse has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 7 (16 pts), boolean chains 2, match/switch 1 (2 pts), ternaries 2 (nesting depth added 17). Of this number, 27 points are the body's own statements and 11 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ResponsesToolChoiceContract.enforce (cognitive 38) · ×1
  • ResponsesToolChoiceContract.enforce (cognitive 38) Packages/OsaurusCore/Services/Inference/ResponsesToolChoiceContract.swift:130 — ResponsesToolChoiceContract.enforce has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (27 pts), error handling 2 (5 pts), boolean chains 4, loops 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 · State.consume (cognitive 38) · ×1
  • State.consume (cognitive 38) Packages/OsaurusCore/Services/Provider/RemoteResponsesPrivacyStream.swift:72 — State.consume has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 2 (6 pts), match/switch 2 (4 pts), boolean chains 3 (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 · SyncHostRunner.process (cognitive 38) · ×1
  • SyncHostRunner.process (cognitive 38) Packages/OsaurusCore/Services/Sync/SyncHostRunner.swift:324 — SyncHostRunner.process has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (19 pts), boolean chains 14, error handling 1 (2 pts), match/switch 2, ternaries 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · FloatingInputCard.normalBody (cognitive 38) · ×1
  • FloatingInputCard.normalBody (cognitive 38) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:1007 — FloatingInputCard.normalBody has cognitive complexity 38 (threshold 15). Drivers by points: if/else 23 (27 pts), boolean chains 11 (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 · XLSXEditor.dropCachedFormulaResults (cognitive 38) · ×1
  • XLSXEditor.dropCachedFormulaResults (cognitive 38) Packages/OsaurusCore/Services/Documents/OOXML/XLSXEditor.swift:88 — XLSXEditor.dropCachedFormulaResults has cognitive complexity 38 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 5 (11 pts), boolean chains 7, ternaries 1 (4 pts) (nesting depth added 19). 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 · MCPCommand.execute (cognitive 37) · ×1
  • MCPCommand.execute (cognitive 37) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/MCPCommand.swift:14 — MCPCommand.execute has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (22 pts), ternaries 2 (5 pts), boolean chains 4, error handling 4, loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SchemaValidator.validateObject (cognitive 37) · ×1
  • SchemaValidator.validateObject (cognitive 37) Packages/OsaurusCore/Tools/SchemaValidator.swift:69 — SchemaValidator.validateObject has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 6, loops 3 (4 pts), ternaries 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SearchAndExtractTool.execute (cognitive 37) · ×1
  • SearchAndExtractTool.execute (cognitive 37) Packages/OsaurusCore/Tools/WebSearchTools.swift:420 — SearchAndExtractTool.execute has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (22 pts), ternaries 6 (8 pts), loops 1 (4 pts), boolean chains 3 (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 · Template.document (cognitive 37) · ×1
  • Template.document (cognitive 37) Packages/OsaurusCore/Models/Template/Template+Agent.swift:88 — Template.document has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (35 pts), ternaries 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 · RuntimeProofValidator.appendProvenClaimIssues (cognitive 37) · ×1
  • RuntimeProofValidator.appendProvenClaimIssues (cognitive 37) Packages/OsaurusCore/Services/ModelRuntime/RuntimeProofValidation.swift:310 — RuntimeProofValidator.appendProvenClaimIssues has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (33 pts), match/switch 1 (2 pts), boolean chains 1, 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 · SyncLegacyImporter.importAll (cognitive 37) · ×1
  • SyncLegacyImporter.importAll (cognitive 37) Packages/OsaurusCore/Services/Sync/SyncLegacyImporter.swift:96 — SyncLegacyImporter.importAll has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (24 pts), error handling 2 (5 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TelegramConnectionService.diagnostics (cognitive 37) · ×1
  • TelegramConnectionService.diagnostics (cognitive 37) Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:528 — TelegramConnectionService.diagnostics has cognitive complexity 37 (threshold 15). Drivers by points: if/else 20 (25 pts), boolean chains 9, error handling 2 (3 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · NativeMarkdownTableView.updateCells (cognitive 37) · ×1
  • NativeMarkdownTableView.updateCells (cognitive 37) Packages/OsaurusCore/Views/Chat/NativeBlockViews.swift:1264 — NativeMarkdownTableView.updateCells has cognitive complexity 37 (threshold 15). Drivers by points: loops 8 (16 pts), if/else 7 (14 pts), ternaries 3 (5 pts), boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToolCategory.from (cognitive 37) · ×1
  • ToolCategory.from (cognitive 37) Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:130 — ToolCategory.from has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 31, 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 · MCPWWWAuthenticate.parseParams (cognitive 37) · ×1
  • MCPWWWAuthenticate.parseParams (cognitive 37) Packages/OsaurusCore/Services/MCP/OAuth/MCPWWWAuthenticate.swift:80 — MCPWWWAuthenticate.parseParams has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 5 (11 pts), boolean chains 7 (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 · ContextOptimizerSearch.plan (cognitive 36) · ×1
  • ContextOptimizerSearch.plan (cognitive 36) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ContextOptimizer.swift:105 — ContextOptimizerSearch.plan has cognitive complexity 36 (threshold 15). Drivers by points: if/else 18 (20 pts), ternaries 6 (9 pts), loops 5, boolean chains 2 (nesting depth added 5). Of this number, 32 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · EvalRunner.runArchitectCase (cognitive 36) · ×1
  • EvalRunner.runArchitectCase (cognitive 36) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerWorkflow.swift:43 — EvalRunner.runArchitectCase has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 11, if/else 9, ternaries 4 (7 pts), loops 2 (5 pts), error handling 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 · FileWriteDocumentRouting.workbook (cognitive 36) · ×1
  • FileWriteDocumentRouting.workbook (cognitive 36) Packages/OsaurusCore/Folder/FileWriteDocumentRouting.swift:323 — FileWriteDocumentRouting.workbook has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (27 pts), loops 3 (6 pts), boolean chains 3 (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 · InsightsService.filterInMemory (cognitive 36) · ×1
  • InsightsService.filterInMemory (cognitive 36) Packages/OsaurusCore/Managers/InsightsService.swift:572 — InsightsService.filterInMemory has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 15, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Solver.solve (cognitive 36) · ×1
  • Solver.solve (cognitive 36) Packages/OsaurusCore/Utils/CalculatorEngine.swift:1042 — Solver.solve has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 13, loops 3 (4 pts), ternaries 3 (nesting depth added 6). Of this number, 28 points are the body's own statements and 8 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InlineMathScanner.split (cognitive 36) · ×1
  • InlineMathScanner.split (cognitive 36) Packages/OsaurusCore/Utils/InlineMathScanner.swift:86 — InlineMathScanner.split has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 8, loops 2 (4 pts), ternaries 1 (nesting depth added 15). Of this number, 34 points are the body's own statements and 2 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 · ScreenContextDistiller.sampledItem (cognitive 36) · ×1
  • ScreenContextDistiller.sampledItem (cognitive 36) Packages/OsaurusCore/ComputerUse/Perception/ScreenContextDistiller.swift:519 — ScreenContextDistiller.sampledItem has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (25 pts), ternaries 3 (6 pts), boolean chains 4, match/switch 1 (nesting depth added 15). 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 · FileDiff.partialToolName (cognitive 36) · ×1
  • FileDiff.partialToolName (cognitive 36) Packages/OsaurusCore/Models/Chat/FileDiff.swift:261 — FileDiff.partialToolName has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 12, 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 · ScheduleFrequency.nextRunDate (cognitive 36) · ×1
  • ScheduleFrequency.nextRunDate (cognitive 36) Packages/OsaurusCore/Models/Schedule/Schedule.swift:111 — ScheduleFrequency.nextRunDate has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (33 pts), ternaries 1 (2 pts), match/switch 1 (nesting depth added 18). 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 · WorkflowCondition.evaluate (cognitive 36) · ×1
  • WorkflowCondition.evaluate (cognitive 36) Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:1857 — WorkflowCondition.evaluate has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 8, match/switch 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 · ChannelAccountMigration.splitTriggers (cognitive 36) · ×1
  • ChannelAccountMigration.splitTriggers (cognitive 36) Packages/OsaurusCore/Services/AgentChannel/ChannelAccountMigration.swift:241 — ChannelAccountMigration.splitTriggers has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 4 (8 pts), boolean chains 3 (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 · FoundationModelService.streamWithTools (cognitive 36) · ×1
  • FoundationModelService.streamWithTools (cognitive 36) Packages/OsaurusCore/Services/Inference/FoundationModelService.swift:507 — FoundationModelService.streamWithTools has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (28 pts), error handling 2 (4 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DiscoveryCenter.take (cognitive 36) · ×1
  • DiscoveryCenter.take (cognitive 36) Packages/OsaurusCore/Services/Onboarding/DiscoveryCenter.swift:377 — DiscoveryCenter.take has cognitive complexity 36 (threshold 15). Drivers by points: if/else 18 (31 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 14). Of this number, 33 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ImageSubagentKind.resolveModel (cognitive 36) · ×1
  • ImageSubagentKind.resolveModel (cognitive 36) Packages/OsaurusCore/Subagent/Kinds/ImageSubagentKind.swift:85 — ImageSubagentKind.resolveModel has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 13, ternaries 4 (8 pts), 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 · CapabilityRowBuilder.build (cognitive 36) · ×1
  • CapabilityRowBuilder.build (cognitive 36) Packages/OsaurusCore/Views/Agent/AgentCapabilityManagerView.swift:149 — CapabilityRowBuilder.build has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 7, ternaries 2 (5 pts), loops 3 (4 pts) (nesting depth added 12). Of this number, 35 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 · ChatSession.dispatchSend (cognitive 36) · ×1
  • ChatSession.dispatchSend (cognitive 36) Packages/OsaurusCore/Views/Chat/ChatView.swift:7577 — ChatSession.dispatchSend has cognitive complexity 36 (threshold 15). Drivers by points: if/else 157 (345 pts), ternaries 36 (91 pts), boolean chains 83, loops 10 (26 pts), error handling 8 (14 pts), match/switch 1 (2 pts) (nesting depth added 266). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: 3 other methods here (ChatSession.dispatchSend::runTurn, ChatSession.dispatchSend::runTurn::postProcessToolResult, ChatSession.dispatchSend::runTurn::executeToolBatch) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 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 · PreviewGenerator.resultPreview (cognitive 36) · ×1
  • PreviewGenerator.resultPreview (cognitive 36) Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:245 — PreviewGenerator.resultPreview has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (21 pts), ternaries 5 (14 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ShowCommand.printFormattedOutput (cognitive 35) · ×1
  • ShowCommand.printFormattedOutput (cognitive 35) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Show.swift:166 — ShowCommand.printFormattedOutput has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 9, loops 4 (5 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 · EvalCaseTelemetry.isEmpty (cognitive 35) · ×1
  • EvalCaseTelemetry.isEmpty (cognitive 35) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReport.swift:240 — EvalCaseTelemetry.isEmpty has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 35. To reduce it, name the conditions: bind each compound test to a 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 · EvalRunner.scoreSpawnResidencyLane (cognitive 35) · ×1
  • EvalRunner.scoreSpawnResidencyLane (cognitive 35) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:323 — EvalRunner.scoreSpawnResidencyLane has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 10, ternaries 3 (4 pts), loops 1 (nesting depth added 9). Of this number, 32 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 · FileCopyTool.execute (cognitive 35) · ×1
  • FileCopyTool.execute (cognitive 35) Packages/OsaurusCore/Folder/FileCopyTool.swift:89 — FileCopyTool.execute has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (23 pts), error handling 2 (4 pts), boolean chains 3, ternaries 3, match/switch 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 · CNContactsService.search (cognitive 35) · ×1
  • CNContactsService.search (cognitive 35) Packages/OsaurusCore/AppleApps/Contacts/ContactsService.swift:187 — CNContactsService.search has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 13, match/switch 1 (2 pts), loops 1 (nesting depth added 11). Of this number, 34 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 · ConfigPlanner.summarizePortableSettings (cognitive 35) · ×1
  • ConfigPlanner.summarizePortableSettings (cognitive 35) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1426 — ConfigPlanner.summarizePortableSettings has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 9, ternaries 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.
D2 · Cognitive Complexity · AgentChannelPublishService.publish (cognitive 35) · ×1
  • AgentChannelPublishService.publish (cognitive 35) Packages/OsaurusCore/Services/AgentChannel/AgentChannelPublishService.swift:186 — AgentChannelPublishService.publish has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 5, match/switch 3 (4 pts), ternaries 2 (4 pts), error handling 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 · ClaudeCodeHarnessAdapter.launchPlan (cognitive 35) · ×1
  • ClaudeCodeHarnessAdapter.launchPlan (cognitive 35) Packages/OsaurusCore/Services/Harness/ClaudeCodeHarnessAdapter.swift:40 — ClaudeCodeHarnessAdapter.launchPlan has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 8, ternaries 5 (8 pts), match/switch 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 · MemoryConsolidator.mergeNearDuplicateEpisodes (cognitive 35) · ×1
  • MemoryConsolidator.mergeNearDuplicateEpisodes (cognitive 35) Packages/OsaurusCore/Services/Memory/MemoryConsolidator.swift:233 — MemoryConsolidator.mergeNearDuplicateEpisodes has cognitive complexity 35 (threshold 15). Drivers by points: if/else 5 (14 pts), ternaries 2 (10 pts), loops 3 (6 pts), error handling 1 (5 pts) (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 · RemoteProviderService.handleGeminiEvent (cognitive 35) · ×1
  • RemoteProviderService.handleGeminiEvent (cognitive 35) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:2178 — RemoteProviderService.handleGeminiEvent has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (23 pts), match/switch 3 (8 pts), boolean chains 2, loops 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 · SlackConnectionService.diagnostics (cognitive 35) · ×1
  • SlackConnectionService.diagnostics (cognitive 35) Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:582 — SlackConnectionService.diagnostics has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 8, ternaries 3 (6 pts), error handling 2 (3 pts), loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ImportCommand.runRemove (cognitive 34) · ×1
  • ImportCommand.runRemove (cognitive 34) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Import/ImportCommand.swift:513 — ImportCommand.runRemove has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 3 (8 pts), boolean chains 4, match/switch 1 (3 pts), error handling 1, ternaries 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 · OsaurusEvalsCLI.computeFloorBreaches (cognitive 34) · ×1
  • OsaurusEvalsCLI.computeFloorBreaches (cognitive 34) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/OsaurusEvalsCLI.swift:581 — OsaurusEvalsCLI.computeFloorBreaches has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (28 pts), loops 2 (3 pts), match/switch 1 (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 · EvalScoreboardBuilder.loadEvidenceSummariesRecursively (cognitive 34) · ×1
  • EvalScoreboardBuilder.loadEvidenceSummariesRecursively (cognitive 34) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalScoreboard.swift:521 — EvalScoreboardBuilder.loadEvidenceSummariesRecursively has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (7 pts), error handling 2 (6 pts), ternaries 1 (5 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileUndoTool.execute (cognitive 34) · ×1
  • FileUndoTool.execute (cognitive 34) Packages/OsaurusCore/Folder/FolderTools.swift:4596 — FileUndoTool.execute has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 6, 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 · HTTPHandler.handlePairInviteEndpoint (cognitive 34) · ×1
  • HTTPHandler.handlePairInviteEndpoint (cognitive 34) Packages/OsaurusCore/Networking/HTTPHandler.swift:9509 — HTTPHandler.handlePairInviteEndpoint has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 5, match/switch 3 (5 pts), error handling 2, ternaries 1 (2 pts) (nesting depth added 8). Of this number, 30 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HTTPHandler.handleOllamaGenerate (cognitive 34) · ×1
  • HTTPHandler.handleOllamaGenerate (cognitive 34) Packages/OsaurusCore/Networking/HTTPHandler.swift:16160 — HTTPHandler.handleOllamaGenerate has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 3, match/switch 1 (3 pts), ternaries 2 (3 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 · ExternalModelLocator.bundleDiagnostic (cognitive 34) · ×1
  • ExternalModelLocator.bundleDiagnostic (cognitive 34) Packages/OsaurusCore/Services/ExternalModelLocator.swift:916 — ExternalModelLocator.bundleDiagnostic has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 11, loops 1 (2 pts), ternaries 1 (nesting depth added 7). Of this number, 30 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CapabilitiesLoadTool.loadMethod (cognitive 34) · ×1
  • CapabilitiesLoadTool.loadMethod (cognitive 34) Packages/OsaurusCore/Tools/CapabilityTools.swift:1137 — CapabilitiesLoadTool.loadMethod has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 2 (6 pts), boolean chains 1, error handling 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 · OsaurusInspectTool.resolvedListEnvelope (cognitive 34) · ×1
  • OsaurusInspectTool.resolvedListEnvelope (cognitive 34) Packages/OsaurusCore/Tools/ConfigurationTools.swift:749 — OsaurusInspectTool.resolvedListEnvelope has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (15 pts), match/switch 5 (8 pts), ternaries 4 (8 pts), boolean chains 2, 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 · AgentView.renderForModel (cognitive 34) · ×1
  • AgentView.renderForModel (cognitive 34) Packages/OsaurusCore/ComputerUse/Model/AgentView.swift:244 — AgentView.renderForModel has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 4 (12 pts), boolean chains 4, 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 · ConfigApplier.applyDelegation (cognitive 34) · ×1
  • ConfigApplier.applyDelegation (cognitive 34) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:1235 — ConfigApplier.applyDelegation has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (20 pts), loops 6 (9 pts), match/switch 1 (3 pts), boolean chains 1, ternaries 1 (nesting depth added 9). 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 · PluginManager.loadPluginWithError (cognitive 34) · ×1
  • PluginManager.loadPluginWithError (cognitive 34) Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:1217 — PluginManager.loadPluginWithError has cognitive complexity 34 (threshold 15). Drivers by points: if/else 19 (24 pts), boolean chains 3, ternaries 1 (3 pts), error handling 1 (2 pts), 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 · ModelInfo.findModelDirectory (cognitive 34) · ×1
  • ModelInfo.findModelDirectory (cognitive 34) Packages/OsaurusCore/Models/Configuration/ModelInfo.swift:324 — ModelInfo.findModelDirectory has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (27 pts), loops 2 (6 pts), boolean chains 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 · CodeBlockMasker.appendIndentedCodeSpans (cognitive 34) · ×1
  • CodeBlockMasker.appendIndentedCodeSpans (cognitive 34) Packages/OsaurusCore/PrivacyFilter/Core/CodeBlockMasker.swift:225 — CodeBlockMasker.appendIndentedCodeSpans has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (24 pts), boolean chains 5, loops 2 (5 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatImportRepoWalker.collect (cognitive 34) · ×1
  • ChatImportRepoWalker.collect (cognitive 34) Packages/OsaurusCore/Services/ChatImport/ChatImportSourceResolver.swift:305 — ChatImportRepoWalker.collect has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 7, loops 2, ternaries 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PPTXEmitter.slides (cognitive 34) · ×1
  • PPTXEmitter.slides (cognitive 34) Packages/OsaurusCore/Services/Documents/PPTXEmitter.swift:55 — PPTXEmitter.slides has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 9, ternaries 1 (2 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 · MemoryManagementConsoleService.diagnoseStorage (cognitive 34) · ×1
  • MemoryManagementConsoleService.diagnoseStorage (cognitive 34) Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:325 — MemoryManagementConsoleService.diagnoseStorage has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14, boolean chains 12, ternaries 5 (8 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 · PluginHostContext.complete (cognitive 34) · ×1
  • PluginHostContext.complete (cognitive 34) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1528 — PluginHostContext.complete has cognitive complexity 34 (threshold 15). Drivers by points: if/else 22 (27 pts), boolean chains 6, error handling 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · OpenAICompatibleToolCallAccumulator.validateToolCallJSON (cognitive 34) · ×1
  • OpenAICompatibleToolCallAccumulator.validateToolCallJSON (cognitive 34) Packages/OsaurusCore/Services/Provider/OpenAICompatibleStreamParser.swift:329 — OpenAICompatibleToolCallAccumulator.validateToolCallJSON has cognitive complexity 34 (threshold 15). Drivers by points: if/else 20 (29 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 · RemoteProviderService.geminiImageGenerateContent (cognitive 34) · ×1
  • RemoteProviderService.geminiImageGenerateContent (cognitive 34) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:3949 — RemoteProviderService.geminiImageGenerateContent has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (24 pts), match/switch 1 (4 pts), error handling 2 (3 pts), loops 1 (3 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 · WorkspaceSyncService.startStream (cognitive 34) · ×1
  • WorkspaceSyncService.startStream (cognitive 34) Packages/OsaurusCore/Services/Router/WorkspaceSyncService.swift:181 — WorkspaceSyncService.startStream has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 3, error handling 1 (3 pts), loops 2, 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 · WorkflowEvalHarness.runArchitect (cognitive 34) · ×1
  • WorkflowEvalHarness.runArchitect (cognitive 34) Packages/OsaurusCore/Services/Workflow/WorkflowEvalHarness.swift:543 — WorkflowEvalHarness.runArchitect has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 3 (11 pts), boolean chains 6, match/switch 1 (2 pts), loops 1 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · WorkflowEvalHarness.structureChecks (cognitive 34) · ×1
  • WorkflowEvalHarness.structureChecks (cognitive 34) Packages/OsaurusCore/Services/Workflow/WorkflowEvalHarness.swift:988 — WorkflowEvalHarness.structureChecks has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (19 pts), ternaries 4 (8 pts), boolean chains 7 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ImageSubagentKind.run (cognitive 34) · ×1
  • ImageSubagentKind.run (cognitive 34) Packages/OsaurusCore/Subagent/Kinds/ImageSubagentKind.swift:366 — ImageSubagentKind.run has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 7 (13 pts), error handling 3 (4 pts), boolean chains 3 (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 · DatabaseImport.parseXLSX (cognitive 34) · ×1
  • DatabaseImport.parseXLSX (cognitive 34) Packages/OsaurusCore/Tools/Database/DatabaseImport.swift:253 — DatabaseImport.parseXLSX has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (20 pts), loops 4 (6 pts), ternaries 2 (4 pts), boolean chains 3, 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 · bridge.emitMessage (cognitive 34) · ×1
  • bridge.emitMessage (cognitive 34) helpers/osaurus-wa/bridge.go:1134 — bridge.emitMessage has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (28 pts), boolean chains 3, 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 · ManifestValidate.validateRoutes (cognitive 33) · ×1
  • ManifestValidate.validateRoutes (cognitive 33) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Manifest/ManifestValidate.swift:342 — ManifestValidate.validateRoutes has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (27 pts), loops 2 (5 pts), boolean chains 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 · ShellMutationPlanner.targets (cognitive 33) · ×1
  • ShellMutationPlanner.targets (cognitive 33) Packages/OsaurusCore/Folder/ShellMutationPlanner.swift:33 — ShellMutationPlanner.targets has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 7, loops 4 (5 pts), ternaries 1 (2 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 · MCPProviderManager.executeTool (cognitive 33) · ×1
  • MCPProviderManager.executeTool (cognitive 33) Packages/OsaurusCore/Managers/MCPProviderManager.swift:822 — MCPProviderManager.executeTool has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 4, error handling 2 (3 pts), ternaries 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 · OsaurusConfigTool.loadDocument (cognitive 33) · ×1
  • OsaurusConfigTool.loadDocument (cognitive 33) Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool.swift:1091 — OsaurusConfigTool.loadDocument has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (19 pts), ternaries 3 (6 pts), match/switch 2 (4 pts), boolean chains 2, error handling 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 · FileDiff.partialPythonStringValue (cognitive 33) · ×1
  • FileDiff.partialPythonStringValue (cognitive 33) Packages/OsaurusCore/Models/Chat/FileDiff.swift:404 — FileDiff.partialPythonStringValue has cognitive complexity 33 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 4 (7 pts), boolean chains 5, match/switch 1 (4 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 · MTPLayoutAdvisory.evaluate (cognitive 33) · ×1
  • MTPLayoutAdvisory.evaluate (cognitive 33) Packages/OsaurusCore/Models/Chat/MTPLayoutAdvisory.swift:135 — MTPLayoutAdvisory.evaluate has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 8, loops 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AssignedBaseToggleStyle.makeBody (cognitive 33) · ×1
  • AssignedBaseToggleStyle.makeBody (cognitive 33) Packages/OsaurusCore/Models/Theme/BaseComponentAssignments.swift:123 — AssignedBaseToggleStyle.makeBody has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 15 (25 pts), if/else 5 (6 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 · AgentSubagentRunner.run (cognitive 33) · ×1
  • AgentSubagentRunner.run (cognitive 33) Packages/OsaurusCore/Services/AgentDelegation/AgentSubagentRunner.swift:159 — AgentSubagentRunner.run has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15, ternaries 7 (14 pts), error handling 3, loops 1 (nesting depth added 7). Of this number, 30 points are the body's own statements and 3 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 · TokenizerMetadata.init (cognitive 33) · ×1
  • TokenizerMetadata.init (cognitive 33) Packages/OsaurusCore/Services/Inference/LocalGrammarTokenizerProbe.swift:100 — TokenizerMetadata.init has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (23 pts), match/switch 2 (6 pts), loops 2 (4 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 · StructuredOutputSchema.dropNullOptionals (cognitive 33) · ×1
  • StructuredOutputSchema.dropNullOptionals (cognitive 33) Packages/OsaurusCore/Services/Inference/StructuredOutput.swift:238 — StructuredOutputSchema.dropNullOptionals has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 3 (7 pts), boolean chains 4, match/switch 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 · MemorySearchService.searchEpisodes (cognitive 33) · ×1
  • MemorySearchService.searchEpisodes (cognitive 33) Packages/OsaurusCore/Services/Memory/MemorySearchService.swift:377 — MemorySearchService.searchEpisodes has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 2 (7 pts), error handling 2 (3 pts), boolean chains 2 (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 · RemoteProviderService.handleAnthropicEvent (cognitive 33) · ×1
  • RemoteProviderService.handleAnthropicEvent (cognitive 33) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:2258 — RemoteProviderService.handleAnthropicEvent has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (25 pts), match/switch 3 (6 pts), boolean chains 2 (nesting depth added 15). 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 · SearchDiagnostics.classifyFailure (cognitive 33) · ×1
  • SearchDiagnostics.classifyFailure (cognitive 33) Packages/OsaurusCore/Services/Search/SearchTypes.swift:180 — SearchDiagnostics.classifyFailure has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 23, 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 · ClaudePluginInstaller.rewriteSkillBody (cognitive 33) · ×1
  • ClaudePluginInstaller.rewriteSkillBody (cognitive 33) Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:1197 — ClaudePluginInstaller.rewriteSkillBody has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (24 pts), loops 4 (7 pts), ternaries 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatSession.runImageGeneration (cognitive 33) · ×1
  • ChatSession.runImageGeneration (cognitive 33) Packages/OsaurusCore/Views/Chat/ChatView.swift:6923 — ChatSession.runImageGeneration has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (21 pts), match/switch 2 (5 pts), error handling 3, boolean chains 2, loops 1 (2 pts) (nesting depth added 14). Of this number, 31 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FloatingInputCard.handleFileDrop (cognitive 33) · ×1
  • FloatingInputCard.handleFileDrop (cognitive 33) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5342 — FloatingInputCard.handleFileDrop has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 8, 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 · TerminalDisplayView.applyTheme (cognitive 33) · ×1
  • TerminalDisplayView.applyTheme (cognitive 33) Packages/OsaurusCore/Views/Chat/TerminalDisplayView.swift:378 — TerminalDisplayView.applyTheme has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 3 (8 pts), boolean chains 7, loops 3 (4 pts), match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Options.parse (cognitive 32) · ×1
  • Options.parse (cognitive 32) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/OsaurusEvalsCLI.swift:887 — Options.parse has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 4, ternaries 1 (3 pts), match/switch 1 (2 pts), 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 · DesignWorkingStore.init (cognitive 32) · ×1
  • DesignWorkingStore.init (cognitive 32) Packages/OsaurusCore/DevelopmentDesign/DesignWorkingStore.swift:48 — DesignWorkingStore.init has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 7, loops 3 (7 pts), error handling 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 · CronParser.nextDate (cognitive 32) · ×1
  • CronParser.nextDate (cognitive 32) Packages/OsaurusCore/Utils/CronParser.swift:48 — CronParser.nextDate has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 6, 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 · ConfigPlanner.plan (cognitive 32) · ×1
  • ConfigPlanner.plan (cognitive 32) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:175 — ConfigPlanner.plan has cognitive complexity 32 (threshold 15). Drivers by points: if/else 25 (27 pts), boolean chains 3, loops 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 · ModelManager.mergeAvailable (cognitive 32) · ×1
  • ModelManager.mergeAvailable (cognitive 32) Packages/OsaurusCore/Managers/Model/ModelManager.swift:1725 — ModelManager.mergeAvailable has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 5, loops 3 (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 · RemoteProvider.resolvedHeaders (cognitive 32) · ×1
  • RemoteProvider.resolvedHeaders (cognitive 32) Packages/OsaurusCore/Models/Configuration/RemoteProviderConfiguration.swift:336 — RemoteProvider.resolvedHeaders has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RegexEntityDetector.detect (cognitive 32) · ×1
  • RegexEntityDetector.detect (cognitive 32) Packages/OsaurusCore/PrivacyFilter/Core/RegexEntityDetector.swift:126 — RegexEntityDetector.detect has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 8, loops 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 · AgentChannelConnectionService.authorizeInboundMessage (cognitive 32) · ×1
  • AgentChannelConnectionService.authorizeInboundMessage (cognitive 32) Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1111 — AgentChannelConnectionService.authorizeInboundMessage has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 10, error handling 2 (3 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ContextBudgetManager.summarizeToolResult (cognitive 32) · ×1
  • ContextBudgetManager.summarizeToolResult (cognitive 32) Packages/OsaurusCore/Services/Chat/ContextBudgetManager.swift:755 — ContextBudgetManager.summarizeToolResult has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 14, 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 · CSVRowParser.parseRows (cognitive 32) · ×1
  • CSVRowParser.parseRows (cognitive 32) Packages/OsaurusCore/Services/Documents/CSVRowParser.swift:22 — CSVRowParser.parseRows has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 9, 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 · BoundedZipReader.parseEntries (cognitive 32) · ×1
  • BoundedZipReader.parseEntries (cognitive 32) Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:1504 — BoundedZipReader.parseEntries has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 12, 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 · KnowledgeVectorIndexer.drain (cognitive 32) · ×1
  • KnowledgeVectorIndexer.drain (cognitive 32) Packages/OsaurusCore/Services/Knowledge/KnowledgeVectorIndexer.swift:52 — KnowledgeVectorIndexer.drain has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (23 pts), loops 2 (4 pts), boolean chains 3, 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 · ImageComposerRequestBuilder.build (cognitive 32) · ×1
  • ImageComposerRequestBuilder.build (cognitive 32) Packages/OsaurusCore/Services/ModelRuntime/ImageComposerRequestBuilder.swift:81 — ImageComposerRequestBuilder.build has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 14 (19 pts), boolean chains 7, if/else 4 (5 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 · RemoteResponsesNativeStream.capture (cognitive 32) · ×1
  • RemoteResponsesNativeStream.capture (cognitive 32) Packages/OsaurusCore/Services/Provider/RemoteResponsesNativeStream.swift:133 — RemoteResponsesNativeStream.capture has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 6, loops 3 (6 pts), match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DatabaseImport.scanDelimited (cognitive 32) · ×1
  • DatabaseImport.scanDelimited (cognitive 32) Packages/OsaurusCore/Tools/Database/DatabaseImport.swift:371 — DatabaseImport.scanDelimited has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 4, 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 · WorkflowRunView.nodeRow (cognitive 32) · ×1
  • WorkflowRunView.nodeRow (cognitive 32) Packages/OsaurusCore/Views/Workflow/WorkflowRunView.swift:228 — WorkflowRunView.nodeRow has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 8, ternaries 6 (8 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 · run_disconnect_ab.stream (cognitive 32) · ×1
  • run_disconnect_ab.stream (cognitive 32) docs/internal/evidence/2026-08-30-inference-activity-ownership/run_disconnect_ab.py:42 — run_disconnect_ab.stream has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (23 pts), loops 2 (5 pts), boolean chains 3, ternaries 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HuggingFaceService.downloadMetadata (cognitive 31) · ×1
  • HuggingFaceService.downloadMetadata (cognitive 31) Packages/OsaurusCore/Services/HuggingFaceService.swift:303 — HuggingFaceService.downloadMetadata has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 2 (5 pts), boolean chains 2, error handling 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 · MCPProviderTool.convertMCPContent (cognitive 31) · ×1
  • MCPProviderTool.convertMCPContent (cognitive 31) Packages/OsaurusCore/Tools/MCPProviderTool.swift:483 — MCPProviderTool.convertMCPContent has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 6, match/switch 1 (2 pts), 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 · CalculatorEngine.evaluate (cognitive 31) · ×1
  • CalculatorEngine.evaluate (cognitive 31) Packages/OsaurusCore/Utils/CalculatorEngine.swift:56 — CalculatorEngine.evaluate has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (25 pts), boolean chains 3, match/switch 1 (2 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 · EventKitRemindersService.update (cognitive 31) · ×1
  • EventKitRemindersService.update (cognitive 31) Packages/OsaurusCore/AppleApps/Reminders/RemindersService.swift:219 — EventKitRemindersService.update has cognitive complexity 31 (threshold 15). Drivers by points: if/else 20 (27 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigDiff.editScript (cognitive 31) · ×1
  • ConfigDiff.editScript (cognitive 31) Packages/OsaurusCore/Configuration/Declarative/ConfigDiff.swift:231 — ConfigDiff.editScript has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 11, loops 5 (9 pts), if/else 5 (7 pts), ternaries 1 (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.
D2 · Cognitive Complexity · ModelPickerItemCache.remoteModelItems (cognitive 31) · ×1
  • ModelPickerItemCache.remoteModelItems (cognitive 31) Packages/OsaurusCore/Managers/Model/ModelPickerItemCache.swift:405 — ModelPickerItemCache.remoteModelItems has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 4 (16 pts), if/else 6 (10 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelOptionsSnapshot.apply (cognitive 31) · ×1
  • ModelOptionsSnapshot.apply (cognitive 31) Packages/OsaurusCore/Models/Configuration/ModelOptionsSnapshot.swift:215 — ModelOptionsSnapshot.apply has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MicroPerfEvaluator.runCancellation (cognitive 31) · ×1
  • MicroPerfEvaluator.runCancellation (cognitive 31) Packages/OsaurusCore/Services/Context/MicroPerfEvaluator.swift:316 — MicroPerfEvaluator.runCancellation has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (17 pts), error handling 4 (5 pts), loops 3 (5 pts), boolean chains 3, ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ResponsesGenerationStream.native (cognitive 31) · ×1
  • ResponsesGenerationStream.native (cognitive 31) Packages/OsaurusCore/Services/Inference/ResponsesGenerationEvent.swift:104 — ResponsesGenerationStream.native has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (20 pts), match/switch 2 (7 pts), loops 1 (2 pts), boolean chains 1, error handling 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 · RemoteProviderService.enforcingToolUseResultPairing (cognitive 31) · ×1
  • RemoteProviderService.enforcingToolUseResultPairing (cognitive 31) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:4550 — RemoteProviderService.enforcingToolUseResultPairing has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 6, loops 3 (5 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 · SearchReadability.fetchAndExtract (cognitive 31) · ×1
  • SearchReadability.fetchAndExtract (cognitive 31) Packages/OsaurusCore/Services/Search/SearchReadability.swift:95 — SearchReadability.fetchAndExtract has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (17 pts), ternaries 2 (5 pts), boolean chains 4, error handling 3, 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 · AgentDraftTool.queueImport (cognitive 31) · ×1
  • AgentDraftTool.queueImport (cognitive 31) Packages/OsaurusCore/Tools/Agent/AgentDraftTool.swift:268 — AgentDraftTool.queueImport has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 9, error handling 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.
D2 · Cognitive Complexity · SessionRow.body (cognitive 31) · ×1
  • SessionRow.body (cognitive 31) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:2996 — SessionRow.body has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 5, match/switch 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatSession.compactBeforeToolContinuation (cognitive 31) · ×1
  • ChatSession.compactBeforeToolContinuation (cognitive 31) Packages/OsaurusCore/Views/Chat/ChatView.swift:3845 — ChatSession.compactBeforeToolContinuation has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 16, if/else 7 (11 pts), ternaries 1 (3 pts), error handling 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 · FloatingInputCard.startVoiceInput (cognitive 31) · ×1
  • FloatingInputCard.startVoiceInput (cognitive 31) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:1484 — FloatingInputCard.startVoiceInput has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 5, error handling 2 (3 pts), loops 1 (2 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 · NativeChartView.applyInspectionStyle (cognitive 31) · ×1
  • NativeChartView.applyInspectionStyle (cognitive 31) Packages/OsaurusCore/Views/Chat/NativeChartView.swift:265 — NativeChartView.applyInspectionStyle has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 6, ternaries 3 (6 pts), loops 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.
D2 · Cognitive Complexity · NativeThinkingView.applyAssignedLayout (cognitive 31) · ×1
  • NativeThinkingView.applyAssignedLayout (cognitive 31) Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift:396 — NativeThinkingView.applyAssignedLayout has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 12, 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 · ChatPickerOptionsSnapshot.make (cognitive 31) · ×1
  • ChatPickerOptionsSnapshot.make (cognitive 31) Packages/OsaurusCore/Views/Model/ChatModelPickerCard.swift:74 — ChatPickerOptionsSnapshot.make has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 6 (15 pts), boolean chains 7, if/else 5 (6 pts), match/switch 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 · WorkflowRunView.details (cognitive 31) · ×1
  • WorkflowRunView.details (cognitive 31) Packages/OsaurusCore/Views/Workflow/WorkflowRunView.swift:390 — WorkflowRunView.details has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 7, 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 · ManifestValidate.validate (cognitive 30) · ×1
  • ManifestValidate.validate (cognitive 30) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Manifest/ManifestValidate.swift:72 — ManifestValidate.validate has cognitive complexity 30 (threshold 15). Drivers by points: if/else 17 (21 pts), boolean chains 5, loops 1 (3 pts), error handling 1 (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 · OsaurusEvalsCLI.runDiff (cognitive 30) · ×1
  • OsaurusEvalsCLI.runDiff (cognitive 30) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalDiffMatrixCLI.swift:24 — OsaurusEvalsCLI.runDiff has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 3, match/switch 1 (2 pts), error handling 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 · OsaurusEvalsCLI.runMatrix (cognitive 30) · ×1
  • OsaurusEvalsCLI.runMatrix (cognitive 30) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalDiffMatrixCLI.swift:132 — OsaurusEvalsCLI.runMatrix has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (26 pts), match/switch 1 (2 pts), error handling 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 · ShellRunTool.execute (cognitive 30) · ×1
  • ShellRunTool.execute (cognitive 30) Packages/OsaurusCore/Folder/FolderTools.swift:5735 — ShellRunTool.execute has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 3, error handling 2, loops 1 (2 pts), 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 · HTTPHandler.handleAnthropicMessagesNonStreaming (cognitive 30) · ×1
  • HTTPHandler.handleAnthropicMessagesNonStreaming (cognitive 30) Packages/OsaurusCore/Networking/HTTPHandler.swift:18083 — HTTPHandler.handleAnthropicMessagesNonStreaming has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 4 (9 pts), ternaries 2 (4 pts), boolean chains 2, 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 · RequestValidator.rawResponseSchemaReason (cognitive 30) · ×1
  • RequestValidator.rawResponseSchemaReason (cognitive 30) Packages/OsaurusCore/Networking/RequestValidator.swift:47 — RequestValidator.rawResponseSchemaReason has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 8, loops 3 (6 pts), error handling 1 (4 pts), ternaries 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 · ModelRuntime.isKnownHybridModel (cognitive 30) · ×1
  • ModelRuntime.isKnownHybridModel (cognitive 30) Packages/OsaurusCore/Services/ModelRuntime.swift:6094 — ModelRuntime.isKnownHybridModel has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 16, if/else 14. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ModelSSDResidency.remoteNGramBytes (cognitive 30) · ×1
  • ModelSSDResidency.remoteNGramBytes (cognitive 30) Packages/OsaurusCore/Services/ModelSSDResidency.swift:80 — ModelSSDResidency.remoteNGramBytes has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 13, 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 · CronParser.parseField (cognitive 30) · ×1
  • CronParser.parseField (cognitive 30) Packages/OsaurusCore/Utils/CronParser.swift:141 — CronParser.parseField has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 4 (10 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 · BrowserToolExecutor.batchDo (cognitive 30) · ×1
  • BrowserToolExecutor.batchDo (cognitive 30) Packages/OsaurusCore/Browser/Tool/BrowserToolExecutor.swift:491 — BrowserToolExecutor.batchDo has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (20 pts), match/switch 3 (5 pts), boolean chains 2, ternaries 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 · ConfigApplier.patch (cognitive 30) · ×1
  • ConfigApplier.patch (cognitive 30) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:799 — ConfigApplier.patch has cognitive complexity 30 (threshold 15). Drivers by points: if/else 19 (21 pts), ternaries 3 (6 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AgentSubagentRunner.consumeStream (cognitive 30) · ×1
  • AgentSubagentRunner.consumeStream (cognitive 30) Packages/OsaurusCore/Services/AgentDelegation/AgentSubagentRunner.swift:536 — AgentSubagentRunner.consumeStream has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 2, loops 2, match/switch 1 (2 pts), 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 · FoundationModelService.streamDeltas (cognitive 30) · ×1
  • FoundationModelService.streamDeltas (cognitive 30) Packages/OsaurusCore/Services/Inference/FoundationModelService.swift:317 — FoundationModelService.streamDeltas has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 1 (3 pts), error handling 1 (2 pts), boolean chains 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 · JSONMemberScanner.valueEnd (cognitive 30) · ×1
  • JSONMemberScanner.valueEnd (cognitive 30) Packages/OsaurusCore/Services/Inference/LocalGrammarTokenizerProbe.swift:275 — JSONMemberScanner.valueEnd has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 6, loops 2 (4 pts), match/switch 2 (4 pts), ternaries 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 · RemoteProviderService.extractErrorMessage (cognitive 30) · ×1
  • RemoteProviderService.extractErrorMessage (cognitive 30) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:7765 — RemoteProviderService.extractErrorMessage has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (27 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 18). 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 · WorkflowFailure.classify (cognitive 30) · ×1
  • WorkflowFailure.classify (cognitive 30) Packages/OsaurusCore/Services/Workflow/WorkflowFailure.swift:51 — WorkflowFailure.classify has cognitive complexity 30 (threshold 15). Drivers by points: match/switch 9 (17 pts), ternaries 3 (8 pts), if/else 4 (5 pts) (nesting depth added 14). 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 · WorkflowDraftTool.execute (cognitive 30) · ×1
  • WorkflowDraftTool.execute (cognitive 30) Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift:301 — WorkflowDraftTool.execute has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 4 (10 pts), loops 1 (2 pts), match/switch 2, ternaries 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 · WorkflowTestTool.summary (cognitive 30) · ×1
  • WorkflowTestTool.summary (cognitive 30) Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift:1021 — WorkflowTestTool.summary has cognitive complexity 30 (threshold 15). Drivers by points: if/else 19 (25 pts), ternaries 2 (5 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 · SelectableTextView.applyThemeStyling (cognitive 30) · ×1
  • SelectableTextView.applyThemeStyling (cognitive 30) Packages/OsaurusCore/Views/Chat/SelectableTextView.swift:824 — SelectableTextView.applyThemeStyling has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 11, 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 · InsightsDetailPane.copyMenu (cognitive 30) · ×1
  • InsightsDetailPane.copyMenu (cognitive 30) Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:150 — InsightsDetailPane.copyMenu has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (17 pts), ternaries 2 (8 pts), boolean chains 5 (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 · DOCXEditor.applyParagraphRun (cognitive 30) · ×1
  • DOCXEditor.applyParagraphRun (cognitive 30) Packages/OsaurusCore/Services/Documents/OOXML/DOCXEditor.swift:611 — DOCXEditor.applyParagraphRun has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 5 (8 pts), ternaries 3 (5 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DOCXEditor.insertParagraph (cognitive 30) · ×1
  • DOCXEditor.insertParagraph (cognitive 30) Packages/OsaurusCore/Services/Documents/OOXML/DOCXEditor.swift:761 — DOCXEditor.insertParagraph has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 5 (11 pts), boolean chains 3, ternaries 2 (3 pts) (nesting depth added 9). 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 · XLSXEditor.deleteSheet (cognitive 30) · ×1
  • XLSXEditor.deleteSheet (cognitive 30) Packages/OsaurusCore/Services/Documents/OOXML/XLSXEditor.swift:776 — XLSXEditor.deleteSheet has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 7 (12 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BenchCommand.measureOnce (cognitive 29) · ×1
  • BenchCommand.measureOnce (cognitive 29) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Bench.swift:378 — BenchCommand.measureOnce has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 6, ternaries 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 · EvalReport.formatTelemetryLine (cognitive 29) · ×1
  • EvalReport.formatTelemetryLine (cognitive 29) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReport.swift:898 — EvalReport.formatTelemetryLine has cognitive complexity 29 (threshold 15). Drivers by points: if/else 19 (22 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 · OsaurusBundle.risks (cognitive 29) · ×1
  • OsaurusBundle.risks (cognitive 29) Packages/OsaurusRepository/OsaurusBundle.swift:1012 — OsaurusBundle.risks has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 2 (4 pts), match/switch 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 · HTTPHandler.handleMCPCallTool (cognitive 29) · ×1
  • HTTPHandler.handleMCPCallTool (cognitive 29) Packages/OsaurusCore/Networking/HTTPHandler.swift:17425 — HTTPHandler.handleMCPCallTool has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 4, 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 · ModelRuntime.generateEventStream (cognitive 29) · ×1
  • ModelRuntime.generateEventStream (cognitive 29) Packages/OsaurusCore/Services/ModelRuntime.swift:6235 — ModelRuntime.generateEventStream has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 5, error handling 3 (4 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 · ModelRuntime.makeMLXChatMessages (cognitive 29) · ×1
  • ModelRuntime.makeMLXChatMessages (cognitive 29) Packages/OsaurusCore/Services/ModelRuntime.swift:7473 — ModelRuntime.makeMLXChatMessages has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 6, ternaries 2 (6 pts), match/switch 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 · EventKitCalendarService.update (cognitive 29) · ×1
  • EventKitCalendarService.update (cognitive 29) Packages/OsaurusCore/AppleApps/Calendar/CalendarService.swift:324 — EventKitCalendarService.update has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 5, ternaries 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · AppleScriptToolDispatch.literalsForDispatch (cognitive 29) · ×1
  • AppleScriptToolDispatch.literalsForDispatch (cognitive 29) Packages/OsaurusCore/AppleScript/Tool/AppleScriptToolDispatch.swift:413 — AppleScriptToolDispatch.literalsForDispatch has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 15, if/else 10 (14 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 · ConfigPlanner.planTools (cognitive 29) · ×1
  • ConfigPlanner.planTools (cognitive 29) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1683 — ConfigPlanner.planTools has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (23 pts), ternaries 1 (3 pts), loops 2, 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 · ModelManager.fetchRemoteMLXModels (cognitive 29) · ×1
  • ModelManager.fetchRemoteMLXModels (cognitive 29) Packages/OsaurusCore/Managers/Model/ModelManager.swift:366 — ModelManager.fetchRemoteMLXModels has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (18 pts), loops 5 (7 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 · ModelManager.refreshAutomaticModelUpdates (cognitive 29) · ×1
  • ModelManager.refreshAutomaticModelUpdates (cognitive 29) Packages/OsaurusCore/Managers/Model/ModelUpdatePolling.swift:143 — ModelManager.refreshAutomaticModelUpdates has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (24 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 · OpenResponsesRequest.toChatCompletionRequest (cognitive 29) · ×1
  • OpenResponsesRequest.toChatCompletionRequest (cognitive 29) Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:1527 — OpenResponsesRequest.toChatCompletionRequest has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 3 (7 pts), match/switch 3 (6 pts), boolean chains 2, 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 · MLXModel.localBundleWeightSizeBytes (cognitive 29) · ×1
  • MLXModel.localBundleWeightSizeBytes (cognitive 29) Packages/OsaurusCore/Models/Configuration/MLXModel.swift:191 — MLXModel.localBundleWeightSizeBytes has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 10, loops 2 (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 · WorkflowCondition.issues (cognitive 29) · ×1
  • WorkflowCondition.issues (cognitive 29) Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:1823 — WorkflowCondition.issues has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (25 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 · SpokenDigitRuns.find (cognitive 29) · ×1
  • SpokenDigitRuns.find (cognitive 29) Packages/OsaurusCore/PrivacyFilter/Core/SpokenNumberDetector.swift:81 — SpokenDigitRuns.find has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 7, ternaries 2 (7 pts), 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 · AgentChannelConnectionService.diagnostics (cognitive 29) · ×1
  • AgentChannelConnectionService.diagnostics (cognitive 29) Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:105 — AgentChannelConnectionService.diagnostics has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 7 (22 pts), if/else 2 (4 pts), match/switch 1 (2 pts), error handling 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ContextBudgetManager.trimMessagesReportingOverflow (cognitive 29) · ×1
  • ContextBudgetManager.trimMessagesReportingOverflow (cognitive 29) Packages/OsaurusCore/Services/Chat/ContextBudgetManager.swift:369 — ContextBudgetManager.trimMessagesReportingOverflow has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 6 (9 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 8). Of this number, 26 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EventMatcher.rankChannelEvents (cognitive 29) · ×1
  • EventMatcher.rankChannelEvents (cognitive 29) Packages/OsaurusCore/Services/Event/EventMatcher.swift:39 — EventMatcher.rankChannelEvents has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 8, 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 · FolderEventSource.processCurrentState (cognitive 29) · ×1
  • FolderEventSource.processCurrentState (cognitive 29) Packages/OsaurusCore/Services/Event/FolderEventSource.swift:235 — FolderEventSource.processCurrentState has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 5, ternaries 2 (4 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 · PendingImportProcessor.removeItem (cognitive 29) · ×1
  • PendingImportProcessor.removeItem (cognitive 29) Packages/OsaurusCore/Services/Import/PendingImportProcessor.swift:875 — PendingImportProcessor.removeItem has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 7, 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 · Registry.snapshotDiagnostics (cognitive 29) · ×1
  • Registry.snapshotDiagnostics (cognitive 29) Packages/OsaurusCore/Services/ModelRuntime/MLXBatchAdapter.swift:675 — Registry.snapshotDiagnostics has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 3, 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 · TokenizerBridge.applyDeepseekV4NativeTemplate (cognitive 29) · ×1
  • TokenizerBridge.applyDeepseekV4NativeTemplate (cognitive 29) Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.swift:904 — TokenizerBridge.applyDeepseekV4NativeTemplate has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 8, ternaries 3 (4 pts), match/switch 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 · RemoteProviderService.dispatchFinal (cognitive 29) · ×1
  • RemoteProviderService.dispatchFinal (cognitive 29) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:2834 — RemoteProviderService.dispatchFinal has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 8, match/switch 2 (4 pts), loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToolNodeExecutor.run (cognitive 29) · ×1
  • ToolNodeExecutor.run (cognitive 29) Packages/OsaurusCore/Services/Workflow/ToolNodeExecutor.swift:88 — ToolNodeExecutor.run has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (17 pts), ternaries 4 (7 pts), boolean chains 3, 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 · FloatingInputCard.modelPickerOptionsControl (cognitive 29) · ×1
  • FloatingInputCard.modelPickerOptionsControl (cognitive 29) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:3482 — FloatingInputCard.modelPickerOptionsControl has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (16 pts), ternaries 5 (10 pts), boolean chains 3 (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 · OverviewTab.summaryHeadline (cognitive 29) · ×1
  • OverviewTab.summaryHeadline (cognitive 29) Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:1131 — OverviewTab.summaryHeadline has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 10 (19 pts), if/else 2 (4 pts), boolean chains 3, match/switch 2 (3 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 · ToolsManagerView.updateFilteredLists (cognitive 29) · ×1
  • ToolsManagerView.updateFilteredLists (cognitive 29) Packages/OsaurusCore/Views/Plugin/ToolsManagerView.swift:395 — ToolsManagerView.updateFilteredLists has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 11, loops 1 (nesting depth added 5). Of this number, 27 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 · CatalogPreviewInspection.label (cognitive 29) · ×1
  • CatalogPreviewInspection.label (cognitive 29) Packages/OsaurusCore/Models/Theme/DesignLibrary/CatalogPreviewInspection.swift:15 — CatalogPreviewInspection.label has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (17 pts), ternaries 5 (9 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · XMLFeedReader.parser (cognitive 29) · ×1
  • XMLFeedReader.parser (cognitive 29) Packages/OsaurusCore/Services/Event/Feed/FeedParser.swift:238 — XMLFeedReader.parser has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 11, 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 · MCPOAuthService.signIn (cognitive 29) · ×1
  • MCPOAuthService.signIn (cognitive 29) Packages/OsaurusCore/Services/MCP/OAuth/MCPOAuthService.swift:117 — MCPOAuthService.signIn has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10, error handling 6 (8 pts), boolean chains 5, ternaries 3 (4 pts), match/switch 2 (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 · ImportCommand.loadAndCheck (cognitive 28) · ×1
  • ImportCommand.loadAndCheck (cognitive 28) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Import/ImportCommand.swift:333 — ImportCommand.loadAndCheck has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (17 pts), error handling 4, loops 2, match/switch 1 (2 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EvalDiff.classifyPerf (cognitive 28) · ×1
  • EvalDiff.classifyPerf (cognitive 28) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalDiff.swift:447 — EvalDiff.classifyPerf has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 6 (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 · Lines.replace (cognitive 28) · ×1
  • Lines.replace (cognitive 28) Packages/OsaurusCore/Folder/FileEditMatcher.swift:234 — Lines.replace has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 7, loops 3, match/switch 1 (2 pts), ternaries 1 (nesting depth added 6). Of this number, 26 points are the body's own statements and 2 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 · FileTreeTool.entries · ×1
  • FileTreeTool.entries::traverse (cognitive 28) Packages/OsaurusCore/Folder/FolderTools.swift:879 — FileTreeTool.entries::traverse has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (24 pts), ternaries 1 (2 pts), boolean chains 1, 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 · FileEditTool.applyEdits (cognitive 28) · ×1
  • FileEditTool.applyEdits (cognitive 28) Packages/OsaurusCore/Folder/FolderTools.swift:4273 — FileEditTool.applyEdits has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 5 (14 pts), if/else 3 (11 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BackgroundTaskManager.lookupReattachableSession (cognitive 28) · ×1
  • BackgroundTaskManager.lookupReattachableSession (cognitive 28) Packages/OsaurusCore/Managers/BackgroundTaskManager.swift:1433 — BackgroundTaskManager.lookupReattachableSession has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 8, ternaries 2 (3 pts), 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 · SpawnPermissionGate.authorize (cognitive 28) · ×1
  • SpawnPermissionGate.authorize (cognitive 28) Packages/OsaurusCore/Subagent/SpawnPermissionGate.swift:85 — SpawnPermissionGate.authorize has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 5, error handling 2 (3 pts), match/switch 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 · SandboxReadFileTool.execute (cognitive 28) · ×1
  • SandboxReadFileTool.execute (cognitive 28) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1707 — SandboxReadFileTool.execute has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (16 pts), ternaries 4 (8 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · CapabilitiesLoadTool.loadTool (cognitive 28) · ×1
  • CapabilitiesLoadTool.loadTool (cognitive 28) Packages/OsaurusCore/Tools/CapabilityTools.swift:1233 — CapabilitiesLoadTool.loadTool has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 6 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ToolWirePropertyOrder.orderSchema (cognitive 28) · ×1
  • ToolWirePropertyOrder.orderSchema (cognitive 28) Packages/OsaurusCore/Tools/ToolWirePropertyOrder.swift:102 — ToolWirePropertyOrder.orderSchema has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (22 pts), match/switch 2 (5 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 · AgentAction.argumentsJSON (cognitive 28) · ×1
  • AgentAction.argumentsJSON (cognitive 28) Packages/OsaurusCore/ComputerUse/Model/AgentAction.swift:224 — AgentAction.argumentsJSON has cognitive complexity 28 (threshold 15). Drivers by points: if/else 21 (27 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ConfigApplier.applyLocked (cognitive 28) · ×1
  • ConfigApplier.applyLocked (cognitive 28) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:112 — ConfigApplier.applyLocked has cognitive complexity 28 (threshold 15). Drivers by points: if/else 22 (24 pts), boolean chains 2, loops 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 · ConfigApplier.applyDefaultAgent (cognitive 28) · ×1
  • ConfigApplier.applyDefaultAgent (cognitive 28) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:340 — ConfigApplier.applyDefaultAgent has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (19 pts), ternaries 2 (4 pts), match/switch 1 (3 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 · ConfigChannelAccounts.validate (cognitive 28) · ×1
  • ConfigChannelAccounts.validate (cognitive 28) Packages/OsaurusCore/Configuration/Declarative/ConfigChannelAccounts.swift:45 — ConfigChannelAccounts.validate has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (22 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigDiff.walk (cognitive 28) · ×1
  • ConfigDiff.walk (cognitive 28) Packages/OsaurusCore/Configuration/Declarative/ConfigDiff.swift:116 — ConfigDiff.walk has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (8 pts), ternaries 3 (5 pts), boolean chains 2, match/switch 1 (nesting depth added 12). Of this number, 21 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 · OpenResponsesRequest.toResponsesInferenceRequest (cognitive 28) · ×1
  • OpenResponsesRequest.toResponsesInferenceRequest (cognitive 28) Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:1306 — OpenResponsesRequest.toResponsesInferenceRequest has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 3 (6 pts), boolean chains 2, loops 1 (2 pts), ternaries 2 (nesting depth added 11). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentTargetResolver.resolve (cognitive 28) · ×1
  • AgentTargetResolver.resolve (cognitive 28) Packages/OsaurusCore/Models/Agent/AgentDispatchTarget.swift:205 — AgentTargetResolver.resolve has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (16 pts), match/switch 3 (5 pts), boolean chains 4, ternaries 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 · ToolApprovalPresentation.guarantees (cognitive 28) · ×1
  • ToolApprovalPresentation.guarantees (cognitive 28) Packages/OsaurusCore/Models/Tool/ToolApprovalPresentation.swift:320 — ToolApprovalPresentation.guarantees has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 6, ternaries 2 (5 pts), match/switch 2 (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 · SchemaSnapshot.renderFull (cognitive 28) · ×1
  • SchemaSnapshot.renderFull (cognitive 28) Packages/OsaurusCore/Services/AgentBridge/SchemaSnapshot.swift:102 — SchemaSnapshot.renderFull has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (7 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentChannelCustomJSONRunner.prepareRequest (cognitive 28) · ×1
  • AgentChannelCustomJSONRunner.prepareRequest (cognitive 28) Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:864 — AgentChannelCustomJSONRunner.prepareRequest has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 3, 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 · AgentChannelCustomJSONRunner.blockedHostReason (cognitive 28) · ×1
  • AgentChannelCustomJSONRunner.blockedHostReason (cognitive 28) Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:1848 — AgentChannelCustomJSONRunner.blockedHostReason has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (20 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 · AgentTaskState.nextStepBias (cognitive 28) · ×1
  • AgentTaskState.nextStepBias (cognitive 28) Packages/OsaurusCore/Services/Chat/AgentTaskState.swift:1027 — AgentTaskState.nextStepBias has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 6, 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 · ContextCompactionService.renderTranscript (cognitive 28) · ×1
  • ContextCompactionService.renderTranscript (cognitive 28) Packages/OsaurusCore/Services/Chat/ContextCompactionService.swift:617 — ContextCompactionService.renderTranscript has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 3 (7 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WebhookHandshakeResponder.respond (cognitive 28) · ×1
  • WebhookHandshakeResponder.respond (cognitive 28) Packages/OsaurusCore/Services/Event/WebhookProviderProfile.swift:510 — WebhookHandshakeResponder.respond has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 11, ternaries 2 (4 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · FileDiffEngine.diff (cognitive 28) · ×1
  • FileDiffEngine.diff (cognitive 28) Packages/OsaurusCore/Services/FileHistory/FileDiffEngine.swift:75 — FileDiffEngine.diff has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 12, ternaries 2 (nesting depth added 3). Of this number, 23 points are the body's own statements and 5 belong to 2 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 · SetupChecker.check (cognitive 28) · ×1
  • SetupChecker.check (cognitive 28) Packages/OsaurusCore/Services/Template/SetupChecker.swift:838 — SetupChecker.check has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 5, match/switch 1 (3 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 · MediaNodeExecutor.runLocal (cognitive 28) · ×1
  • MediaNodeExecutor.runLocal (cognitive 28) Packages/OsaurusCore/Services/Workflow/MediaNodeExecutor.swift:442 — MediaNodeExecutor.runLocal has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 5, error handling 2 (3 pts), ternaries 2 (3 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReplyNodeExecutor.run (cognitive 28) · ×1
  • ReplyNodeExecutor.run (cognitive 28) Packages/OsaurusCore/Services/Workflow/ReplyNodeExecutor.swift:20 — ReplyNodeExecutor.run has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 2, 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 · WorkflowRunner.attempt (cognitive 28) · ×1
  • WorkflowRunner.attempt (cognitive 28) Packages/OsaurusCore/Services/Workflow/WorkflowRunner.swift:991 — WorkflowRunner.attempt has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (15 pts), error handling 4 (7 pts), boolean chains 3, ternaries 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 · WorkflowRunsTool.nodeDetail (cognitive 28) · ×1
  • WorkflowRunsTool.nodeDetail (cognitive 28) Packages/OsaurusCore/Tools/Workflow/WorkflowRunsTool.swift:321 — WorkflowRunsTool.nodeDetail has cognitive complexity 28 (threshold 15). Drivers by points: if/else 19 (22 pts), ternaries 2 (5 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · NativeActivityGroupView.applyAssignedLayout (cognitive 28) · ×1
  • NativeActivityGroupView.applyAssignedLayout (cognitive 28) Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:257 — NativeActivityGroupView.applyAssignedLayout has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 11, 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 · NativeMessageCellView.configureAsParagraph (cognitive 28) · ×1
  • NativeMessageCellView.configureAsParagraph (cognitive 28) Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2647 — NativeMessageCellView.configureAsParagraph has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 7, ternaries 4 (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 · NativeToolCallRowView.markdownForConfigResult (cognitive 28) · ×1
  • NativeToolCallRowView.markdownForConfigResult (cognitive 28) Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:1862 — NativeToolCallRowView.markdownForConfigResult has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 9, loops 2 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AnchoredCardCoordinator.updatePresentation (cognitive 28) · ×1
  • AnchoredCardCoordinator.updatePresentation (cognitive 28) Packages/OsaurusCore/Views/Common/AnchoredCardPresenter.swift:292 — AnchoredCardCoordinator.updatePresentation has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 13 (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 · SettingsTextField.body (cognitive 28) · ×1
  • SettingsTextField.body (cognitive 28) Packages/OsaurusCore/Views/DesignSystem/SettingsFields.swift:153 — SettingsTextField.body has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 11 (16 pts), if/else 8 (9 pts), boolean chains 3 (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 · ModelRowCellView.layout (cognitive 28) · ×1
  • ModelRowCellView.layout (cognitive 28) Packages/OsaurusCore/Views/Model/ModelPickerTableRepresentable.swift:842 — ModelRowCellView.layout has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 2, loops 1, ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentChannelDestinationEditorSheet.discoverRooms (cognitive 28) · ×1
  • AgentChannelDestinationEditorSheet.discoverRooms (cognitive 28) Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:1334 — AgentChannelDestinationEditorSheet.discoverRooms has cognitive complexity 28 (threshold 15). Drivers by points: if/else 3 (11 pts), ternaries 3 (8 pts), loops 2 (5 pts), boolean chains 3, error handling 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 · SkillsView.body (cognitive 28) · ×1
  • SkillsView.body (cognitive 28) Packages/OsaurusCore/Views/Skill/SkillsView.swift:70 — SkillsView.body has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (16 pts), ternaries 5 (9 pts), boolean chains 3 (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 · AssignedNativeMenuItems.menuRows (cognitive 28) · ×1
  • AssignedNativeMenuItems.menuRows (cognitive 28) Packages/OsaurusCore/Models/Theme/InspectionAdapters/AssignedMenuPresentation.swift:579 — AssignedNativeMenuItems.menuRows has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 6 (12 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 · PPTXEditor.replaceText (cognitive 28) · ×1
  • PPTXEditor.replaceText (cognitive 28) Packages/OsaurusCore/Services/Documents/OOXML/PPTXEditor.swift:119 — PPTXEditor.replaceText has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 2 (6 pts), loops 4 (5 pts), ternaries 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 · PPTXEditor.setText (cognitive 28) · ×1
  • PPTXEditor.setText (cognitive 28) Packages/OsaurusCore/Services/Documents/OOXML/PPTXEditor.swift:213 — PPTXEditor.setText has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3 (5 pts), ternaries 2 (4 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 · EmailMIME.split (cognitive 28) · ×1
  • EmailMIME.split (cognitive 28) Packages/OsaurusCore/Services/Event/Email/EmailMIME.swift:299 — EmailMIME.split has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 9, loops 3 (4 pts), 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 · LanguageModelCatalog.makeLists (cognitive 28) · ×1
  • LanguageModelCatalog.makeLists (cognitive 28) Packages/OsaurusCore/Views/Model/Catalog/LanguageCatalogSource.swift:134 — LanguageModelCatalog.makeLists has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 6, loops 5, match/switch 2 (nesting depth added 5). Of this number, 19 points are the body's own statements and 9 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EvalRunner.runReasoningChannelCase (cognitive 27) · ×1
  • EvalRunner.runReasoningChannelCase (cognitive 27) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerReasoningChannel.swift:43 — EvalRunner.runReasoningChannelCase has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 5 (8 pts), ternaries 3, boolean chains 2, match/switch 1 (nesting depth added 6). Of this number, 25 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · InspectorMessageExamples.make (cognitive 27) · ×1
  • InspectorMessageExamples.make (cognitive 27) Packages/OsaurusCore/DevelopmentDesign/InspectorMessageConfigurations.swift:79 — InspectorMessageExamples.make has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 7 (12 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · FileWriteTool.writeDocument (cognitive 27) · ×1
  • FileWriteTool.writeDocument (cognitive 27) Packages/OsaurusCore/Folder/FolderTools.swift:3261 — FileWriteTool.writeDocument has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 8 (9 pts), error handling 4, 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 · BackgroundTaskManager.schedulingStatusChanged (cognitive 27) · ×1
  • BackgroundTaskManager.schedulingStatusChanged (cognitive 27) Packages/OsaurusCore/Managers/BackgroundTaskManager.swift:1653 — BackgroundTaskManager.schedulingStatusChanged has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 6 (12 pts), match/switch 2 (3 pts) (nesting depth added 13). 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 · TTSService.startPocketPlayback (cognitive 27) · ×1
  • TTSService.startPocketPlayback (cognitive 27) Packages/OsaurusCore/Managers/TTSService.swift:462 — TTSService.startPocketPlayback has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (13 pts), ternaries 4 (6 pts), loops 2 (5 pts), error handling 3 (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 · HTTPHandler.handleMemoryIngest (cognitive 27) · ×1
  • HTTPHandler.handleMemoryIngest (cognitive 27) Packages/OsaurusCore/Networking/HTTPHandler.swift:4703 — HTTPHandler.handleMemoryIngest has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 5 (10 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 · SecureChannelResponseEncryptor.write (cognitive 27) · ×1
  • SecureChannelResponseEncryptor.write (cognitive 27) Packages/OsaurusCore/Networking/SecureChannelResponseEncryptor.swift:65 — SecureChannelResponseEncryptor.write has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 3 (5 pts), error handling 1 (3 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 · DeclaredReasoningEffort.parseReasoningModes (cognitive 27) · ×1
  • DeclaredReasoningEffort.parseReasoningModes (cognitive 27) Packages/OsaurusCore/Services/DeclaredReasoningEffort.swift:366 — DeclaredReasoningEffort.parseReasoningModes has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 4, loops 2 (3 pts), ternaries 3, match/switch 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 · OsaurusTool.agentChannelFailure (cognitive 27) · ×1
  • OsaurusTool.agentChannelFailure (cognitive 27) Packages/OsaurusCore/Tools/AgentChannelTools.swift:21 — OsaurusTool.agentChannelFailure has cognitive complexity 27 (threshold 15). Drivers by points: match/switch 9 (18 pts), if/else 9 (nesting depth added 9). 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 · ShareArtifactTool.execute (cognitive 27) · ×1
  • ShareArtifactTool.execute (cognitive 27) Packages/OsaurusCore/Tools/ShareArtifactTool.swift:90 — ShareArtifactTool.execute has cognitive complexity 27 (threshold 15). Drivers by points: if/else 18 (20 pts), boolean chains 5, ternaries 2 (nesting depth added 2). Of this number, 25 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SpawnAgentTool.execute (cognitive 27) · ×1
  • SpawnAgentTool.execute (cognitive 27) Packages/OsaurusCore/Tools/SpawnAgentTool.swift:123 — SpawnAgentTool.execute has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 4, match/switch 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · CalculatorNode.evaluate (cognitive 27) · ×1
  • CalculatorNode.evaluate (cognitive 27) Packages/OsaurusCore/Utils/CalculatorEngine.swift:430 — CalculatorNode.evaluate has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 3 (8 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 13). 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 · ConfigYAML.checkMapping (cognitive 27) · ×1
  • ConfigYAML.checkMapping (cognitive 27) Packages/OsaurusCore/Configuration/Declarative/ConfigYAML.swift:230 — ConfigYAML.checkMapping has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 7, 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 · OsaurusConfigTool.handleTemplates (cognitive 27) · ×1
  • OsaurusConfigTool.handleTemplates (cognitive 27) Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool.swift:685 — OsaurusConfigTool.handleTemplates has cognitive complexity 27 (threshold 15). Drivers by points: if/else 20, boolean chains 5, match/switch 1, 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 · ChatSessionExporter.markdown (cognitive 27) · ×1
  • ChatSessionExporter.markdown (cognitive 27) Packages/OsaurusCore/Managers/Chat/ChatSessionExporter.swift:34 — ChatSessionExporter.markdown has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 3 (7 pts), boolean chains 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 · PluginManager._loadAll (cognitive 27) · ×1
  • PluginManager._loadAll (cognitive 27) Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:238 — PluginManager._loadAll has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 5 (8 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodeBlockMasker.findCodeSpans (cognitive 27) · ×1
  • CodeBlockMasker.findCodeSpans (cognitive 27) Packages/OsaurusCore/PrivacyFilter/Core/CodeBlockMasker.swift:151 — CodeBlockMasker.findCodeSpans has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 2 (4 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentChannelMessageFormatter.stripInlineMarkdown (cognitive 27) · ×1
  • AgentChannelMessageFormatter.stripInlineMarkdown (cognitive 27) Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:124 — AgentChannelMessageFormatter.stripInlineMarkdown has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (22 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. This shape REPEATS in the file: one other method here (AgentChannelMessageFormatter.telegramInlineHTML) 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 · AgentChannelMessageFormatter.telegramInlineHTML (cognitive 27) · ×1
  • AgentChannelMessageFormatter.telegramInlineHTML (cognitive 27) Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:330 — AgentChannelMessageFormatter.telegramInlineHTML has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (22 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. This shape REPEATS in the file: one other method here (AgentChannelMessageFormatter.stripInlineMarkdown) 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 · DocumentEditService.prepare (cognitive 27) · ×1
  • DocumentEditService.prepare (cognitive 27) Packages/OsaurusCore/Services/Documents/DocumentEditService.swift:114 — DocumentEditService.prepare has cognitive complexity 27 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 8 (9 pts), error handling 3, match/switch 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 · ChatSession.runVideoGeneration (cognitive 27) · ×1
  • ChatSession.runVideoGeneration (cognitive 27) Packages/OsaurusCore/Views/Chat/ChatView.swift:7164 — ChatSession.runVideoGeneration has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, ternaries 3 (4 pts), error handling 3, match/switch 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FloatingInputCard.attachClipboardSnippet (cognitive 27) · ×1
  • FloatingInputCard.attachClipboardSnippet (cognitive 27) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:4271 — FloatingInputCard.attachClipboardSnippet has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (21 pts), error handling 1 (3 pts), boolean chains 2, 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 · NativeActivityGroupView.configure (cognitive 27) · ×1
  • NativeActivityGroupView.configure (cognitive 27) Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:93 — NativeActivityGroupView.configure has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 10, ternaries 4 (5 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 · NativeMarkdownTableView.relayoutImpl (cognitive 27) · ×1
  • NativeMarkdownTableView.relayoutImpl (cognitive 27) Packages/OsaurusCore/Views/Chat/NativeBlockViews.swift:1407 — NativeMarkdownTableView.relayoutImpl has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 4 (6 pts), boolean chains 5 (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 · AgentChannelConnectionDraft.validationFindings (cognitive 27) · ×1
  • AgentChannelConnectionDraft.validationFindings (cognitive 27) Packages/OsaurusCore/Views/Settings/AgentChannelCustomConnectionSheet.swift:1192 — AgentChannelConnectionDraft.validationFindings has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 2 (5 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DOCXEditor.expandIntoParagraphs (cognitive 27) · ×1
  • DOCXEditor.expandIntoParagraphs (cognitive 27) Packages/OsaurusCore/Services/Documents/OOXML/DOCXEditor.swift:275 — DOCXEditor.expandIntoParagraphs has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 3 (6 pts), ternaries 2 (6 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 · PPTXEditor.deleteSlide (cognitive 27) · ×1
  • PPTXEditor.deleteSlide (cognitive 27) Packages/OsaurusCore/Services/Documents/OOXML/PPTXEditor.swift:354 — PPTXEditor.deleteSlide has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 5 (7 pts), boolean chains 3, 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 · XLSXEditor.setCells (cognitive 27) · ×1
  • XLSXEditor.setCells (cognitive 27) Packages/OsaurusCore/Services/Documents/OOXML/XLSXEditor.swift:175 — XLSXEditor.setCells has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (17 pts), loops 3 (5 pts), ternaries 3, boolean chains 1, match/switch 1 (nesting depth added 6). Of this number, 19 points are the body's own statements and 8 belong to 2 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 · Tokenizer.tokens (cognitive 27) · ×1
  • Tokenizer.tokens (cognitive 27) Packages/OsaurusCore/Services/Event/Email/IMAPClient.swift:253 — Tokenizer.tokens has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (18 pts), ternaries 1 (4 pts), boolean chains 2, match/switch 1 (2 pts), 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 · OsaurusEvalsCLI.loadFloors (cognitive 26) · ×1
  • OsaurusEvalsCLI.loadFloors (cognitive 26) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/OsaurusEvalsCLI.swift:499 — OsaurusEvalsCLI.loadFloors has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 3 (5 pts) (nesting depth added 12). Of this number, 13 points are the body's own statements and 13 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 · EvalRunner.prefillProgressAccountingProblem (cognitive 26) · ×1
  • EvalRunner.prefillProgressAccountingProblem (cognitive 26) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerCacheProof.swift:749 — EvalRunner.prefillProgressAccountingProblem has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 9, 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 · OsaurusLocalClient.runAgent (cognitive 26) · ×1
  • OsaurusLocalClient.runAgent (cognitive 26) Packages/OsaurusCore/AppIntents/OsaurusLocalClient.swift:72 — OsaurusLocalClient.runAgent has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileEditMatcher.relaxedMatches (cognitive 26) · ×1
  • FileEditMatcher.relaxedMatches (cognitive 26) Packages/OsaurusCore/Folder/FileEditMatcher.swift:386 — FileEditMatcher.relaxedMatches has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 4 (11 pts), boolean chains 2, match/switch 1 (nesting depth added 13). 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 · MCPProviderManager.createStdioTransport (cognitive 26) · ×1
  • MCPProviderManager.createStdioTransport (cognitive 26) Packages/OsaurusCore/Managers/MCPProviderManager.swift:1563 — MCPProviderManager.createStdioTransport has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (20 pts), error handling 2 (5 pts), match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · RelayTunnelManager.connect (cognitive 26) · ×1
  • RelayTunnelManager.connect (cognitive 26) Packages/OsaurusCore/Networking/RelayTunnelManager.swift:457 — RelayTunnelManager.connect has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (14 pts), loops 4 (6 pts), boolean chains 4, error handling 1 (2 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.
D2 · Cognitive Complexity · ModelSSDResidency.fetch (cognitive 26) · ×1
  • ModelSSDResidency.fetch (cognitive 26) Packages/OsaurusCore/Services/ModelSSDResidency.swift:210 — ModelSSDResidency.fetch has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 8, 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 · StorageExportService.recoverInterruptedRotation (cognitive 26) · ×1
  • StorageExportService.recoverInterruptedRotation (cognitive 26) Packages/OsaurusCore/Storage/StorageExportService.swift:305 — StorageExportService.recoverInterruptedRotation has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (16 pts), error handling 4 (7 pts), 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 · AppleScriptToolDispatch.exactReplacementLiterals (cognitive 26) · ×1
  • AppleScriptToolDispatch.exactReplacementLiterals (cognitive 26) Packages/OsaurusCore/AppleScript/Tool/AppleScriptToolDispatch.swift:519 — AppleScriptToolDispatch.exactReplacementLiterals has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 16, if/else 5 (7 pts), match/switch 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 · ConfigPlanner.planHarnessRuntimes (cognitive 26) · ×1
  • ConfigPlanner.planHarnessRuntimes (cognitive 26) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2053 — ConfigPlanner.planHarnessRuntimes has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 3 (6 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 · ConfigPlanner.planProviders (cognitive 26) · ×1
  • ConfigPlanner.planProviders (cognitive 26) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2306 — ConfigPlanner.planProviders has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 1 (4 pts), boolean chains 3, 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 · OsaurusImportTool.execute (cognitive 26) · ×1
  • OsaurusImportTool.execute (cognitive 26) Packages/OsaurusCore/Configuration/Declarative/OsaurusImportTool.swift:44 — OsaurusImportTool.execute has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (17 pts), boolean chains 6, loops 1 (2 pts), match/switch 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ChatWindowState.loadSession (cognitive 26) · ×1
  • ChatWindowState.loadSession (cognitive 26) Packages/OsaurusCore/Managers/Chat/ChatWindowState.swift:1932 — ChatWindowState.loadSession has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 8 (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 · ModelManager.scanLocalModels · ×1
  • ModelManager.scanLocalModels::scanDir (cognitive 26) Packages/OsaurusCore/Managers/Model/ModelManager.swift:2472 — ModelManager.scanLocalModels::scanDir has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (19 pts), ternaries 1 (3 pts), boolean chains 2, loops 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 · SharedArtifact.processToolResultDetailed (cognitive 26) · ×1
  • SharedArtifact.processToolResultDetailed (cognitive 26) Packages/OsaurusCore/Models/Chat/SharedArtifact.swift:318 — SharedArtifact.processToolResultDetailed has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 2 (6 pts), error handling 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 · WorkflowDraftOp.parseConnection (cognitive 26) · ×1
  • WorkflowDraftOp.parseConnection (cognitive 26) Packages/OsaurusCore/Models/Workflow/WorkflowDraft.swift:296 — WorkflowDraftOp.parseConnection has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 11, if/else 9 (10 pts), ternaries 5 (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 · AgentChannelPublishService.classifyProviderFailure (cognitive 26) · ×1
  • AgentChannelPublishService.classifyProviderFailure (cognitive 26) Packages/OsaurusCore/Services/AgentChannel/AgentChannelPublishService.swift:1131 — AgentChannelPublishService.classifyProviderFailure has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (16 pts), match/switch 4 (8 pts), ternaries 1 (2 pts) (nesting depth added 8). 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 · SignInSessionActions.status (cognitive 26) · ×1
  • SignInSessionActions.status (cognitive 26) Packages/OsaurusCore/Services/Credentials/SignInSessionActions.swift:22 — SignInSessionActions.status has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 5 (12 pts), if/else 4 (9 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 13). 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 · DiscordConnectionService.pollInboundMessages (cognitive 26) · ×1
  • DiscordConnectionService.pollInboundMessages (cognitive 26) Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:321 — DiscordConnectionService.pollInboundMessages has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 2 (3 pts), match/switch 1 (3 pts), ternaries 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 · IMessageHelperInstaller.machOArchitectures (cognitive 26) · ×1
  • IMessageHelperInstaller.machOArchitectures (cognitive 26) Packages/OsaurusCore/Services/IMessage/IMessageHelperInstaller.swift:325 — IMessageHelperInstaller.machOArchitectures has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 2 (4 pts), boolean chains 3, loops 1 (2 pts), match/switch 2 (nesting depth added 10). Of this number, 22 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 · SearchEngine.raceFree (cognitive 26) · ×1
  • SearchEngine.raceFree (cognitive 26) Packages/OsaurusCore/Services/Search/SearchEngine.swift:242 — SearchEngine.raceFree has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 6 (7 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 9). Of this number, 16 points are the body's own statements and 10 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClaudePluginInstaller.extractSiblingSkillNames (cognitive 26) · ×1
  • ClaudePluginInstaller.extractSiblingSkillNames (cognitive 26) Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:1367 — ClaudePluginInstaller.extractSiblingSkillNames has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 4 (7 pts), boolean chains 4, 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 · TaskScheduler.submit (cognitive 26) · ×1
  • TaskScheduler.submit (cognitive 26) Packages/OsaurusCore/Services/Task/TaskScheduler.swift:162 — TaskScheduler.submit has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 8, 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 · RegistryReviewWatcher.run (cognitive 26) · ×1
  • RegistryReviewWatcher.run (cognitive 26) Packages/OsaurusCore/Services/Template/RegistryReviewWatcher.swift:91 — RegistryReviewWatcher.run has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (12 pts), error handling 3 (7 pts), boolean chains 3, ternaries 1 (3 pts), 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 · WorkflowShareService.setExamples (cognitive 26) · ×1
  • WorkflowShareService.setExamples (cognitive 26) Packages/OsaurusCore/Services/Template/WorkflowShareService.swift:772 — WorkflowShareService.setExamples has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (13 pts), error handling 3 (9 pts), loops 2 (3 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 · DatabaseImport.parseDelimited (cognitive 26) · ×1
  • DatabaseImport.parseDelimited (cognitive 26) Packages/OsaurusCore/Tools/Database/DatabaseImport.swift:176 — DatabaseImport.parseDelimited has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 5, loops 2 (3 pts), 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 · WorkflowTestTool.execute (cognitive 26) · ×1
  • WorkflowTestTool.execute (cognitive 26) Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift:515 — WorkflowTestTool.execute has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (17 pts), match/switch 4 (6 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 · ChatCrossSelection.updateSelection (cognitive 26) · ×1
  • ChatCrossSelection.updateSelection (cognitive 26) Packages/OsaurusCore/Views/Chat/ChatCrossSelection.swift:187 — ChatCrossSelection.updateSelection has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 5 (8 pts), boolean chains 4, 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 · ChatSession.runRemoteImageGeneration (cognitive 26) · ×1
  • ChatSession.runRemoteImageGeneration (cognitive 26) Packages/OsaurusCore/Views/Chat/ChatView.swift:7055 — ChatSession.runRemoteImageGeneration has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (17 pts), ternaries 3, boolean chains 2, error handling 2, 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 · NativeCompactionMarkerView.configure (cognitive 26) · ×1
  • NativeCompactionMarkerView.configure (cognitive 26) Packages/OsaurusCore/Views/Chat/NativeCompactionMarkerView.swift:84 — NativeCompactionMarkerView.configure has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 3, loops 3, ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DiffBackgroundView.draw (cognitive 26) · ×1
  • DiffBackgroundView.draw (cognitive 26) Packages/OsaurusCore/Views/Chat/NativeFileDiffView.swift:35 — DiffBackgroundView.draw has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 3 (10 pts), if/else 4 (9 pts), boolean chains 6, 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 · FlowLayout.rebalanced (cognitive 26) · ×1
  • FlowLayout.rebalanced (cognitive 26) Packages/OsaurusCore/Views/Common/FlowLayout.swift:118 — FlowLayout.rebalanced has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 6 (9 pts), ternaries 2 (3 pts) (nesting depth added 13). 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 · PluginConfigView.readConfig (cognitive 26) · ×1
  • PluginConfigView.readConfig (cognitive 26) Packages/OsaurusCore/Views/Plugin/PluginConfigView.swift:398 — PluginConfigView.readConfig has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 8, 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 · DOCXEditor.replaceText (cognitive 26) · ×1
  • DOCXEditor.replaceText (cognitive 26) Packages/OsaurusCore/Services/Documents/OOXML/DOCXEditor.swift:190 — DOCXEditor.replaceText has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 4 (5 pts), error handling 1 (3 pts), ternaries 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 · LocalModelsCatalogPage.body (cognitive 26) · ×1
  • LocalModelsCatalogPage.body (cognitive 26) Packages/OsaurusCore/Views/Model/Catalog/LocalModelsCatalogPage.swift:45 — LocalModelsCatalogPage.body has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14, boolean chains 9, ternaries 2, 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 · ManifestValidate.validateTools (cognitive 25) · ×1
  • ManifestValidate.validateTools (cognitive 25) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Manifest/ManifestValidate.swift:292 — ManifestValidate.validateTools has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 2 (5 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 · EvalMatrixBuilder.errorCategory (cognitive 25) · ×1
  • EvalMatrixBuilder.errorCategory (cognitive 25) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalMatrix.swift:741 — EvalMatrixBuilder.errorCategory has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 17, 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 · DesignMessageChecks.run (cognitive 25) · ×1
  • DesignMessageChecks.run (cognitive 25) Packages/OsaurusCore/DevelopmentDesign/DesignMessageChecks.swift:5 — DesignMessageChecks.run has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13, boolean chains 10, loops 2. Of this number, 23 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · FileTreeTool.buildTree · ×1
  • FileTreeTool.buildTree::traverse (cognitive 25) Packages/OsaurusCore/Folder/FolderTools.swift:963 — FileTreeTool.buildTree::traverse has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (19 pts), ternaries 2 (4 pts), boolean chains 1, 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 · FileEditTool.execute (cognitive 25) · ×1
  • FileEditTool.execute (cognitive 25) Packages/OsaurusCore/Folder/FolderTools.swift:3747 — FileEditTool.execute has cognitive complexity 25 (threshold 15). Drivers by points: if/else 17 (21 pts), match/switch 3, boolean chains 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 · ToastAction.from (cognitive 25) · ×1
  • ToastAction.from (cognitive 25) Packages/OsaurusCore/Models/Toast.swift:372 — ToastAction.from has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 6, ternaries 2 (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 · HTTPHandler.workspaceKeyMayReach (cognitive 25) · ×1
  • HTTPHandler.workspaceKeyMayReach (cognitive 25) Packages/OsaurusCore/Networking/HTTPHandler.swift:4345 — HTTPHandler.workspaceKeyMayReach has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 11, match/switch 1, 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 · HTTPHandler.handleListSessionsEndpoint · ×1
  • HTTPHandler.handleListSessionsEndpoint::matches (cognitive 25) Packages/OsaurusCore/Networking/HTTPHandler.swift:8255 — HTTPHandler.handleListSessionsEndpoint::matches has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 6, ternaries 2 (4 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 · RelayTunnelManager.relayStreamingResponse (cognitive 25) · ×1
  • RelayTunnelManager.relayStreamingResponse (cognitive 25) Packages/OsaurusCore/Networking/RelayTunnelManager.swift:995 — RelayTunnelManager.relayStreamingResponse has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 3, loops 1 (2 pts), error handling 1 (nesting depth added 10). Of this number, 23 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 · SchemaJSONSlices.valueEnd (cognitive 25) · ×1
  • SchemaJSONSlices.valueEnd (cognitive 25) Packages/OsaurusCore/Networking/RequestValidator.swift:166 — SchemaJSONSlices.valueEnd has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 2, ternaries 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 · ExternalModelLocator.reconciledRegistry (cognitive 25) · ×1
  • ExternalModelLocator.reconciledRegistry (cognitive 25) Packages/OsaurusCore/Services/ExternalModelLocator.swift:457 — ExternalModelLocator.reconciledRegistry has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 8, loops 2 (nesting depth added 8). Of this number, 23 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 · MemoryDatabase.searchPinnedFactsText (cognitive 25) · ×1
  • MemoryDatabase.searchPinnedFactsText (cognitive 25) Packages/OsaurusCore/Storage/MemoryDatabase.swift:1486 — MemoryDatabase.searchPinnedFactsText has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 5 (7 pts), loops 2 (3 pts), boolean chains 1 (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. This shape REPEATS in the file: one other method here (MemoryDatabase.searchEpisodesText) 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 · MemoryDatabase.searchEpisodesText (cognitive 25) · ×1
  • MemoryDatabase.searchEpisodesText (cognitive 25) Packages/OsaurusCore/Storage/MemoryDatabase.swift:1907 — MemoryDatabase.searchEpisodesText has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 5 (7 pts), loops 2 (3 pts), boolean chains 1 (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. This shape REPEATS in the file: one other method here (MemoryDatabase.searchPinnedFactsText) 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 · RetainedToolResultStore.compactionContext (cognitive 25) · ×1
  • RetainedToolResultStore.compactionContext (cognitive 25) Packages/OsaurusCore/Storage/RetainedToolResultStore.swift:65 — RetainedToolResultStore.compactionContext has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 9, 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 · RetainedToolResultStore.makeRoom (cognitive 25) · ×1
  • RetainedToolResultStore.makeRoom (cognitive 25) Packages/OsaurusCore/Storage/RetainedToolResultStore.swift:312 — RetainedToolResultStore.makeRoom has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 8, loops 5 (7 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 · LoginShellPath.probe (cognitive 25) · ×1
  • LoginShellPath.probe (cognitive 25) Packages/OsaurusCore/Utils/LoginShellPath.swift:64 — LoginShellPath.probe has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 3 (5 pts), ternaries 2, boolean chains 1, error handling 1 (nesting depth added 9). Of this number, 20 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 · AppleScriptDictionaryService.distill (cognitive 25) · ×1
  • AppleScriptDictionaryService.distill (cognitive 25) Packages/OsaurusCore/AppleScript/Knowledge/AppleScriptDictionaryService.swift:136 — AppleScriptDictionaryService.distill has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 5 (8 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 · ScreenContextSnapshot.render (cognitive 25) · ×1
  • ScreenContextSnapshot.render (cognitive 25) Packages/OsaurusCore/ComputerUse/Perception/ScreenContextSnapshot.swift:131 — ScreenContextSnapshot.render has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 4, 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 · ConfigApplier.applyKnowledgeCollections (cognitive 25) · ×1
  • ConfigApplier.applyKnowledgeCollections (cognitive 25) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:1417 — ConfigApplier.applyKnowledgeCollections has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigPlanner.validateHarnessRuntimes (cognitive 25) · ×1
  • ConfigPlanner.validateHarnessRuntimes (cognitive 25) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1979 — ConfigPlanner.validateHarnessRuntimes has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (20 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 · ChatSessionExporter.timingSuffix (cognitive 25) · ×1
  • ChatSessionExporter.timingSuffix (cognitive 25) Packages/OsaurusCore/Managers/Chat/ChatSessionExporter.swift:238 — ChatSessionExporter.timingSuffix has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 8, ternaries 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 · AgentCapabilityReadiness.subagent (cognitive 25) · ×1
  • AgentCapabilityReadiness.subagent (cognitive 25) Packages/OsaurusCore/Models/Agent/AgentCapabilityReadiness.swift:133 — AgentCapabilityReadiness.subagent has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (21 pts), ternaries 1 (3 pts), match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · PrivacyFilterPipeline.wrapInboundStream (cognitive 25) · ×1
  • PrivacyFilterPipeline.wrapInboundStream (cognitive 25) Packages/OsaurusCore/PrivacyFilter/Core/PrivacyFilterPipeline.swift:974 — PrivacyFilterPipeline.wrapInboundStream has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (22 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 · SystemPromptComposer.appendProjectMemory (cognitive 25) · ×1
  • SystemPromptComposer.appendProjectMemory (cognitive 25) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:397 — SystemPromptComposer.appendProjectMemory has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 3, ternaries 1 (3 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 · CredentialStore.save (cognitive 25) · ×1
  • CredentialStore.save (cognitive 25) Packages/OsaurusCore/Services/Credentials/CredentialStore.swift:380 — CredentialStore.save has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 3, ternaries 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 · PDFReadingOrder.resolve (cognitive 25) · ×1
  • PDFReadingOrder.resolve (cognitive 25) Packages/OsaurusCore/Services/Documents/PDFReadingOrder.swift:90 — PDFReadingOrder.resolve has cognitive complexity 25 (threshold 15). Drivers by points: loops 5 (12 pts), if/else 3 (8 pts), boolean chains 2, match/switch 1 (2 pts), ternaries 1 (nesting depth added 13). 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 · KnowledgeDocumentParser.splitOversized (cognitive 25) · ×1
  • KnowledgeDocumentParser.splitOversized (cognitive 25) Packages/OsaurusCore/Services/Knowledge/KnowledgeDocumentParser.swift:263 — KnowledgeDocumentParser.splitOversized has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TokenizerBridge.compactCompletedDSV4ToolHistory (cognitive 25) · ×1
  • TokenizerBridge.compactCompletedDSV4ToolHistory (cognitive 25) Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.swift:1029 — TokenizerBridge.compactCompletedDSV4ToolHistory has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 8, 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 · PluginProcessHostClient.startReader (cognitive 25) · ×1
  • PluginProcessHostClient.startReader (cognitive 25) Packages/OsaurusCore/Services/Plugin/PluginProcessHost.swift:302 — PluginProcessHostClient.startReader has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 2 (3 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 · RemoteProviderService.streamResponses (cognitive 25) · ×1
  • RemoteProviderService.streamResponses (cognitive 25) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:748 — RemoteProviderService.streamResponses has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5, ternaries 2 (3 pts), 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 · WorkspaceAgentAccessHost.redeem (cognitive 25) · ×1
  • WorkspaceAgentAccessHost.redeem (cognitive 25) Packages/OsaurusCore/Services/Router/WorkspaceAgentAccessHost.swift:364 — WorkspaceAgentAccessHost.redeem has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 10, error handling 2, 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 · WorkspacesService.migrateShares (cognitive 25) · ×1
  • WorkspacesService.migrateShares (cognitive 25) Packages/OsaurusCore/Services/Router/WorkspacesService.swift:1056 — WorkspacesService.migrateShares has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 2 (6 pts), error handling 2 (4 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 · WhatsAppConnectionService.startPairing (cognitive 25) · ×1
  • WhatsAppConnectionService.startPairing (cognitive 25) Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:310 — WhatsAppConnectionService.startPairing has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 3 (5 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 · WorkflowEvalHarness.scoreArchitect (cognitive 25) · ×1
  • WorkflowEvalHarness.scoreArchitect (cognitive 25) Packages/OsaurusCore/Services/Workflow/WorkflowEvalHarness.swift:810 — WorkflowEvalHarness.scoreArchitect has cognitive complexity 25 (threshold 15). Drivers by points: loops 5 (8 pts), if/else 7, ternaries 5 (6 pts), boolean chains 4 (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 · SessionRow.navigatorRow (cognitive 25) · ×1
  • SessionRow.navigatorRow (cognitive 25) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:3176 — SessionRow.navigatorRow has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 14, if/else 6 (8 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AnchoredCardCoordinator.handle (cognitive 25) · ×1
  • AnchoredCardCoordinator.handle (cognitive 25) Packages/OsaurusCore/Views/Common/AnchoredCardPresenter.swift:564 — AnchoredCardCoordinator.handle has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 9 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OverviewTab.whereRows (cognitive 25) · ×1
  • OverviewTab.whereRows (cognitive 25) Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:1228 — OverviewTab.whereRows has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 5, 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 · AgentChannelConnectionCenterView.overviewEntries (cognitive 25) · ×1
  • AgentChannelConnectionCenterView.overviewEntries (cognitive 25) Packages/OsaurusCore/Views/Settings/AgentChannelConnectionCenterView.swift:393 — AgentChannelConnectionCenterView.overviewEntries has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 8 (18 pts), loops 3 (4 pts), if/else 1 (2 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 · PublishedWorkflowDashboard.saveListing (cognitive 25) · ×1
  • PublishedWorkflowDashboard.saveListing (cognitive 25) Packages/OsaurusCore/Views/Template/PublishedWorkflowDashboard.swift:791 — PublishedWorkflowDashboard.saveListing has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 4 (8 pts), boolean chains 4, match/switch 1 (3 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 · TemplateImportReviewView.workflowDetail (cognitive 25) · ×1
  • TemplateImportReviewView.workflowDetail (cognitive 25) Packages/OsaurusCore/Views/Template/TemplateImportReviewView.swift:138 — TemplateImportReviewView.workflowDetail has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 3 (8 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 · AccessibilityManager.focusedWindowHasContent (cognitive 25) · ×1
  • AccessibilityManager.focusedWindowHasContent (cognitive 25) Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:398 — AccessibilityManager.focusedWindowHasContent has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (4 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 12). Of this number, 24 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 · DesignLibraryPruning.pruned (cognitive 25) · ×1
  • DesignLibraryPruning.pruned (cognitive 25) Packages/OsaurusCore/Models/Theme/DesignLibrary/DesignLibraryPruning.swift:20 — DesignLibraryPruning.pruned has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 7, loops 4 (5 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 · InspectorAssignedTextField.updateNSView (cognitive 25) · ×1
  • InspectorAssignedTextField.updateNSView (cognitive 25) Packages/OsaurusCore/Models/Theme/DesignLibrary/InspectorAssignedTextField.swift:63 — InspectorAssignedTextField.updateNSView has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 6 (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 · XLSXEditor.expandSharedFormulas (cognitive 25) · ×1
  • XLSXEditor.expandSharedFormulas (cognitive 25) Packages/OsaurusCore/Services/Documents/OOXML/XLSXEditor.swift:586 — XLSXEditor.expandSharedFormulas has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 7, loops 4 (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 · EmailMIME.collect (cognitive 25) · ×1
  • EmailMIME.collect (cognitive 25) Packages/OsaurusCore/Services/Event/Email/EmailMIME.swift:262 — EmailMIME.collect has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6, loops 2 (6 pts), ternaries 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 · IMAPClient.command (cognitive 25) · ×1
  • IMAPClient.command (cognitive 25) Packages/OsaurusCore/Services/Event/Email/IMAPClient.swift:522 — IMAPClient.command has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 2 (8 pts), match/switch 2 (5 pts), boolean chains 2, loops 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 · WorkflowSecretsStep.oauthControls (cognitive 25) · ×1
  • WorkflowSecretsStep.oauthControls (cognitive 25) Packages/OsaurusCore/Views/Workflow/Library/WorkflowSetupWizardView.swift:829 — WorkflowSecretsStep.oauthControls has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 9, 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, 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 · OsaurusEvalsCLI.forensicsLabel (cognitive 24) · ×1
  • OsaurusEvalsCLI.forensicsLabel (cognitive 24) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/OsaurusEvalsCLI.swift:751 — OsaurusEvalsCLI.forensicsLabel has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 7 (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 · OsaurusEvalsCLI.runCompat (cognitive 24) · ×1
  • OsaurusEvalsCLI.runCompat (cognitive 24) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalDiffMatrixCLI.swift:210 — OsaurusEvalsCLI.runCompat has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 1 (2 pts), ternaries 1 (2 pts), error handling 1, 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 · EvalRunner.runComputerUseCase (cognitive 24) · ×1
  • EvalRunner.runComputerUseCase (cognitive 24) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:1107 — EvalRunner.runComputerUseCase has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 3, ternaries 2, loops 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 · OsaurusBundle.contentHash (cognitive 24) · ×1
  • OsaurusBundle.contentHash (cognitive 24) Packages/OsaurusRepository/ImportQueue.swift:394 — OsaurusBundle.contentHash has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 4, loops 2 (4 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 · CatalogLibraryFixture.featureContent (cognitive 24) · ×1
  • CatalogLibraryFixture.featureContent (cognitive 24) Packages/OsaurusCore/DevelopmentDesign/CatalogComponents.swift:650 — CatalogLibraryFixture.featureContent has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 9 (18 pts), if/else 3 (5 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 · FolderToolHelpers.resolvePath (cognitive 24) · ×1
  • FolderToolHelpers.resolvePath (cognitive 24) Packages/OsaurusCore/Folder/FolderTools.swift:179 — FolderToolHelpers.resolvePath has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 7, 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 · DeclaredReasoningEffort.flatNativeEfforts (cognitive 24) · ×1
  • DeclaredReasoningEffort.flatNativeEfforts (cognitive 24) Packages/OsaurusCore/Services/DeclaredReasoningEffort.swift:228 — DeclaredReasoningEffort.flatNativeEfforts has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 2 (5 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GitHubSkillService.detectDefaultBranch (cognitive 24) · ×1
  • GitHubSkillService.detectDefaultBranch (cognitive 24) Packages/OsaurusCore/Services/GitHubSkillService.swift:1952 — GitHubSkillService.detectDefaultBranch has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 4, error handling 3 (4 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 · ModelRuntime.extractImageSources (cognitive 24) · ×1
  • ModelRuntime.extractImageSources (cognitive 24) Packages/OsaurusCore/Services/ModelRuntime.swift:7630 — ModelRuntime.extractImageSources has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 6, 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 · SandboxWriteFileTool.execute (cognitive 24) · ×1
  • SandboxWriteFileTool.execute (cognitive 24) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2158 — SandboxWriteFileTool.execute has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 7 (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 · SandboxSecretSetTool.execute (cognitive 24) · ×1
  • SandboxSecretSetTool.execute (cognitive 24) Packages/OsaurusCore/Tools/SandboxSecretTools.swift:149 — SandboxSecretSetTool.execute has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (20 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 · ToolRegistry.availability (cognitive 24) · ×1
  • ToolRegistry.availability (cognitive 24) Packages/OsaurusCore/Tools/ToolRegistry.swift:3235 — ToolRegistry.availability has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 9 (nesting depth added 3). Of this number, 23 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 · MapsToolFactory.placeReference (cognitive 24) · ×1
  • MapsToolFactory.placeReference (cognitive 24) Packages/OsaurusCore/AppleApps/Maps/MapsTools.swift:84 — MapsToolFactory.placeReference has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 6 (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 · NativeMacDriver.perform (cognitive 24) · ×1
  • NativeMacDriver.perform (cognitive 24) Packages/OsaurusCore/ComputerUse/Driver/NativeMacDriver.swift:192 — NativeMacDriver.perform has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 1, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AgentToolSelectionResolver.apply (cognitive 24) · ×1
  • AgentToolSelectionResolver.apply (cognitive 24) Packages/OsaurusCore/Configuration/Declarative/AgentToolSelectionResolver.swift:124 — AgentToolSelectionResolver.apply has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 5 (7 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigEvents.export (cognitive 24) · ×1
  • ConfigEvents.export (cognitive 24) Packages/OsaurusCore/Configuration/Declarative/ConfigEvents.swift:248 — ConfigEvents.export has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 2 (4 pts), boolean chains 2, match/switch 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 · ConfigEvents.plan (cognitive 24) · ×1
  • ConfigEvents.plan (cognitive 24) Packages/OsaurusCore/Configuration/Declarative/ConfigEvents.swift:1066 — ConfigEvents.plan has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 2 (3 pts), ternaries 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 · PluginManager.deliverInitialConfig (cognitive 24) · ×1
  • PluginManager.deliverInitialConfig (cognitive 24) Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:601 — PluginManager.deliverInitialConfig has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 7, loops 2 (3 pts), 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 · LocalVisionEvidence.mimoAudioEvidence (cognitive 24) · ×1
  • LocalVisionEvidence.mimoAudioEvidence (cognitive 24) Packages/OsaurusCore/Models/Configuration/LocalVisionEvidence.swift:404 — LocalVisionEvidence.mimoAudioEvidence has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 23, if/else 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 · TemplateRequirements.items (cognitive 24) · ×1
  • TemplateRequirements.items (cognitive 24) Packages/OsaurusCore/Models/Template/TemplateRequirements.swift:424 — TemplateRequirements.items has cognitive complexity 24 (threshold 15). Drivers by points: loops 14 (15 pts), ternaries 3 (6 pts), if/else 2, boolean chains 1 (nesting depth added 4). Of this number, 22 points are the body's own statements and 2 belong to one function item inside it that branches. 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 · JSONSchemaValidator.schemaIssues (cognitive 24) · ×1
  • JSONSchemaValidator.schemaIssues (cognitive 24) Packages/OsaurusCore/Models/Workflow/JSONSchemaValidator.swift:147 — JSONSchemaValidator.schemaIssues has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 3 (7 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · WorkflowDiff.changes (cognitive 24) · ×1
  • WorkflowDiff.changes (cognitive 24) Packages/OsaurusCore/Models/Workflow/WorkflowDraft.swift:817 — WorkflowDiff.changes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 5, boolean chains 1, ternaries 1 (nesting depth added 10). Of this number, 22 points are the body's own statements and 2 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 · CodeBlockMasker.mask (cognitive 24) · ×1
  • CodeBlockMasker.mask (cognitive 24) Packages/OsaurusCore/PrivacyFilter/Core/CodeBlockMasker.swift:42 — CodeBlockMasker.mask has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 9, loops 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 · AgentTaskState.classify (cognitive 24) · ×1
  • AgentTaskState.classify (cognitive 24) Packages/OsaurusCore/Services/Chat/AgentTaskState.swift:1196 — AgentTaskState.classify has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 5, loops 1 (2 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 · ChatImportApplier.rollBack (cognitive 24) · ×1
  • ChatImportApplier.rollBack (cognitive 24) Packages/OsaurusCore/Services/ChatImport/ChatImportApplier.swift:393 — ChatImportApplier.rollBack has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 7, 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 · ChatImportReportTool.parse (cognitive 24) · ×1
  • ChatImportReportTool.parse (cognitive 24) Packages/OsaurusCore/Services/ChatImport/ChatImportReader.swift:231 — ChatImportReportTool.parse has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 6, loops 4, ternaries 1 (nesting depth added 4). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PDFEditor.printedLabels (cognitive 24) · ×1
  • PDFEditor.printedLabels (cognitive 24) Packages/OsaurusCore/Services/Documents/PDFEditor.swift:479 — PDFEditor.printedLabels has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · XLSXPackageArchive.readCentralDirectory (cognitive 24) · ×1
  • XLSXPackageArchive.readCentralDirectory (cognitive 24) Packages/OsaurusCore/Services/Documents/XLSXAdapter.swift:1012 — XLSXPackageArchive.readCentralDirectory has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 10, 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 · EventManager.ingestChannelMessage (cognitive 24) · ×1
  • EventManager.ingestChannelMessage (cognitive 24) Packages/OsaurusCore/Services/Event/ChannelMessageEventSource.swift:91 — EventManager.ingestChannelMessage has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 3, 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 · WebhookEventSource.receive (cognitive 24) · ×1
  • WebhookEventSource.receive (cognitive 24) Packages/OsaurusCore/Services/Event/WebhookEventSource.swift:135 — WebhookEventSource.receive has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (14 pts), ternaries 2 (5 pts), boolean chains 2, error handling 1 (2 pts), match/switch 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · FileChangeJournal.apply (cognitive 24) · ×1
  • FileChangeJournal.apply (cognitive 24) Packages/OsaurusCore/Services/FileHistory/FileChangeJournal+Revert.swift:427 — FileChangeJournal.apply has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (18 pts), ternaries 1 (3 pts), boolean chains 2, match/switch 1 (nesting depth added 9). Of this number, 20 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClaudeCodeStreamDecoder.decodeStreamEvent (cognitive 24) · ×1
  • ClaudeCodeStreamDecoder.decodeStreamEvent (cognitive 24) Packages/OsaurusCore/Services/Inference/ClaudeCodeStreamDecoder.swift:120 — ClaudeCodeStreamDecoder.decodeStreamEvent has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 5, match/switch 2 (3 pts) (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 · WorkspaceAgentRunClient.prepare (cognitive 24) · ×1
  • WorkspaceAgentRunClient.prepare (cognitive 24) Packages/OsaurusCore/Services/Router/WorkspaceAgentRunClient.swift:157 — WorkspaceAgentRunClient.prepare has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 4, error handling 1 (2 pts), match/switch 1, ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WorkspacesService.pollConfirmation (cognitive 24) · ×1
  • WorkspacesService.pollConfirmation (cognitive 24) Packages/OsaurusCore/Services/Router/WorkspacesService.swift:1681 — WorkspacesService.pollConfirmation has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (23 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 · ClaudePluginInstaller.fetchArtifacts (cognitive 24) · ×1
  • ClaudePluginInstaller.fetchArtifacts (cognitive 24) Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:868 — ClaudePluginInstaller.fetchArtifacts has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (8 pts), loops 8, error handling 3 (6 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 · SyncAttentionFeed.apply (cognitive 24) · ×1
  • SyncAttentionFeed.apply (cognitive 24) Packages/OsaurusCore/Services/Sync/SyncAttentionFeed.swift:237 — SyncAttentionFeed.apply has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 7, ternaries 2 (4 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 · SyncRunProgressContract.snapshot (cognitive 24) · ×1
  • SyncRunProgressContract.snapshot (cognitive 24) Packages/OsaurusCore/Services/Sync/SyncRunProgress.swift:102 — SyncRunProgressContract.snapshot has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10, ternaries 3 (8 pts), loops 3 (5 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 · WorkflowCallFeed.apply (cognitive 24) · ×1
  • WorkflowCallFeed.apply (cognitive 24) Packages/OsaurusCore/Services/Workflow/WorkflowCallFeed.swift:75 — WorkflowCallFeed.apply has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 1 (4 pts), match/switch 1 (3 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 · AgentDetailView.bodyCore (cognitive 24) · ×1
  • AgentDetailView.bodyCore (cognitive 24) Packages/OsaurusCore/Views/Agent/AgentsView.swift:1760 — AgentDetailView.bodyCore has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 6, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ChatEmptyState.greetingBlock (cognitive 24) · ×1
  • ChatEmptyState.greetingBlock (cognitive 24) Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:335 — ChatEmptyState.greetingBlock has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 9 (14 pts), if/else 6 (8 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatHistoryList.filteredSessions (cognitive 24) · ×1
  • ChatHistoryList.filteredSessions (cognitive 24) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:4242 — ChatHistoryList.filteredSessions has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 16, if/else 5 (8 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 · PasteMonitorView.handlePasteIfImage (cognitive 24) · ×1
  • PasteMonitorView.handlePasteIfImage (cognitive 24) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:6643 — PasteMonitorView.handlePasteIfImage has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (19 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 · NativeCodeBlockView.configure (cognitive 24) · ×1
  • NativeCodeBlockView.configure (cognitive 24) Packages/OsaurusCore/Views/Chat/NativeBlockViews.swift:559 — NativeCodeBlockView.configure has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 8, ternaries 2 (4 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 · ClaudePluginDetailView.installOutcomeMessages (cognitive 24) · ×1
  • ClaudePluginDetailView.installOutcomeMessages (cognitive 24) Packages/OsaurusCore/Views/Plugin/ClaudePluginDetailView.swift:260 — ClaudePluginDetailView.installOutcomeMessages has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 5 (13 pts), if/else 6 (10 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 · ToolsManagerView.allToolsTabContent (cognitive 24) · ×1
  • ToolsManagerView.allToolsTabContent (cognitive 24) Packages/OsaurusCore/Views/Plugin/ToolsManagerView.swift:209 — ToolsManagerView.allToolsTabContent has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 7, 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 · PublishedWorkflowDashboard.saveVisibility (cognitive 24) · ×1
  • PublishedWorkflowDashboard.saveVisibility (cognitive 24) Packages/OsaurusCore/Views/Template/PublishedWorkflowDashboard.swift:966 — PublishedWorkflowDashboard.saveVisibility has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 5 (9 pts), boolean chains 4, 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 · AssignedMenuPanelPresenter.show (cognitive 24) · ×1
  • AssignedMenuPanelPresenter.show (cognitive 24) Packages/OsaurusCore/Models/Theme/InspectionAdapters/AssignedMenuPresentation.swift:44 — AssignedMenuPanelPresenter.show has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 4, ternaries 2 (4 pts), loops 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 · LoginWithOsaurusRequest.parse (cognitive 24) · ×1
  • LoginWithOsaurusRequest.parse (cognitive 24) Packages/OsaurusCore/Services/Auth/LoginWithOsaurus/LoginWithOsaurusRequest.swift:183 — LoginWithOsaurusRequest.parse has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 12, if/else 8 (10 pts), loops 1, 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 · DOCXEditor.replaceAcrossParagraphs (cognitive 24) · ×1
  • DOCXEditor.replaceAcrossParagraphs (cognitive 24) Packages/OsaurusCore/Services/Documents/OOXML/DOCXEditor.swift:496 — DOCXEditor.replaceAcrossParagraphs has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 4 (8 pts), loops 3 (4 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 · EmailMIME.addresses (cognitive 24) · ×1
  • EmailMIME.addresses (cognitive 24) Packages/OsaurusCore/Services/Event/Email/EmailMIME.swift:194 — EmailMIME.addresses has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 8, ternaries 2 (4 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 · MarkdownBlockParsing.swift.tryParseBlockMath (cognitive 24) · ×1
  • MarkdownBlockParsing.swift.tryParseBlockMath (cognitive 24) Packages/OsaurusCore/Utils/MarkdownBlockParsing.swift:501 — MarkdownBlockParsing.swift.tryParseBlockMath has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (20 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 · EvalCompatBuilder.validate (cognitive 23) · ×1
  • EvalCompatBuilder.validate (cognitive 23) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCompat.swift:759 — EvalCompatBuilder.validate has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 2 (3 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 · EvalRunner.scoreDbState (cognitive 23) · ×1
  • EvalRunner.scoreDbState (cognitive 23) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerAgentLoop.swift:1781 — EvalRunner.scoreDbState has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 3, 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 · EvalRunner.runSubagentCase (cognitive 23) · ×1
  • EvalRunner.runSubagentCase (cognitive 23) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:37 — EvalRunner.runSubagentCase has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 3 (6 pts), boolean chains 4, loops 1 (2 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 · AppDelegate.presentAnnouncementIfEligible (cognitive 23) · ×1
  • AppDelegate.presentAnnouncementIfEligible (cognitive 23) Packages/OsaurusCore/AppDelegate.swift:3048 — AppDelegate.presentAnnouncementIfEligible has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14, boolean chains 3, loops 2 (3 pts), ternaries 2 (3 pts) (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 · BoundedArchiveExtractor.validateLocalHeader (cognitive 23) · ×1
  • BoundedArchiveExtractor.validateLocalHeader (cognitive 23) Packages/OsaurusRepository/BoundedArchiveExtractor.swift:486 — BoundedArchiveExtractor.validateLocalHeader has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 11 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · MinisignVerifier.parseSignature (cognitive 23) · ×1
  • MinisignVerifier.parseSignature (cognitive 23) Packages/OsaurusRepository/MinisignVerifier.swift:95 — MinisignVerifier.parseSignature has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (9 pts), loops 2 (4 pts), ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DesignFigmaChecks.run (cognitive 23) · ×1
  • DesignFigmaChecks.run (cognitive 23) Packages/OsaurusCore/DevelopmentDesign/DesignFigmaChecks.swift:66 — DesignFigmaChecks.run has cognitive complexity 23 (threshold 15). Drivers by points: loops 6 (14 pts), boolean chains 6, if/else 1 (2 pts), error handling 1 (nesting depth added 9). 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, 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 · FileWriteDocumentRouting.workbook (cognitive 23) · ×1
  • FileWriteDocumentRouting.workbook (cognitive 23) Packages/OsaurusCore/Folder/FileWriteDocumentRouting.swift:258 — FileWriteDocumentRouting.workbook has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 2 (7 pts), loops 1 (3 pts), error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IdentityHealthCheck.diagnose (cognitive 23) · ×1
  • IdentityHealthCheck.diagnose (cognitive 23) Packages/OsaurusCore/Identity/IdentityHealthCheck.swift:86 — IdentityHealthCheck.diagnose has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 4, error handling 2 (3 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 · HTTPHandler.handleDispatchEndpoint (cognitive 23) · ×1
  • HTTPHandler.handleDispatchEndpoint (cognitive 23) Packages/OsaurusCore/Networking/HTTPHandler.swift:12520 — HTTPHandler.handleDispatchEndpoint has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 5, ternaries 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · LocalGenerationDefaults.repairOrnith15A3BManualMTPBlockIfNeeded (cognitive 23) · ×1
  • LocalGenerationDefaults.repairOrnith15A3BManualMTPBlockIfNeeded (cognitive 23) Packages/OsaurusCore/Services/LocalGenerationDefaults.swift:333 — LocalGenerationDefaults.repairOrnith15A3BManualMTPBlockIfNeeded has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 5, error handling 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 · DirectDownloader.download (cognitive 23) · ×1
  • DirectDownloader.download (cognitive 23) Packages/OsaurusCore/Services/ModelDownloadService.swift:1874 — DirectDownloader.download has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (16 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 · ActivityLogStore.verify (cognitive 23) · ×1
  • ActivityLogStore.verify (cognitive 23) Packages/OsaurusCore/Storage/ActivityLogStore.swift:575 — ActivityLogStore.verify has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (19 pts), ternaries 2, boolean chains 1, 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 · AgentDatabase.createTable (cognitive 23) · ×1
  • AgentDatabase.createTable (cognitive 23) Packages/OsaurusCore/Storage/AgentDatabase.swift:636 — AgentDatabase.createTable has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 3 (4 pts), boolean chains 2, 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 · SubagentAdmissionLease.suspending (cognitive 23) · ×1
  • SubagentAdmissionLease.suspending (cognitive 23) Packages/OsaurusCore/Subagent/SubagentAdmissionLease.swift:32 — SubagentAdmissionLease.suspending has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 7, 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 · SandboxExecTool.run (cognitive 23) · ×1
  • SandboxExecTool.run (cognitive 23) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2745 — SandboxExecTool.run has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 3, error handling 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 · SearchKnowledgeTool.execute (cognitive 23) · ×1
  • SearchKnowledgeTool.execute (cognitive 23) Packages/OsaurusCore/Tools/KnowledgeTools.swift:287 — SearchKnowledgeTool.execute has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 3 (5 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 · AgentAction.semanticProblem (cognitive 23) · ×1
  • AgentAction.semanticProblem (cognitive 23) Packages/OsaurusCore/ComputerUse/Model/AgentAction.swift:535 — AgentAction.semanticProblem has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 2, 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 · ScreenContextDistiller.focusedElement (cognitive 23) · ×1
  • ScreenContextDistiller.focusedElement (cognitive 23) Packages/OsaurusCore/ComputerUse/Perception/ScreenContextDistiller.swift:302 — ScreenContextDistiller.focusedElement has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 8, ternaries 5 (8 pts), if/else 5 (7 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 · ChatSessionImporter.parse (cognitive 23) · ×1
  • ChatSessionImporter.parse (cognitive 23) Packages/OsaurusCore/Managers/Chat/ChatSessionImporter.swift:88 — ChatSessionImporter.parse has cognitive complexity 23 (threshold 15). Drivers by points: if/else 18 (20 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · ChatWindowState.setupNotificationObservers (cognitive 23) · ×1
  • ChatWindowState.setupNotificationObservers (cognitive 23) Packages/OsaurusCore/Managers/Chat/ChatWindowState.swift:3154 — ChatWindowState.setupNotificationObservers has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (15 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, 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 · ModelManager.loadOsaurusAIOrgModels (cognitive 23) · ×1
  • ModelManager.loadOsaurusAIOrgModels (cognitive 23) Packages/OsaurusCore/Managers/Model/ModelManager.swift:1874 — ModelManager.loadOsaurusAIOrgModels has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 6, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PluginManager.toolsDirectoryURLsWithFailures (cognitive 23) · ×1
  • PluginManager.toolsDirectoryURLsWithFailures (cognitive 23) Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:1836 — PluginManager.toolsDirectoryURLsWithFailures has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (5 pts), loops 2 (4 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 · AgentChannelCustomHTTPResponseMapping.validatePath (cognitive 23) · ×1
  • AgentChannelCustomHTTPResponseMapping.validatePath (cognitive 23) Packages/OsaurusCore/Models/AgentChannel/AgentChannelCustomJSONModels.swift:86 — AgentChannelCustomHTTPResponseMapping.validatePath has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 8, 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 · ChatSessionData.sameListRow (cognitive 23) · ×1
  • ChatSessionData.sameListRow (cognitive 23) Packages/OsaurusCore/Models/Chat/ChatSessionData.swift:212 — ChatSessionData.sameListRow has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 23. To reduce it, name the conditions: bind each compound test to a 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 · OpenResponsesSSEWriter.writeProviderEvent (cognitive 23) · ×1
  • OpenResponsesSSEWriter.writeProviderEvent (cognitive 23) Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1725 — OpenResponsesSSEWriter.writeProviderEvent has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 10 (nesting depth added 4). Of this number, 18 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 · ServerRuntimeSettingsStore.shouldRepairPagedCacheDefault (cognitive 23) · ×1
  • ServerRuntimeSettingsStore.shouldRepairPagedCacheDefault (cognitive 23) Packages/OsaurusCore/Models/Configuration/ServerRuntimeSettingsStore.swift:650 — ServerRuntimeSettingsStore.shouldRepairPagedCacheDefault has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 22, if/else 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 · BindingTypeResolver.type (cognitive 23) · ×1
  • BindingTypeResolver.type (cognitive 23) Packages/OsaurusCore/Models/Workflow/BindingTypeResolver.swift:81 — BindingTypeResolver.type has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 4 (10 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SchemaDumper.render (cognitive 23) · ×1
  • SchemaDumper.render (cognitive 23) Packages/OsaurusCore/Services/AgentBridge/SchemaDumper.swift:31 — SchemaDumper.render has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 4 (7 pts), ternaries 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 · AgentChannelRoomDirectory.load (cognitive 23) · ×1
  • AgentChannelRoomDirectory.load (cognitive 23) Packages/OsaurusCore/Services/AgentChannel/AgentChannelRoomDirectory.swift:76 — AgentChannelRoomDirectory.load has cognitive complexity 23 (threshold 15). Drivers by points: if/else 3 (11 pts), loops 2 (5 pts), ternaries 1 (4 pts), boolean chains 2, 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 · WorkspaceDelegationEvaluator.run (cognitive 23) · ×1
  • WorkspaceDelegationEvaluator.run (cognitive 23) Packages/OsaurusCore/Services/AgentDelegation/WorkspaceDelegationEvaluator.swift:92 — WorkspaceDelegationEvaluator.run has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 4 (5 pts), loops 3 (4 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GroundedConfigClaimCheck.containsFabricatedToolCall (cognitive 23) · ×1
  • GroundedConfigClaimCheck.containsFabricatedToolCall (cognitive 23) Packages/OsaurusCore/Services/Chat/GroundedConfigClaimCheck.swift:183 — GroundedConfigClaimCheck.containsFabricatedToolCall has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 4, 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 · ChatImportEvalHarness.run (cognitive 23) · ×1
  • ChatImportEvalHarness.run (cognitive 23) Packages/OsaurusCore/Services/ChatImport/ChatImportEvalHarness.swift:55 — ChatImportEvalHarness.run has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 4 (8 pts), boolean chains 4, loops 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatImportFastPaths.run (cognitive 23) · ×1
  • ChatImportFastPaths.run (cognitive 23) Packages/OsaurusCore/Services/ChatImport/ChatImportFastPaths.swift:20 — ChatImportFastPaths.run has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 4 (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 · CredentialMigration.importChannels (cognitive 23) · ×1
  • CredentialMigration.importChannels (cognitive 23) Packages/OsaurusCore/Services/Credentials/CredentialMigration.swift:192 — CredentialMigration.importChannels has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 4 (6 pts), match/switch 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 · CredentialRegistry.liveSlots (cognitive 23) · ×1
  • CredentialRegistry.liveSlots (cognitive 23) Packages/OsaurusCore/Services/Credentials/CredentialRegistry.swift:210 — CredentialRegistry.liveSlots has cognitive complexity 23 (threshold 15). Drivers by points: loops 8 (12 pts), if/else 2 (5 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 9). 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 · MarkdownRichTextRenderer.blockDescriptor (cognitive 23) · ×1
  • MarkdownRichTextRenderer.blockDescriptor (cognitive 23) Packages/OsaurusCore/Services/Documents/MarkdownRichTextRenderer.swift:228 — MarkdownRichTextRenderer.blockDescriptor has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (19 pts), match/switch 1 (2 pts), boolean chains 1, 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 · ChannelDialogRelay.interpret (cognitive 23) · ×1
  • ChannelDialogRelay.interpret (cognitive 23) Packages/OsaurusCore/Services/Event/ChannelDialogRelay.swift:344 — ChannelDialogRelay.interpret has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 4, ternaries 1 (2 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EventManager.replyWithWorkflowOutputIfNeeded (cognitive 23) · ×1
  • EventManager.replyWithWorkflowOutputIfNeeded (cognitive 23) Packages/OsaurusCore/Services/Event/EventManager.swift:897 — EventManager.replyWithWorkflowOutputIfNeeded has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 5, ternaries 2 (3 pts), match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · FolderEventSource.reconcile (cognitive 23) · ×1
  • FolderEventSource.reconcile (cognitive 23) Packages/OsaurusCore/Services/Event/FolderEventSource.swift:68 — FolderEventSource.reconcile has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 5, boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileChangeJournal.revert (cognitive 23) · ×1
  • FileChangeJournal.revert (cognitive 23) Packages/OsaurusCore/Services/FileHistory/FileChangeJournal+Revert.swift:253 — FileChangeJournal.revert has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3 (5 pts), error handling 1 (3 pts), ternaries 1 (3 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 · KnowledgeCurationService.approve (cognitive 23) · ×1
  • KnowledgeCurationService.approve (cognitive 23) Packages/OsaurusCore/Services/Knowledge/KnowledgeCurationService.swift:47 — KnowledgeCurationService.approve has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 6, match/switch 1 (2 pts), error handling 1, ternaries 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · KnowledgeIndexService.indexCollection (cognitive 23) · ×1
  • KnowledgeIndexService.indexCollection (cognitive 23) Packages/OsaurusCore/Services/Knowledge/KnowledgeIndexService.swift:80 — KnowledgeIndexService.indexCollection has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 3, boolean chains 2, error handling 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 · MLXBatchAdapter.prepareInput (cognitive 23) · ×1
  • MLXBatchAdapter.prepareInput (cognitive 23) Packages/OsaurusCore/Services/ModelRuntime/MLXBatchAdapter.swift:2431 — MLXBatchAdapter.prepareInput has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (16 pts), error handling 2 (4 pts), boolean chains 3 (nesting depth added 7). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RemoteChatRequest.isStrictResponsesToolSchema · ×1
  • RemoteChatRequest.isStrictResponsesToolSchema::isStrict (cognitive 23) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:5977 — RemoteChatRequest.isStrictResponsesToolSchema::isStrict has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (18 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 · SharedAgentStatus.derive (cognitive 23) · ×1
  • SharedAgentStatus.derive (cognitive 23) Packages/OsaurusCore/Services/Router/SharedAgentIdentity.swift:270 — SharedAgentStatus.derive has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 7, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WorkspaceAgentLiveness.classify (cognitive 23) · ×1
  • WorkspaceAgentLiveness.classify (cognitive 23) Packages/OsaurusCore/Services/Router/WorkspaceAgentLiveness.swift:79 — WorkspaceAgentLiveness.classify has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 2 (3 pts), ternaries 1 (3 pts), boolean chains 2 (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 · SyncManageDetail.write (cognitive 23) · ×1
  • SyncManageDetail.write (cognitive 23) Packages/OsaurusCore/Services/Sync/SyncManageDetail.swift:186 — SyncManageDetail.write has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 5 (6 pts), ternaries 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TelegramConnectionService.processUpdates (cognitive 23) · ×1
  • TelegramConnectionService.processUpdates (cognitive 23) Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:1070 — TelegramConnectionService.processUpdates has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (9 pts), match/switch 3 (8 pts), ternaries 1 (3 pts), loops 2, 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 · MediaNodeExecutor.runRemote (cognitive 23) · ×1
  • MediaNodeExecutor.runRemote (cognitive 23) Packages/OsaurusCore/Services/Workflow/MediaNodeExecutor.swift:792 — MediaNodeExecutor.runRemote has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 5, ternaries 2 (4 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentGenerationSettingsEditor.reasoningControls (cognitive 23) · ×1
  • AgentGenerationSettingsEditor.reasoningControls (cognitive 23) Packages/OsaurusCore/Views/Agent/AgentGenerationSettingsEditor.swift:235 — AgentGenerationSettingsEditor.reasoningControls has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 1 (4 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatHistoryFilterPicker.passes (cognitive 23) · ×1
  • ChatHistoryFilterPicker.passes (cognitive 23) Packages/OsaurusCore/Views/Chat/ChatHistoryPane.swift:417 — ChatHistoryFilterPicker.passes has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 15, if/else 8. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ChatTabContextMenu.makeMenu (cognitive 23) · ×1
  • ChatTabContextMenu.makeMenu (cognitive 23) Packages/OsaurusCore/Views/Chat/ChatTabStripView.swift:880 — ChatTabContextMenu.makeMenu has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 3 (7 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NativeMarkdownView.scheduleImageLoad (cognitive 23) · ×1
  • NativeMarkdownView.scheduleImageLoad (cognitive 23) Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:1392 — NativeMarkdownView.scheduleImageLoad has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 6, error handling 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · SettingsSheetFooter.body (cognitive 23) · ×1
  • SettingsSheetFooter.body (cognitive 23) Packages/OsaurusCore/Views/DesignSystem/SettingsSheet.swift:184 — SettingsSheetFooter.body has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 5 (8 pts), boolean chains 5 (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 · KnowledgeView.body (cognitive 23) · ×1
  • KnowledgeView.body (cognitive 23) Packages/OsaurusCore/Views/Knowledge/KnowledgeView.swift:83 — KnowledgeView.body has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9, ternaries 5 (8 pts), error handling 2 (3 pts), boolean chains 2, loops 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 · ScreenshotController.capture (cognitive 23) · ×1
  • ScreenshotController.capture (cognitive 23) Packages/OsaurusCore/ComputerUse/Driver/Mac/Screenshot.swift:151 — ScreenshotController.capture has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 2, ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · BaseSegmentedSurface.body (cognitive 23) · ×1
  • BaseSegmentedSurface.body (cognitive 23) Packages/OsaurusCore/Models/Theme/DesignLibrary/AssignedBaseSegmentedPicker.swift:86 — BaseSegmentedSurface.body has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 3 (4 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DesignFigmaSync.upgrade (cognitive 23) · ×1
  • DesignFigmaSync.upgrade (cognitive 23) Packages/OsaurusCore/Models/Theme/DesignLibrary/DesignFigmaSync.swift:35 — DesignFigmaSync.upgrade has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (6 pts), ternaries 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 · DOCXEditor.appendMarkdown (cognitive 23) · ×1
  • DOCXEditor.appendMarkdown (cognitive 23) Packages/OsaurusCore/Services/Documents/OOXML/DOCXEditor.swift:852 — DOCXEditor.appendMarkdown has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 3 (6 pts), boolean chains 3, 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 · XMLFeedReader.parser (cognitive 23) · ×1
  • XMLFeedReader.parser (cognitive 23) Packages/OsaurusCore/Services/Event/Feed/FeedParser.swift:196 — XMLFeedReader.parser has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 7, match/switch 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 · ImageCatalogSource.item (cognitive 23) · ×1
  • ImageCatalogSource.item (cognitive 23) Packages/OsaurusCore/Views/Model/Catalog/ImageCatalogSource.swift:110 — ImageCatalogSource.item has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 6 (9 pts), boolean chains 5 (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 · ArchitectSidebarPanel.normalBody (cognitive 23) · ×1
  • ArchitectSidebarPanel.normalBody (cognitive 23) Packages/OsaurusCore/Views/Workflow/Architect/ArchitectSidebarPanel.swift:68 — ArchitectSidebarPanel.normalBody has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 5, match/switch 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 · WorkflowBundleSetupView.stepContent (cognitive 23) · ×1
  • WorkflowBundleSetupView.stepContent (cognitive 23) Packages/OsaurusCore/Views/Workflow/Library/WorkflowBundleSetupView.swift:241 — WorkflowBundleSetupView.stepContent has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 4 (12 pts), if/else 5 (10 pts), match/switch 1 (nesting depth added 13). 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 · WorkflowSecretsStep.pasteControls (cognitive 23) · ×1
  • WorkflowSecretsStep.pasteControls (cognitive 23) Packages/OsaurusCore/Views/Workflow/Library/WorkflowSetupWizardView.swift:1075 — WorkflowSecretsStep.pasteControls has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 4 (5 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 · PullCommand.execute (cognitive 22) · ×1
  • PullCommand.execute (cognitive 22) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:43 — PullCommand.execute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (15 pts), error handling 2 (3 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 · ToolsList.execute (cognitive 22) · ×1
  • ToolsList.execute (cognitive 22) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsList.swift:11 — ToolsList.execute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 1 (3 pts), boolean chains 1, 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 · ToolsUninstall.resolveTargetDirectory (cognitive 22) · ×1
  • ToolsUninstall.resolveTargetDirectory (cognitive 22) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsUninstall.swift:47 — ToolsUninstall.resolveTargetDirectory has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 3, 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 · OsaurusEvalsCLI.runOptimizeContext (cognitive 22) · ×1
  • OsaurusEvalsCLI.runOptimizeContext (cognitive 22) Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/ContextOptimizeCLI.swift:37 — OsaurusEvalsCLI.runOptimizeContext has cognitive complexity 22 (threshold 15). Drivers by points: loops 5 (8 pts), error handling 6 (7 pts), if/else 3, ternaries 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EvalRunner.scoreTranscriptAssertions (cognitive 22) · ×1
  • EvalRunner.scoreTranscriptAssertions (cognitive 22) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerAgentLoop.swift:1342 — EvalRunner.scoreTranscriptAssertions has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · RunEnvironment.summary (cognitive 22) · ×1
  • RunEnvironment.summary (cognitive 22) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/RunEnvironment.swift:281 — RunEnvironment.summary has cognitive complexity 22 (threshold 15). Drivers by points: if/else 19, 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 · InspectorUserMessageVerification.body (cognitive 22) · ×1
  • InspectorUserMessageVerification.body (cognitive 22) Packages/OsaurusCore/DevelopmentDesign/InspectorUserMessageVerification.swift:31 — InspectorUserMessageVerification.body has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 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 · FileReadTool.spawnedOperationCancellationSupport (cognitive 22) · ×1
  • FileReadTool.spawnedOperationCancellationSupport (cognitive 22) Packages/OsaurusCore/Folder/FolderTools.swift:1165 — FileReadTool.spawnedOperationCancellationSupport has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 11, if/else 7 (9 pts), loops 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 · SchemaJSONSlices.members (cognitive 22) · ×1
  • SchemaJSONSlices.members (cognitive 22) Packages/OsaurusCore/Networking/RequestValidator.swift:193 — SchemaJSONSlices.members has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 4, 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 · ModelCompatibilityDiagnostics.evidenceRows (cognitive 22) · ×1
  • ModelCompatibilityDiagnostics.evidenceRows (cognitive 22) Packages/OsaurusCore/Services/ModelCompatibilityDiagnostics.swift:660 — ModelCompatibilityDiagnostics.evidenceRows has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 4 (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 · ModelRuntime.ensureJANGTQSidecar (cognitive 22) · ×1
  • ModelRuntime.ensureJANGTQSidecar (cognitive 22) Packages/OsaurusCore/Services/ModelRuntime.swift:8402 — ModelRuntime.ensureJANGTQSidecar has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, error handling 2 (4 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 · NotificationService.userNotificationCenter (cognitive 22) · ×1
  • NotificationService.userNotificationCenter (cognitive 22) Packages/OsaurusCore/Services/NotificationService.swift:274 — NotificationService.userNotificationCenter has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 8, 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 · AgentDatabase.execute (cognitive 22) · ×1
  • AgentDatabase.execute (cognitive 22) Packages/OsaurusCore/Storage/AgentDatabase.swift:1731 — AgentDatabase.execute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 3 (7 pts), boolean chains 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 · ChatHistoryWriter.persist (cognitive 22) · ×1
  • ChatHistoryWriter.persist (cognitive 22) Packages/OsaurusCore/Storage/ChatHistoryWriter.swift:61 — ChatHistoryWriter.persist has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 2 (6 pts), error handling 2, match/switch 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 · PluginDatabase.performQuery (cognitive 22) · ×1
  • PluginDatabase.performQuery (cognitive 22) Packages/OsaurusCore/Storage/PluginDatabase.swift:318 — PluginDatabase.performQuery has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (4 pts), match/switch 1 (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 · SpawnResultCompaction.modelVisible (cognitive 22) · ×1
  • SpawnResultCompaction.modelVisible (cognitive 22) Packages/OsaurusCore/Subagent/SpawnResultCompaction.swift:54 — SpawnResultCompaction.modelVisible has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 7, 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 · SandboxPluginTool.validateArguments (cognitive 22) · ×1
  • SandboxPluginTool.validateArguments (cognitive 22) Packages/OsaurusCore/Tools/SandboxPluginTool.swift:128 — SandboxPluginTool.validateArguments has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (19 pts), match/switch 1 (2 pts), 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 · OsaurusPaths.migrateLegacyPersonasIfNeeded (cognitive 22) · ×1
  • OsaurusPaths.migrateLegacyPersonasIfNeeded (cognitive 22) Packages/OsaurusCore/Utils/OsaurusPaths.swift:1081 — OsaurusPaths.migrateLegacyPersonasIfNeeded has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (9 pts), error handling 2 (8 pts), boolean chains 3, 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 · BrowserSnapshotFormatter.line (cognitive 22) · ×1
  • BrowserSnapshotFormatter.line (cognitive 22) Packages/OsaurusCore/Browser/Runtime/BrowserSupport.swift:249 — BrowserSnapshotFormatter.line has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 9 (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 · AgentView.build (cognitive 22) · ×1
  • AgentView.build (cognitive 22) Packages/OsaurusCore/ComputerUse/Model/AgentView.swift:111 — AgentView.build has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 5 (9 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 · EffectClassifier.classify (cognitive 22) · ×1
  • EffectClassifier.classify (cognitive 22) Packages/OsaurusCore/ComputerUse/Policy/EffectClassifier.swift:32 — EffectClassifier.classify has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 12, if/else 7 (9 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 · ConfigApplier.applyHarnessRuntimes (cognitive 22) · ×1
  • ConfigApplier.applyHarnessRuntimes (cognitive 22) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:887 — ConfigApplier.applyHarnessRuntimes has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 2 (3 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 · ConfigManifest.jsonSchema (cognitive 22) · ×1
  • ConfigManifest.jsonSchema (cognitive 22) Packages/OsaurusCore/Configuration/Declarative/ConfigManifest.swift:1085 — ConfigManifest.jsonSchema has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 3 (7 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · OsaurusConfigDocument.declaredSections (cognitive 22) · ×1
  • OsaurusConfigDocument.declaredSections (cognitive 22) Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigDocument.swift:153 — OsaurusConfigDocument.declaredSections has cognitive complexity 22 (threshold 15). Drivers by points: if/else 20, boolean chains 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 · ChatSessionImportCoordinator.run (cognitive 22) · ×1
  • ChatSessionImportCoordinator.run (cognitive 22) Packages/OsaurusCore/Managers/Chat/ChatSessionImportCoordinator.swift:120 — ChatSessionImportCoordinator.run has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (14 pts), error handling 2 (4 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 · ChatMessage.appendScrubbableTexts (cognitive 22) · ×1
  • ChatMessage.appendScrubbableTexts (cognitive 22) Packages/OsaurusCore/PrivacyFilter/Core/MessageScrubbing.swift:126 — ChatMessage.appendScrubbableTexts has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 4 (9 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileDiff.stringValue (cognitive 22) · ×1
  • FileDiff.stringValue (cognitive 22) Packages/OsaurusCore/Models/Chat/FileDiff.swift:468 — FileDiff.stringValue has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 2 (5 pts), boolean chains 2, 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 · SharedArtifact.importRemoteArtifacts (cognitive 22) · ×1
  • SharedArtifact.importRemoteArtifacts (cognitive 22) Packages/OsaurusCore/Services/Router/RemoteRunArtifacts.swift:203 — SharedArtifact.importRemoteArtifacts has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 6, ternaries 2 (4 pts), error handling 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 · ServerRuntimeSettingsStore.shouldRepairLegacyCacheDefaults (cognitive 22) · ×1
  • ServerRuntimeSettingsStore.shouldRepairLegacyCacheDefaults (cognitive 22) Packages/OsaurusCore/Models/Configuration/ServerRuntimeSettingsStore.swift:611 — ServerRuntimeSettingsStore.shouldRepairLegacyCacheDefaults has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 21, if/else 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 · PluginManifest.matchRouteWithParams (cognitive 22) · ×1
  • PluginManifest.matchRouteWithParams (cognitive 22) Packages/OsaurusCore/Models/Plugin/ExternalPlugin.swift:535 — PluginManifest.matchRouteWithParams has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 2 (3 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 · WorkflowAccessScope.oneLine (cognitive 22) · ×1
  • WorkflowAccessScope.oneLine (cognitive 22) Packages/OsaurusCore/Models/Workflow/WorkflowAccessScope.swift:507 — WorkflowAccessScope.oneLine has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowAccessScope.architectSentence (cognitive 22) · ×1
  • WorkflowAccessScope.architectSentence (cognitive 22) Packages/OsaurusCore/Models/Workflow/WorkflowAccessScope.swift:542 — WorkflowAccessScope.architectSentence has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 2 (5 pts), loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowNode.effectiveOutputSchema (cognitive 22) · ×1
  • WorkflowNode.effectiveOutputSchema (cognitive 22) Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:495 — WorkflowNode.effectiveOutputSchema has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 11, 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 · AgentChannelPublishService.sendPolicyDenial (cognitive 22) · ×1
  • AgentChannelPublishService.sendPolicyDenial (cognitive 22) Packages/OsaurusCore/Services/AgentChannel/AgentChannelPublishService.swift:763 — AgentChannelPublishService.sendPolicyDenial has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 2, error handling 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 · ChannelAccountMigration.runIfNeeded (cognitive 22) · ×1
  • ChannelAccountMigration.runIfNeeded (cognitive 22) Packages/OsaurusCore/Services/AgentChannel/ChannelAccountMigration.swift:69 — ChannelAccountMigration.runIfNeeded has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (11 pts), error handling 2 (5 pts), loops 2 (4 pts), boolean chains 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.
D2 · Cognitive Complexity · ContextCompactionService.compactionCutIndex (cognitive 22) · ×1
  • ContextCompactionService.compactionCutIndex (cognitive 22) Packages/OsaurusCore/Services/Chat/ContextCompactionService.swift:241 — ContextCompactionService.compactionCutIndex has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 12, if/else 8, ternaries 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · DiscordGatewayPresenceRuntime.runSession (cognitive 22) · ×1
  • DiscordGatewayPresenceRuntime.runSession (cognitive 22) Packages/OsaurusCore/Services/Discord/DiscordGatewayPresenceRuntime.swift:193 — DiscordGatewayPresenceRuntime.runSession has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 3, error handling 3, match/switch 1 (3 pts), 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 · PDFEditor.formFieldGroups (cognitive 22) · ×1
  • PDFEditor.formFieldGroups (cognitive 22) Packages/OsaurusCore/Services/Documents/PDFEditor.swift:193 — PDFEditor.formFieldGroups has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (8 pts), match/switch 2 (5 pts), boolean chains 4, ternaries 1 (4 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 · PPTXAdapter.securityMetadata (cognitive 22) · ×1
  • PPTXAdapter.securityMetadata (cognitive 22) Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:714 — PPTXAdapter.securityMetadata has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 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 · FileDiffEngine.wordHighlights (cognitive 22) · ×1
  • FileDiffEngine.wordHighlights (cognitive 22) Packages/OsaurusCore/Services/FileHistory/FileDiffEngine.swift:382 — FileDiffEngine.wordHighlights has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 4 (8 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FoundationModelService.respondWithTools (cognitive 22) · ×1
  • FoundationModelService.respondWithTools (cognitive 22) Packages/OsaurusCore/Services/Inference/FoundationModelService.swift:451 — FoundationModelService.respondWithTools has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 2 (4 pts), loops 1 (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 · StructuredOutputSchema.strictify (cognitive 22) · ×1
  • StructuredOutputSchema.strictify (cognitive 22) Packages/OsaurusCore/Services/Inference/StructuredOutput.swift:128 — StructuredOutputSchema.strictify has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 3 (4 pts), ternaries 1 (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 · ActivityExportCoordinator.run (cognitive 22) · ×1
  • ActivityExportCoordinator.run (cognitive 22) Packages/OsaurusCore/Services/Insights/ActivityExportCoordinator.swift:17 — ActivityExportCoordinator.run has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 3 (7 pts), boolean chains 1, error handling 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MemoryConsolidator.runOnce (cognitive 22) · ×1
  • MemoryConsolidator.runOnce (cognitive 22) Packages/OsaurusCore/Services/Memory/MemoryConsolidator.swift:134 — MemoryConsolidator.runOnce has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 4 (5 pts), loops 2 (5 pts), ternaries 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PhoneAgentEditing.patch (cognitive 22) · ×1
  • PhoneAgentEditing.patch (cognitive 22) Packages/OsaurusCore/Services/MobileConnect/PhoneAgentEditing.swift:123 — PhoneAgentEditing.patch has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 6 (nesting depth added 2). Of this number, 17 points are the body's own statements and 5 belong to 2 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 · SSELineParser.append (cognitive 22) · ×1
  • SSELineParser.append (cognitive 22) Packages/OsaurusCore/Services/Provider/OpenAICompatibleStreamParser.swift:37 — SSELineParser.append has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 1 (4 pts), match/switch 1 (2 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 · RemoteProviderService.connectWithRetry (cognitive 22) · ×1
  • RemoteProviderService.connectWithRetry (cognitive 22) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:996 — RemoteProviderService.connectWithRetry has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 3, ternaries 1 (3 pts), 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 · InboundSharedRunBridge.resolveHostedSession (cognitive 22) · ×1
  • InboundSharedRunBridge.resolveHostedSession (cognitive 22) Packages/OsaurusCore/Services/Router/InboundSharedRunBridge.swift:239 — InboundSharedRunBridge.resolveHostedSession has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 11, if/else 8, 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 · DDGScrapeBackend.parseHTML (cognitive 22) · ×1
  • DDGScrapeBackend.parseHTML (cognitive 22) Packages/OsaurusCore/Services/Search/NativeSearchBackends.swift:65 — DDGScrapeBackend.parseHTML has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (5 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.
D2 · Cognitive Complexity · ToolIndexService.exposureDiagnostic (cognitive 22) · ×1
  • ToolIndexService.exposureDiagnostic (cognitive 22) Packages/OsaurusCore/Services/Tool/ToolIndexService.swift:176 — ToolIndexService.exposureDiagnostic has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11, boolean chains 8, ternaries 1 (2 pts), match/switch 1 (nesting depth added 1). Of this number, 21 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 · AgenticNodeExecutor.run (cognitive 22) · ×1
  • AgenticNodeExecutor.run (cognitive 22) Packages/OsaurusCore/Services/Workflow/AgenticNodeExecutor.swift:92 — AgenticNodeExecutor.run has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 3 (4 pts), loops 2 (3 pts), error handling 2, 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 · HTTPNodeExecutor.run (cognitive 22) · ×1
  • HTTPNodeExecutor.run (cognitive 22) Packages/OsaurusCore/Services/Workflow/HTTPNodeExecutor.swift:118 — HTTPNodeExecutor.run has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8, boolean chains 5, match/switch 2 (4 pts), ternaries 1 (3 pts), loops 2 (nesting depth added 4). Of this number, 20 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, 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 · MediaNodeExecutor.describe (cognitive 22) · ×1
  • MediaNodeExecutor.describe (cognitive 22) Packages/OsaurusCore/Services/Workflow/MediaNodeExecutor.swift:336 — MediaNodeExecutor.describe has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13, boolean chains 7, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ChatHistoryList.body (cognitive 22) · ×1
  • ChatHistoryList.body (cognitive 22) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:4279 — ChatHistoryList.body has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 3 (5 pts), boolean chains 4 (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 · ChatView.pinRemoteAgentModelAfterConnect (cognitive 22) · ×1
  • ChatView.pinRemoteAgentModelAfterConnect (cognitive 22) Packages/OsaurusCore/Views/Chat/ChatView.swift:12425 — ChatView.pinRemoteAgentModelAfterConnect has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 5, 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 · FloatingInputCard.refreshMTPLayoutAdvisory (cognitive 22) · ×1
  • FloatingInputCard.refreshMTPLayoutAdvisory (cognitive 22) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:4588 — FloatingInputCard.refreshMTPLayoutAdvisory has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (17 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 · FloatingInputCard.catalogMediaComposerChips (cognitive 22) · ×1
  • FloatingInputCard.catalogMediaComposerChips (cognitive 22) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5491 — FloatingInputCard.catalogMediaComposerChips has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 3 (6 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · NativeThinkingView.configure (cognitive 22) · ×1
  • NativeThinkingView.configure (cognitive 22) Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift:99 — NativeThinkingView.configure has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 7, 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 · PreviewGenerator.jsonPreview (cognitive 22) · ×1
  • PreviewGenerator.jsonPreview (cognitive 22) Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:196 — PreviewGenerator.jsonPreview has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RedactionHighlighter.applyInternal (cognitive 22) · ×1
  • RedactionHighlighter.applyInternal (cognitive 22) Packages/OsaurusCore/Views/Chat/RedactionHighlighter.swift:174 — RedactionHighlighter.applyInternal has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (3 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 · VaultSessionSheet.add (cognitive 22) · ×1
  • VaultSessionSheet.add (cognitive 22) Packages/OsaurusCore/Views/Credentials/VaultAccountsView.swift:573 — VaultSessionSheet.add has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 2 (4 pts), boolean chains 2, match/switch 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 · CreditsView.webSearchCard (cognitive 22) · ×1
  • CreditsView.webSearchCard (cognitive 22) Packages/OsaurusCore/Views/Credits/CreditsView.swift:287 — CreditsView.webSearchCard has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 3, 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 · ParsedMessage.init (cognitive 22) · ×1
  • ParsedMessage.init (cognitive 22) Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:2254 — ParsedMessage.init has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 1 (4 pts), loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MemoryView.diagnosticHeadline (cognitive 22) · ×1
  • MemoryView.diagnosticHeadline (cognitive 22) Packages/OsaurusCore/Views/Memory/MemoryDiagnosticsViews.swift:942 — MemoryView.diagnosticHeadline has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 3, match/switch 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 · PluginConfigView.statusAction (cognitive 22) · ×1
  • PluginConfigView.statusAction (cognitive 22) Packages/OsaurusCore/Views/Plugin/PluginConfigView.swift:279 — PluginConfigView.statusAction has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (8 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PluginConfigView.validateField (cognitive 22) · ×1
  • PluginConfigView.validateField (cognitive 22) Packages/OsaurusCore/Views/Plugin/PluginConfigView.swift:528 — PluginConfigView.validateField has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 9 (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 · WorkflowMediaGalleryModel.settingsLines (cognitive 22) · ×1
  • WorkflowMediaGalleryModel.settingsLines (cognitive 22) Packages/OsaurusCore/Views/Workflow/WorkflowMediaGallery.swift:41 — WorkflowMediaGalleryModel.settingsLines has cognitive complexity 22 (threshold 15). Drivers by points: if/else 19, ternaries 1 (2 pts), boolean chains 1 (nesting depth added 1). Of this number, 18 points are the body's own statements and 4 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 · WorkspaceDetailView.sharedAgentsSection (cognitive 22) · ×1
  • WorkspaceDetailView.sharedAgentsSection (cognitive 22) Packages/OsaurusCore/Views/Workspaces/WorkspaceDetailView.swift:1233 — WorkspaceDetailView.sharedAgentsSection has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 7 (9 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 · AccessibilityManager.traverse (cognitive 22) · ×1
  • AccessibilityManager.traverse (cognitive 22) Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:592 — AccessibilityManager.traverse has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 6, loops 2 (3 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 · LocalModelFactsInspector.footer (cognitive 22) · ×1
  • LocalModelFactsInspector.footer (cognitive 22) Packages/OsaurusCore/Views/Model/Catalog/LocalModelInspector.swift:135 — LocalModelFactsInspector.footer has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 2 (5 pts), boolean chains 1, 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 · ArchitectSidebarPanel.designSections (cognitive 22) · ×1
  • ArchitectSidebarPanel.designSections (cognitive 22) Packages/OsaurusCore/Views/Workflow/Architect/ArchitectSidebarPanel.swift:331 — ArchitectSidebarPanel.designSections has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 8 (11 pts), if/else 9, boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Accessibility.swift.computeFocusedContent (cognitive 22) · ×1
  • Accessibility.swift.computeFocusedContent (cognitive 22) Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:1123 — Accessibility.swift.computeFocusedContent has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 9, ternaries 2 (nesting depth added 2). Of this number, 19 points are the body's own statements and 3 belong to 2 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 · BundleLoad.run (cognitive 21) · ×1
  • BundleLoad.run (cognitive 21) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Bundle/BundleLoad.swift:53 — BundleLoad.run has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 3 (5 pts), 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 · ToolsDev.runProjectMode (cognitive 21) · ×1
  • ToolsDev.runProjectMode (cognitive 21) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsDev.swift:59 — ToolsDev.runProjectMode has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (19 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 · EvalRunner.parseToolResultGroundingEvents (cognitive 21) · ×1
  • EvalRunner.parseToolResultGroundingEvents (cognitive 21) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerToolResultGrounding.swift:243 — EvalRunner.parseToolResultGroundingEvents has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 2, match/switch 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 · PluginInstallManager.installVerifiedArtifact (cognitive 21) · ×1
  • PluginInstallManager.installVerifiedArtifact (cognitive 21) Packages/OsaurusRepository/PluginInstallManager.swift:168 — PluginInstallManager.installVerifiedArtifact has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 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 · SemanticVersion.comparePrerelease (cognitive 21) · ×1
  • SemanticVersion.comparePrerelease (cognitive 21) Packages/OsaurusRepository/SemanticVersion.swift:59 — SemanticVersion.comparePrerelease has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 4 (11 pts), if/else 5 (8 pts), boolean chains 1, 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 · CatalogLibraryFixture.body (cognitive 21) · ×1
  • CatalogLibraryFixture.body (cognitive 21) Packages/OsaurusCore/DevelopmentDesign/CatalogComponents.swift:304 — CatalogLibraryFixture.body has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2, ternaries 2, loops 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 · ToastManager.handleBuiltInAction (cognitive 21) · ×1
  • ToastManager.handleBuiltInAction (cognitive 21) Packages/OsaurusCore/Managers/ToastManager.swift:378 — ToastManager.handleBuiltInAction has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (19 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 · HTTPHandler.handleHostedWorkflowEndpoint (cognitive 21) · ×1
  • HTTPHandler.handleHostedWorkflowEndpoint (cognitive 21) Packages/OsaurusCore/Networking/HTTPHandler.swift:7261 — HTTPHandler.handleHostedWorkflowEndpoint has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (15 pts), match/switch 2 (3 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · BundledModelSeeder.seed (cognitive 21) · ×1
  • BundledModelSeeder.seed (cognitive 21) Packages/OsaurusCore/Services/BundledModelSeeder.swift:231 — BundledModelSeeder.seed has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, error handling 3, 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 · ExternalModelLocator.scanReport · ×1
  • ExternalModelLocator.scanReport::walk (cognitive 21) Packages/OsaurusCore/Services/ExternalModelLocator.swift:840 — ExternalModelLocator.scanReport::walk has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 2 (5 pts), boolean chains 3, error handling 1, 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 · GitHubSkillService.parseGitHubURL (cognitive 21) · ×1
  • GitHubSkillService.parseGitHubURL (cognitive 21) Packages/OsaurusCore/Services/GitHubSkillService.swift:972 — GitHubSkillService.parseGitHubURL has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5, ternaries 2 (3 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 · GitHubSkillService.buildManifest (cognitive 21) · ×1
  • GitHubSkillService.buildManifest (cognitive 21) Packages/OsaurusCore/Services/GitHubSkillService.swift:1581 — GitHubSkillService.buildManifest has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 6 (7 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 · ModelRuntime.resolveLocalModelDirectory (cognitive 21) · ×1
  • ModelRuntime.resolveLocalModelDirectory (cognitive 21) Packages/OsaurusCore/Services/ModelRuntime.swift:8700 — ModelRuntime.resolveLocalModelDirectory has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 2, loops 2, ternaries 1 (nesting depth added 6). Most of this is not in the body itself: 2 of the 21 points are its own statements and the rest belongs to 3 function items inside it that branch (scan, loadableBundle, withoutCrackSuffix). 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 · MemoryDatabase.searchTranscriptText (cognitive 21) · ×1
  • MemoryDatabase.searchTranscriptText (cognitive 21) Packages/OsaurusCore/Storage/MemoryDatabase.swift:2377 — MemoryDatabase.searchTranscriptText has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 4 (6 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StorageDatabaseCatalog.databaseTargets (cognitive 21) · ×1
  • StorageDatabaseCatalog.databaseTargets (cognitive 21) Packages/OsaurusCore/Storage/StorageDatabaseCatalog.swift:39 — StorageDatabaseCatalog.databaseTargets has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CapabilitiesDiscoverTool.namedToolCandidates (cognitive 21) · ×1
  • CapabilitiesDiscoverTool.namedToolCandidates (cognitive 21) Packages/OsaurusCore/Tools/CapabilityTools.swift:773 — CapabilitiesDiscoverTool.namedToolCandidates has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (9 pts), ternaries 2 (6 pts), boolean chains 3, 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 · InlineThinkSplitter.process (cognitive 21) · ×1
  • InlineThinkSplitter.process (cognitive 21) Packages/OsaurusCore/Utils/InlineThinkSplitter.swift:42 — InlineThinkSplitter.process has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 3 (10 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 · StringCleaning.matchingBraceIndex (cognitive 21) · ×1
  • StringCleaning.matchingBraceIndex (cognitive 21) Packages/OsaurusCore/Utils/StringCleaning.swift:181 — StringCleaning.matchingBraceIndex has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 2, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigApplier.normalizeAgentEntry (cognitive 21) · ×1
  • ConfigApplier.normalizeAgentEntry (cognitive 21) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:731 — ConfigApplier.normalizeAgentEntry has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5, 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 · ConfigApplier.applySearchProviders (cognitive 21) · ×1
  • ConfigApplier.applySearchProviders (cognitive 21) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:2546 — ConfigApplier.applySearchProviders has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 2 (6 pts), loops 2 (3 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 · PluginManager.compatibilityFailure (cognitive 21) · ×1
  • PluginManager.compatibilityFailure (cognitive 21) Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:1023 — PluginManager.compatibilityFailure has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (19 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 · SessionCapability.derive (cognitive 21) · ×1
  • SessionCapability.derive (cognitive 21) Packages/OsaurusCore/Models/Chat/SessionCapability.swift:39 — SessionCapability.derive has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (5 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 · Template.merge (cognitive 21) · ×1
  • Template.merge (cognitive 21) Packages/OsaurusCore/Models/Template/Template+Agent.swift:116 — Template.merge has cognitive complexity 21 (threshold 15). Drivers by points: if/else 21. 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 · ToolApprovalPresentation.make (cognitive 21) · ×1
  • ToolApprovalPresentation.make (cognitive 21) Packages/OsaurusCore/Models/Tool/ToolApprovalPresentation.swift:238 — ToolApprovalPresentation.make has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 7 (9 pts), if/else 7 (8 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 · BindingRenderer.parse (cognitive 21) · ×1
  • BindingRenderer.parse (cognitive 21) Packages/OsaurusCore/Models/Workflow/BindingRenderer.swift:112 — BindingRenderer.parse has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 12, if/else 9. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SpokenEmails.find (cognitive 21) · ×1
  • SpokenEmails.find (cognitive 21) Packages/OsaurusCore/PrivacyFilter/Core/SpokenNumberDetector.swift:183 — SpokenEmails.find has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (12 pts), boolean chains 3, loops 2 (3 pts), ternaries 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 · AgentChannelInboundRelay.waitForReply (cognitive 21) · ×1
  • AgentChannelInboundRelay.waitForReply (cognitive 21) Packages/OsaurusCore/Services/AgentChannel/AgentChannelInboundRelay.swift:910 — AgentChannelInboundRelay.waitForReply has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (17 pts), match/switch 1 (2 pts), boolean chains 1, 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 · OwnerApprovalService.request (cognitive 21) · ×1
  • OwnerApprovalService.request (cognitive 21) Packages/OsaurusCore/Services/Attention/OwnerApprovalService.swift:232 — OwnerApprovalService.request has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 4 (5 pts), boolean chains 3, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ParticipantFormatter.full (cognitive 21) · ×1
  • ParticipantFormatter.full (cognitive 21) Packages/OsaurusCore/Services/Attention/Participant.swift:311 — ParticipantFormatter.full has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (20 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 · ChatImportSourceResolver.resolve (cognitive 21) · ×1
  • ChatImportSourceResolver.resolve (cognitive 21) Packages/OsaurusCore/Services/ChatImport/ChatImportSourceResolver.swift:60 — ChatImportSourceResolver.resolve has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (4 pts), ternaries 1 (3 pts), boolean chains 2, 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 · ScriptedSubagentKind.run (cognitive 21) · ×1
  • ScriptedSubagentKind.run (cognitive 21) Packages/OsaurusCore/Services/Context/SubagentJobEvaluator.swift:1292 — ScriptedSubagentKind.run has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PDFAdapter.selectionRange (cognitive 21) · ×1
  • PDFAdapter.selectionRange (cognitive 21) Packages/OsaurusCore/Services/Documents/PDFAdapter.swift:231 — PDFAdapter.selectionRange has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 17, if/else 2 (3 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 · SourceRuntimeSupervisor.runTicks (cognitive 21) · ×1
  • SourceRuntimeSupervisor.runTicks (cognitive 21) Packages/OsaurusCore/Services/Event/SourceRuntimeSupervisor.swift:250 — SourceRuntimeSupervisor.runTicks has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (16 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 · FileDiffEngine.lineDiff (cognitive 21) · ×1
  • FileDiffEngine.lineDiff (cognitive 21) Packages/OsaurusCore/Services/FileHistory/FileDiffEngine.swift:195 — FileDiffEngine.lineDiff has cognitive complexity 21 (threshold 15). Drivers by points: loops 7 (10 pts), boolean chains 6, match/switch 1 (3 pts), if/else 2 (nesting depth added 5). 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 · FileDiffEngine.myers (cognitive 21) · ×1
  • FileDiffEngine.myers (cognitive 21) Packages/OsaurusCore/Services/FileHistory/FileDiffEngine.swift:236 — FileDiffEngine.myers has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 6, loops 3 (6 pts) (nesting depth added 7). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PendingImportProcessor.waitForServers (cognitive 21) · ×1
  • PendingImportProcessor.waitForServers (cognitive 21) Packages/OsaurusCore/Services/Import/PendingImportProcessor.swift:744 — PendingImportProcessor.waitForServers has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StreamingStatsHint.decode (cognitive 21) · ×1
  • StreamingStatsHint.decode (cognitive 21) Packages/OsaurusCore/Services/Inference/ModelService.swift:667 — StreamingStatsHint.decode has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 10, if/else 8, ternaries 3. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · LocalVideoRequestPolicy.init (cognitive 21) · ×1
  • LocalVideoRequestPolicy.init (cognitive 21) Packages/OsaurusCore/Services/MediaGeneration/LocalVideoRequestPolicy.swift:15 — LocalVideoRequestPolicy.init has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 14, if/else 5, match/switch 1, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · MediaGenerationCoordinator.validateImageRequest (cognitive 21) · ×1
  • MediaGenerationCoordinator.validateImageRequest (cognitive 21) Packages/OsaurusCore/Services/MediaGeneration/MediaGenerationCoordinator.swift:579 — MediaGenerationCoordinator.validateImageRequest has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 10, if/else 8, loops 1 (2 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 · MediaGenerationCoordinator.validateVideoRequest (cognitive 21) · ×1
  • MediaGenerationCoordinator.validateVideoRequest (cognitive 21) Packages/OsaurusCore/Services/MediaGeneration/MediaGenerationCoordinator.swift:630 — MediaGenerationCoordinator.validateVideoRequest has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 9, if/else 9, 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 · OnboardingFirstRun.explore (cognitive 21) · ×1
  • OnboardingFirstRun.explore (cognitive 21) Packages/OsaurusCore/Services/Onboarding/OnboardingFirstRun.swift:365 — OnboardingFirstRun.explore has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 3, 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 · OnboardingFirstRun.runRequest (cognitive 21) · ×1
  • OnboardingFirstRun.runRequest (cognitive 21) Packages/OsaurusCore/Services/Onboarding/OnboardingFirstRun.swift:616 — OnboardingFirstRun.runRequest has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 4 (6 pts), boolean chains 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 · PluginHostContext.applyAgentTools (cognitive 21) · ×1
  • PluginHostContext.applyAgentTools (cognitive 21) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:1245 — PluginHostContext.applyAgentTools has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 1 (4 pts) (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 · WorkspaceRosterStore.refresh (cognitive 21) · ×1
  • WorkspaceRosterStore.refresh (cognitive 21) Packages/OsaurusCore/Services/Router/WorkspaceRosterStore.swift:317 — WorkspaceRosterStore.refresh has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 5, 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 · MediaNodeExecutor.save (cognitive 21) · ×1
  • MediaNodeExecutor.save (cognitive 21) Packages/OsaurusCore/Services/Workflow/MediaNodeExecutor.swift:898 — MediaNodeExecutor.save has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 4, 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 · WorkflowDraftStore.applyArchitectPatch (cognitive 21) · ×1
  • WorkflowDraftStore.applyArchitectPatch (cognitive 21) Packages/OsaurusCore/Services/Workflow/WorkflowDraftStore.swift:180 — WorkflowDraftStore.applyArchitectPatch has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 4, loops 1, ternaries 1 (nesting depth added 2). Of this number, 19 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · WorkflowRunner.applyPinsAndStart (cognitive 21) · ×1
  • WorkflowRunner.applyPinsAndStart (cognitive 21) Packages/OsaurusCore/Services/Workflow/WorkflowRunner.swift:574 — WorkflowRunner.applyPinsAndStart has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 1 (3 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 · DatabaseImport.isDecimalLiteral (cognitive 21) · ×1
  • DatabaseImport.isDecimalLiteral (cognitive 21) Packages/OsaurusCore/Tools/Database/DatabaseImport.swift:590 — DatabaseImport.isDecimalLiteral has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 11, if/else 6 (9 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 · ChatSessionSidebar.workspaceSections (cognitive 21) · ×1
  • ChatSessionSidebar.workspaceSections (cognitive 21) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:1115 — ChatSessionSidebar.workspaceSections has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 7, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · FloatingInputCard.sandboxToggleChip (cognitive 21) · ×1
  • FloatingInputCard.sandboxToggleChip (cognitive 21) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:4039 — FloatingInputCard.sandboxToggleChip has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8, ternaries 5 (8 pts), boolean chains 5 (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 · FloatingInputCard.attachIfAllowed (cognitive 21) · ×1
  • FloatingInputCard.attachIfAllowed (cognitive 21) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:5193 — FloatingInputCard.attachIfAllowed has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (20 pts), ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VoiceStateSyncObservers.body (cognitive 21) · ×1
  • VoiceStateSyncObservers.body (cognitive 21) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:9052 — VoiceStateSyncObservers.body has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 7 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageTableRepresentable.updateNSView (cognitive 21) · ×1
  • MessageTableRepresentable.updateNSView (cognitive 21) Packages/OsaurusCore/Views/Chat/MessageTableRepresentable.swift:284 — MessageTableRepresentable.updateNSView has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 3 (6 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NativeMarkdownView.configureWithBlocks (cognitive 21) · ×1
  • NativeMarkdownView.configureWithBlocks (cognitive 21) Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:635 — NativeMarkdownView.configureWithBlocks has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 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, 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 · NativeMarkdownView.measureMixedSegmentHeight (cognitive 21) · ×1
  • NativeMarkdownView.measureMixedSegmentHeight (cognitive 21) Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:800 — NativeMarkdownView.measureMixedSegmentHeight has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NativeToolCallGroupView.configure (cognitive 21) · ×1
  • NativeToolCallGroupView.configure (cognitive 21) Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:698 — NativeToolCallGroupView.configure has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 4 (8 pts), boolean chains 6, if/else 3 (4 pts), loops 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 · SettingsTextField.field (cognitive 21) · ×1
  • SettingsTextField.field (cognitive 21) Packages/OsaurusCore/Views/DesignSystem/SettingsFields.swift:231 — SettingsTextField.field has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 4 (8 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OverviewTab.commonFacts (cognitive 21) · ×1
  • OverviewTab.commonFacts (cognitive 21) Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:1088 — OverviewTab.commonFacts has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 6, ternaries 2 (4 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 · OverviewTab.generationRows (cognitive 21) · ×1
  • OverviewTab.generationRows (cognitive 21) Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:1751 — OverviewTab.generationRows has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PluginsView.updateFilteredLists (cognitive 21) · ×1
  • PluginsView.updateFilteredLists (cognitive 21) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:890 — PluginsView.updateFilteredLists has cognitive complexity 21 (threshold 15). Drivers by points: loops 4 (8 pts), if/else 4 (7 pts), boolean chains 6 (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 · PluginDetailView.heroMetadata (cognitive 21) · ×1
  • PluginDetailView.heroMetadata (cognitive 21) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:1466 — PluginDetailView.heroMetadata has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 2 (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 · TasksView.lane (cognitive 21) · ×1
  • TasksView.lane (cognitive 21) Packages/OsaurusCore/Views/Task/TasksView.swift:201 — TasksView.lane has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 8, ternaries 3 (4 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · PublishedWorkflowDashboard.whoCanSeeIt (cognitive 21) · ×1
  • PublishedWorkflowDashboard.whoCanSeeIt (cognitive 21) Packages/OsaurusCore/Views/Template/PublishedWorkflowDashboard.swift:524 — PublishedWorkflowDashboard.whoCanSeeIt has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 7 (8 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 · DesignWorkingDocument.resolvingColors (cognitive 21) · ×1
  • DesignWorkingDocument.resolvingColors (cognitive 21) Packages/OsaurusCore/Models/Theme/DesignLibrary/DesignPrimitiveColors.swift:34 — DesignWorkingDocument.resolvingColors has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 6 (9 pts), boolean chains 2 (nesting depth added 7). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · XLSXEditor.setCell (cognitive 21) · ×1
  • XLSXEditor.setCell (cognitive 21) Packages/OsaurusCore/Services/Documents/OOXML/XLSXEditor.swift:231 — XLSXEditor.setCell has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 2 (5 pts), boolean chains 2, 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 · SSEFrameParser.process (cognitive 21) · ×1
  • SSEFrameParser.process (cognitive 21) Packages/OsaurusCore/Services/Event/Stream/SSEEventSource.swift:89 — SSEFrameParser.process has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (16 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 · MCPOAuthURLPolicy.isLocalOrPrivateHost (cognitive 21) · ×1
  • MCPOAuthURLPolicy.isLocalOrPrivateHost (cognitive 21) Packages/OsaurusCore/Services/MCP/OAuth/MCPOAuthHTTPTransport.swift:122 — MCPOAuthURLPolicy.isLocalOrPrivateHost has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 16, 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 · WorkflowNodeEditor.fromFields (cognitive 21) · ×1
  • WorkflowNodeEditor.fromFields (cognitive 21) Packages/OsaurusCore/Views/Workflow/Architect/WorkflowNodeEditor.swift:396 — WorkflowNodeEditor.fromFields has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 8 (14 pts), if/else 3 (5 pts), boolean chains 1, match/switch 1 (nesting depth added 8). Of this number, 19 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 · DoctorCommand.render (cognitive 20) · ×1
  • DoctorCommand.render (cognitive 20) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Doctor.swift:111 — DoctorCommand.render has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 4, 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 · InstallationDiagnostics.classify (cognitive 20) · ×1
  • InstallationDiagnostics.classify (cognitive 20) Packages/OsaurusCLI/Sources/OsaurusCLICore/Services/InstallationDiagnostics.swift:293 — InstallationDiagnostics.classify has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, 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.
D2 · Cognitive Complexity · ImportCommand.runValidate (cognitive 20) · ×1
  • ImportCommand.runValidate (cognitive 20) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Import/ImportCommand.swift:415 — ImportCommand.runValidate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, ternaries 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 · EvalReport.formatHumanReadable (cognitive 20) · ×1
  • EvalReport.formatHumanReadable (cognitive 20) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReport.swift:765 — EvalReport.formatHumanReadable has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 2 (3 pts), ternaries 1 (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 · BoundedArchiveExtractor.validatedPath (cognitive 20) · ×1
  • BoundedArchiveExtractor.validatedPath (cognitive 20) Packages/OsaurusRepository/BoundedArchiveExtractor.swift:419 — BoundedArchiveExtractor.validatedPath has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 9, 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 · BoundedArchiveExtractor.verify (cognitive 20) · ×1
  • BoundedArchiveExtractor.verify (cognitive 20) Packages/OsaurusRepository/BoundedArchiveExtractor.swift:960 — BoundedArchiveExtractor.verify has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 1 (2 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CatalogExpandedAssignments.sharedParts (cognitive 20) · ×1
  • CatalogExpandedAssignments.sharedParts (cognitive 20) Packages/OsaurusCore/DevelopmentDesign/CatalogComponents.swift:130 — CatalogExpandedAssignments.sharedParts has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 6, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileReadTool.executeBatch (cognitive 20) · ×1
  • FileReadTool.executeBatch (cognitive 20) Packages/OsaurusCore/Folder/FolderTools.swift:1419 — FileReadTool.executeBatch has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2 (4 pts), ternaries 1 (3 pts), boolean chains 1, 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 · FileReadTool.loadBoundedRawText (cognitive 20) · ×1
  • FileReadTool.loadBoundedRawText (cognitive 20) Packages/OsaurusCore/Folder/FolderTools.swift:2349 — FileReadTool.loadBoundedRawText has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 4, loops 1 (2 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 · HTTPHandler.handleCacheStatsEndpoint (cognitive 20) · ×1
  • HTTPHandler.handleCacheStatsEndpoint (cognitive 20) Packages/OsaurusCore/Networking/HTTPHandler.swift:1572 — HTTPHandler.handleCacheStatsEndpoint has cognitive complexity 20 (threshold 15). Drivers by points: if/else 19, 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 · HTTPHandler.handleImageGenerations (cognitive 20) · ×1
  • HTTPHandler.handleImageGenerations (cognitive 20) Packages/OsaurusCore/Networking/HTTPHandler.swift:13601 — HTTPHandler.handleImageGenerations has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 3 (4 pts), boolean chains 3, error handling 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 · HTTPHandler.handleAudioTranscriptions (cognitive 20) · ×1
  • HTTPHandler.handleAudioTranscriptions (cognitive 20) Packages/OsaurusCore/Networking/HTTPHandler.swift:18241 — HTTPHandler.handleAudioTranscriptions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 3, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelDownloadService.makeAlert (cognitive 20) · ×1
  • ModelDownloadService.makeAlert (cognitive 20) Packages/OsaurusCore/Services/ModelDownloadService.swift:106 — ModelDownloadService.makeAlert has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, if/else 10. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ModelRuntime.unload (cognitive 20) · ×1
  • ModelRuntime.unload (cognitive 20) Packages/OsaurusCore/Services/ModelRuntime.swift:2373 — ModelRuntime.unload has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 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 · ModelRuntime.materializeMediaDataUrlResult (cognitive 20) · ×1
  • ModelRuntime.materializeMediaDataUrlResult (cognitive 20) Packages/OsaurusCore/Services/ModelRuntime.swift:7953 — ModelRuntime.materializeMediaDataUrlResult has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (13 pts), match/switch 2 (6 pts), error handling 1 (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 · AgentDatabase.softDeleteMany (cognitive 20) · ×1
  • AgentDatabase.softDeleteMany (cognitive 20) Packages/OsaurusCore/Storage/AgentDatabase.swift:1174 — AgentDatabase.softDeleteMany has cognitive complexity 20 (threshold 15). Drivers by points: loops 7 (14 pts), if/else 4 (5 pts), boolean chains 1 (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · SubagentBatchAdmissionPlanner.planInternal (cognitive 20) · ×1
  • SubagentBatchAdmissionPlanner.planInternal (cognitive 20) Packages/OsaurusCore/Subagent/SubagentBatchAdmissionPlanner.swift:471 — SubagentBatchAdmissionPlanner.planInternal has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5, 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 · SandboxInstallTool.execute (cognitive 20) · ×1
  • SandboxInstallTool.execute (cognitive 20) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3588 — SandboxInstallTool.execute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9, boolean chains 3, error handling 3, ternaries 2 (3 pts), match/switch 1 (2 pts) (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 · UpdateKnowledgeTicketTool.execute (cognitive 20) · ×1
  • UpdateKnowledgeTicketTool.execute (cognitive 20) Packages/OsaurusCore/Tools/KnowledgeCurationTools.swift:331 — UpdateKnowledgeTicketTool.execute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 6, ternaries 1 (2 pts), error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SecretArgumentScrubber.scrubForPersistence (cognitive 20) · ×1
  • SecretArgumentScrubber.scrubForPersistence (cognitive 20) Packages/OsaurusCore/Tools/SandboxSecretTools.swift:387 — SecretArgumentScrubber.scrubForPersistence has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CNContactsService.apply (cognitive 20) · ×1
  • CNContactsService.apply (cognitive 20) Packages/OsaurusCore/AppleApps/Contacts/ContactsService.swift:351 — CNContactsService.apply has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12, ternaries 4 (8 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 · AppleScriptToolDispatch.literalContractViolation (cognitive 20) · ×1
  • AppleScriptToolDispatch.literalContractViolation (cognitive 20) Packages/OsaurusCore/AppleScript/Tool/AppleScriptToolDispatch.swift:659 — AppleScriptToolDispatch.literalContractViolation has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, if/else 5, ternaries 2 (4 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 · ScreenContextDistiller.buildWindows (cognitive 20) · ×1
  • ScreenContextDistiller.buildWindows (cognitive 20) Packages/OsaurusCore/ComputerUse/Perception/ScreenContextDistiller.swift:261 — ScreenContextDistiller.buildWindows 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 · ScreenContextDistiller.statusBarSignals (cognitive 20) · ×1
  • ScreenContextDistiller.statusBarSignals (cognitive 20) Packages/OsaurusCore/ComputerUse/Perception/ScreenContextDistiller.swift:759 — ScreenContextDistiller.statusBarSignals has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 6, 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 · ConfigApplier.patchCapabilities (cognitive 20) · ×1
  • ConfigApplier.patchCapabilities (cognitive 20) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:1149 — ConfigApplier.patchCapabilities has cognitive complexity 20 (threshold 15). Drivers by points: if/else 20. 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 · OsaurusConfigDocument.filtered (cognitive 20) · ×1
  • OsaurusConfigDocument.filtered (cognitive 20) Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigDocument.swift:179 — OsaurusConfigDocument.filtered has cognitive complexity 20 (threshold 15). Drivers by points: if/else 20. 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 · AgentChannelLiveProofReadiness.imessage (cognitive 20) · ×1
  • AgentChannelLiveProofReadiness.imessage (cognitive 20) Packages/OsaurusCore/Models/AgentChannel/AgentChannelLiveProofReadiness.swift:203 — AgentChannelLiveProofReadiness.imessage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16 (19 pts), 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 · Template.make (cognitive 20) · ×1
  • Template.make (cognitive 20) Packages/OsaurusCore/Models/Template/Template+Agent.swift:233 — Template.make has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (3 pts), ternaries 2, 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 · Builder.use (cognitive 20) · ×1
  • Builder.use (cognitive 20) Packages/OsaurusCore/Models/Workflow/WorkflowAccessScope.swift:245 — Builder.use has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 1, 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 · WorkflowRequirementsDeriver.reach (cognitive 20) · ×1
  • WorkflowRequirementsDeriver.reach (cognitive 20) Packages/OsaurusCore/Models/Workflow/WorkflowRequirementsDeriver.swift:127 — WorkflowRequirementsDeriver.reach has cognitive complexity 20 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 3 (9 pts), boolean chains 1 (nesting depth added 12). 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, 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 · AgentChannelInboundRelay.submit (cognitive 20) · ×1
  • AgentChannelInboundRelay.submit (cognitive 20) Packages/OsaurusCore/Services/AgentChannel/AgentChannelInboundRelay.swift:202 — AgentChannelInboundRelay.submit has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 7, 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 · AgentChannelInboundRelay.run (cognitive 20) · ×1
  • AgentChannelInboundRelay.run (cognitive 20) Packages/OsaurusCore/Services/AgentChannel/AgentChannelInboundRelay.swift:552 — AgentChannelInboundRelay.run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, error handling 1 (4 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 · AgentCreationEvalHarness.run (cognitive 20) · ×1
  • AgentCreationEvalHarness.run (cognitive 20) Packages/OsaurusCore/Services/AgentCreation/AgentCreationEvalHarness.swift:63 — AgentCreationEvalHarness.run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8, boolean chains 5, loops 3 (4 pts), ternaries 2 (3 pts) (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 · AttentionActivityLogger.details (cognitive 20) · ×1
  • AttentionActivityLogger.details (cognitive 20) Packages/OsaurusCore/Services/Attention/AttentionActivityLogger.swift:263 — AttentionActivityLogger.details has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 2 (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 · ChatImportDecoding.payloads (cognitive 20) · ×1
  • ChatImportDecoding.payloads (cognitive 20) Packages/OsaurusCore/Services/ChatImport/ChatImportSourceResolver.swift:507 — ChatImportDecoding.payloads has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 3 (5 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentChannelEvalHarness.runProactivePublish (cognitive 20) · ×1
  • AgentChannelEvalHarness.runProactivePublish (cognitive 20) REDACTED:663 — AgentChannelEvalHarness.runProactivePublish has cognitive complexity 20 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 2 (nesting depth added 1). 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: 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 · AppleScriptEvaluator.run (cognitive 20) · ×1
  • AppleScriptEvaluator.run (cognitive 20) Packages/OsaurusCore/Services/Context/AppleScriptEvaluator.swift:226 — AppleScriptEvaluator.run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 3 (5 pts), boolean chains 3, 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 · MicroPerfEvaluator.measureRep (cognitive 20) · ×1
  • MicroPerfEvaluator.measureRep (cognitive 20) Packages/OsaurusCore/Services/Context/MicroPerfEvaluator.swift:497 — MicroPerfEvaluator.measureRep has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 2 (3 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 · FileChangeJournal.preciseSnapshot (cognitive 20) · ×1
  • FileChangeJournal.preciseSnapshot (cognitive 20) Packages/OsaurusCore/Services/FileHistory/FileChangeJournal.swift:355 — FileChangeJournal.preciseSnapshot has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileDiffEngine.wordRanges (cognitive 20) · ×1
  • FileDiffEngine.wordRanges (cognitive 20) Packages/OsaurusCore/Services/FileHistory/FileDiffEngine.swift:412 — FileDiffEngine.wordRanges has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (7 pts), loops 5 (6 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.
D2 · Cognitive Complexity · PendingImportProcessor.remove (cognitive 20) · ×1
  • PendingImportProcessor.remove (cognitive 20) Packages/OsaurusCore/Services/Import/PendingImportProcessor.swift:780 — PendingImportProcessor.remove has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, ternaries 1 (3 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 · OnboardingFirstRun.perform (cognitive 20) · ×1
  • OnboardingFirstRun.perform (cognitive 20) Packages/OsaurusCore/Services/Onboarding/OnboardingFirstRun.swift:301 — OnboardingFirstRun.perform has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 3, 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 · OnboardingPanel.fillFirstTask (cognitive 20) · ×1
  • OnboardingPanel.fillFirstTask (cognitive 20) Packages/OsaurusCore/Services/Onboarding/OnboardingPanel.swift:170 — OnboardingPanel.fillFirstTask has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 8, 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.
D2 · Cognitive Complexity · InstalledClaudePluginsAggregator.buildPlugins (cognitive 20) · ×1
  • InstalledClaudePluginsAggregator.buildPlugins (cognitive 20) Packages/OsaurusCore/Services/Plugin/InstalledClaudePluginsAggregator.swift:495 — InstalledClaudePluginsAggregator.buildPlugins has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 6, boolean chains 5 (nesting depth added 4). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InboundSharedRunBridge.mergeCompletedTurn (cognitive 20) · ×1
  • InboundSharedRunBridge.mergeCompletedTurn (cognitive 20) Packages/OsaurusCore/Services/Router/InboundSharedRunBridge.swift:520 — InboundSharedRunBridge.mergeCompletedTurn has cognitive complexity 20 (threshold 15). Drivers by points: if/else 19, 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 · SlackConnectionService.classifyInboundEvent (cognitive 20) · ×1
  • SlackConnectionService.classifyInboundEvent (cognitive 20) Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:1437 — SlackConnectionService.classifyInboundEvent has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 13, if/else 6, 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 · TemplateExportSanitizer.portableArgs (cognitive 20) · ×1
  • TemplateExportSanitizer.portableArgs (cognitive 20) Packages/OsaurusCore/Services/Template/TemplateExportSanitizer.swift:125 — TemplateExportSanitizer.portableArgs has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 2 (7 pts), boolean chains 1, 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 · HTTPNodeExecutor.fetch (cognitive 20) · ×1
  • HTTPNodeExecutor.fetch (cognitive 20) Packages/OsaurusCore/Services/Workflow/HTTPNodeExecutor.swift:224 — HTTPNodeExecutor.fetch has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 4, error handling 3, loops 2, 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 · WorkflowArtifactCollector.outputFiles (cognitive 20) · ×1
  • WorkflowArtifactCollector.outputFiles (cognitive 20) Packages/OsaurusCore/Services/Workflow/WorkflowArtifacts.swift:189 — WorkflowArtifactCollector.outputFiles has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 2 (7 pts), if/else 3 (5 pts), match/switch 2 (5 pts), 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 · WorkflowRunner.resolveSecrets (cognitive 20) · ×1
  • WorkflowRunner.resolveSecrets (cognitive 20) Packages/OsaurusCore/Services/Workflow/WorkflowRunner.swift:878 — WorkflowRunner.resolveSecrets has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, error handling 1 (3 pts), loops 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DatabaseImport.detectFormat (cognitive 20) · ×1
  • DatabaseImport.detectFormat (cognitive 20) Packages/OsaurusCore/Tools/Database/DatabaseImport.swift:88 — DatabaseImport.detectFormat has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 4, ternaries 2 (4 pts), match/switch 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DatabaseImport.buildRowsFromObjects (cognitive 20) · ×1
  • DatabaseImport.buildRowsFromObjects (cognitive 20) Packages/OsaurusCore/Tools/Database/DatabaseImport.swift:500 — DatabaseImport.buildRowsFromObjects has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatShellLayout.init (cognitive 20) · ×1
  • ChatShellLayout.init (cognitive 20) Packages/OsaurusCore/Views/Chat/ChatShellLayout.swift:128 — ChatShellLayout.init has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 8 (16 pts), boolean chains 3, 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 · ChatSession.applyPickerItems (cognitive 20) · ×1
  • ChatSession.applyPickerItems (cognitive 20) Packages/OsaurusCore/Views/Chat/ChatView.swift:1975 — ChatSession.applyPickerItems has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (14 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, 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 · ChatSession.maybeGenerateFollowUps (cognitive 20) · ×1
  • ChatSession.maybeGenerateFollowUps (cognitive 20) Packages/OsaurusCore/Views/Chat/ChatView.swift:5541 — ChatSession.maybeGenerateFollowUps has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 13, if/else 6, 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 · NativeActivityGroupView.configureChildren (cognitive 20) · ×1
  • NativeActivityGroupView.configureChildren (cognitive 20) Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:313 — NativeActivityGroupView.configureChildren has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (9 pts), match/switch 2 (6 pts), loops 3 (5 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 · NativeToolCallRowView.hitTest (cognitive 20) · ×1
  • NativeToolCallRowView.hitTest (cognitive 20) Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:1072 — NativeToolCallRowView.hitTest has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 2 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · SidebarLensBar.segmentButton (cognitive 20) · ×1
  • SidebarLensBar.segmentButton (cognitive 20) Packages/OsaurusCore/Views/Management/SharedSidebarComponents.swift:281 — SidebarLensBar.segmentButton has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 10 (14 pts), boolean chains 3, if/else 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.
D2 · Cognitive Complexity · ModelDetailView.detailsCard (cognitive 20) · ×1
  • ModelDetailView.detailsCard (cognitive 20) Packages/OsaurusCore/Views/Model/ModelDetailView.swift:551 — ModelDetailView.detailsCard has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15, ternaries 2 (3 pts), boolean chains 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 · ModelPickerView.thinkingOptionRow (cognitive 20) · ×1
  • ModelPickerView.thinkingOptionRow (cognitive 20) Packages/OsaurusCore/Views/Model/ModelPickerView.swift:916 — ModelPickerView.thinkingOptionRow has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 8 (11 pts), boolean chains 5, if/else 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 · ScreenshotController.captureWindow (cognitive 20) · ×1
  • ScreenshotController.captureWindow (cognitive 20) Packages/OsaurusCore/ComputerUse/Driver/Mac/Screenshot.swift:264 — ScreenshotController.captureWindow has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (9 pts), loops 1 (2 pts) (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 · PPTXEditor.duplicateSlide (cognitive 20) · ×1
  • PPTXEditor.duplicateSlide (cognitive 20) Packages/OsaurusCore/Services/Documents/OOXML/PPTXEditor.swift:258 — PPTXEditor.duplicateSlide has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts), boolean chains 2, ternaries 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 · MCPOAuthDiscovery.fetchAuthorizationServerMetadata (cognitive 20) · ×1
  • MCPOAuthDiscovery.fetchAuthorizationServerMetadata (cognitive 20) Packages/OsaurusCore/Services/MCP/OAuth/MCPOAuthDiscovery.swift:280 — MCPOAuthDiscovery.fetchAuthorizationServerMetadata has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 2 (5 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 · DatabaseSavedViewsView.detail (cognitive 20) · ×1
  • DatabaseSavedViewsView.detail (cognitive 20) Packages/OsaurusCore/Views/Agent/Database/DatabaseSavedViewsView.swift:152 — DatabaseSavedViewsView.detail has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 1 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ArchitectSidebarPanel.testSections (cognitive 20) · ×1
  • ArchitectSidebarPanel.testSections (cognitive 20) Packages/OsaurusCore/Views/Workflow/Architect/ArchitectSidebarPanel.swift:467 — ArchitectSidebarPanel.testSections has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 3 (5 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 · WorkflowDetailPage.beforeItRuns (cognitive 20) · ×1
  • WorkflowDetailPage.beforeItRuns (cognitive 20) Packages/OsaurusCore/Views/Workflow/Library/WorkflowDetailPage.swift:388 — WorkflowDetailPage.beforeItRuns has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (11 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, 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 · WorkflowSetupWizardView.steps (cognitive 20) · ×1
  • WorkflowSetupWizardView.steps (cognitive 20) Packages/OsaurusCore/Views/Workflow/Library/WorkflowSetupWizardView.swift:368 — WorkflowSetupWizardView.steps has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, if/else 10. Of this number, 17 points are the body's own statements and 3 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 · WorkflowSecretsStep.row (cognitive 20) · ×1
  • WorkflowSecretsStep.row (cognitive 20) Packages/OsaurusCore/Views/Workflow/Library/WorkflowSetupWizardView.swift:996 — WorkflowSecretsStep.row has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 6, ternaries 5 (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 · Accessibility.swift.listWindowsForPid (cognitive 20) · ×1
  • Accessibility.swift.listWindowsForPid (cognitive 20) Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:1651 — Accessibility.swift.listWindowsForPid has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 9, 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 · BenchCommand.execute (cognitive 19) · ×1
  • BenchCommand.execute (cognitive 19) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Bench.swift:46 — BenchCommand.execute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (10 pts), error handling 3 (6 pts), loops 2 (3 pts) (nesting depth added 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 · EvalMTPControlState.verdict (cognitive 19) · ×1
  • EvalMTPControlState.verdict (cognitive 19) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalMTPControl.swift:151 — EvalMTPControlState.verdict has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (18 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 · EvalRunner.scoreComputerUseLane (cognitive 19) · ×1
  • EvalRunner.scoreComputerUseLane (cognitive 19) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:548 — EvalRunner.scoreComputerUseLane has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 3, loops 3, ternaries 3 (nesting depth added 3). Of this number, 17 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · EvalRunner.scoreBrowserUseLane (cognitive 19) · ×1
  • EvalRunner.scoreBrowserUseLane (cognitive 19) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:678 — EvalRunner.scoreBrowserUseLane has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, loops 3, ternaries 2 (nesting depth added 2). Of this number, 17 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MLXMetallibBootstrap.locateSource (cognitive 19) · ×1
  • MLXMetallibBootstrap.locateSource (cognitive 19) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/MLXMetallibBootstrap.swift:74 — MLXMetallibBootstrap.locateSource has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (9 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 · CentralRepositoryManager.mapFailure (cognitive 19) · ×1
  • CentralRepositoryManager.mapFailure (cognitive 19) Packages/OsaurusRepository/CentralRepositoryManager.swift:444 — CentralRepositoryManager.mapFailure has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), match/switch 3 (6 pts), boolean chains 2 (nesting depth added 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 · CatalogAssignmentRow.body (cognitive 19) · ×1
  • CatalogAssignmentRow.body (cognitive 19) Packages/OsaurusCore/DevelopmentDesign/CatalogComponents.swift:242 — CatalogAssignmentRow.body has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (7 pts), boolean chains 6, if/else 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.
D2 · Cognitive Complexity · FileEditTool.noMatchDiagnosis (cognitive 19) · ×1
  • FileEditTool.noMatchDiagnosis (cognitive 19) Packages/OsaurusCore/Folder/FolderTools.swift:4386 — FileEditTool.noMatchDiagnosis has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3, 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 · MCPProviderManager.connectProviderWithTransientRetry (cognitive 19) · ×1
  • MCPProviderManager.connectProviderWithTransientRetry (cognitive 19) Packages/OsaurusCore/Managers/MCPProviderManager.swift:594 — MCPProviderManager.connectProviderWithTransientRetry has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 2, error handling 1 (2 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 · SkillArchiveProcessRunner.run (cognitive 19) · ×1
  • SkillArchiveProcessRunner.run (cognitive 19) Packages/OsaurusCore/Managers/SkillImportPolicy.swift:306 — SkillArchiveProcessRunner.run has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2, match/switch 2, 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 · HTTPHandler.decryptSecureCall (cognitive 19) · ×1
  • HTTPHandler.decryptSecureCall (cognitive 19) Packages/OsaurusCore/Networking/HTTPHandler.swift:9162 — HTTPHandler.decryptSecureCall has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, boolean chains 3, error handling 3, 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 · HTTPHandler.runImageJob (cognitive 19) · ×1
  • HTTPHandler.runImageJob (cognitive 19) Packages/OsaurusCore/Networking/HTTPHandler.swift:14582 — HTTPHandler.runImageJob has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 3 (9 pts), match/switch 1 (4 pts), loops 1 (3 pts), error handling 1 (2 pts), if/else 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 · DeclaredReasoningEffort.nativeThinkingModes (cognitive 19) · ×1
  • DeclaredReasoningEffort.nativeThinkingModes (cognitive 19) Packages/OsaurusCore/Services/DeclaredReasoningEffort.swift:300 — DeclaredReasoningEffort.nativeThinkingModes has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 17, if/else 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 · GitHubSkillService.resolvePluginDependencies (cognitive 19) · ×1
  • GitHubSkillService.resolvePluginDependencies (cognitive 19) Packages/OsaurusCore/Services/GitHubSkillService.swift:1440 — GitHubSkillService.resolvePluginDependencies has cognitive complexity 19 (threshold 15). Drivers by points: loops 8 (11 pts), if/else 3 (7 pts), boolean chains 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 · ModelRuntime.clearAll (cognitive 19) · ×1
  • ModelRuntime.clearAll (cognitive 19) Packages/OsaurusCore/Services/ModelRuntime.swift:2743 — ModelRuntime.clearAll has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 4, 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 · ModelRuntime.streamRawText (cognitive 19) · ×1
  • ModelRuntime.streamRawText (cognitive 19) Packages/OsaurusCore/Services/ModelRuntime.swift:6621 — ModelRuntime.streamRawText has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (3 pts), loops 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 · AgentDatabase.forbiddenReason (cognitive 19) · ×1
  • AgentDatabase.forbiddenReason (cognitive 19) Packages/OsaurusCore/Storage/AgentDatabase.swift:2364 — AgentDatabase.forbiddenReason has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5, 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 · SubagentSession.localInPlaceCapacityDecision (cognitive 19) · ×1
  • SubagentSession.localInPlaceCapacityDecision (cognitive 19) Packages/OsaurusCore/Subagent/SubagentSession.swift:1424 — SubagentSession.localInPlaceCapacityDecision has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 7, 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 · CapabilitiesDiscoverTool.mergeHits (cognitive 19) · ×1
  • CapabilitiesDiscoverTool.mergeHits (cognitive 19) Packages/OsaurusCore/Tools/CapabilityTools.swift:904 — CapabilitiesDiscoverTool.mergeHits has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 4 (7 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CapabilitiesLoadTool.execute (cognitive 19) · ×1
  • CapabilitiesLoadTool.execute (cognitive 19) Packages/OsaurusCore/Tools/CapabilityTools.swift:1013 — CapabilitiesLoadTool.execute has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (7 pts), if/else 5 (6 pts), match/switch 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · CapabilitiesLoadTool.loadSkill (cognitive 19) · ×1
  • CapabilitiesLoadTool.loadSkill (cognitive 19) Packages/OsaurusCore/Tools/CapabilityTools.swift:1569 — CapabilitiesLoadTool.loadSkill has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 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 · OsaurusHelpTool.execute (cognitive 19) · ×1
  • OsaurusHelpTool.execute (cognitive 19) Packages/OsaurusCore/Tools/ConfigurationTools.swift:1155 — OsaurusHelpTool.execute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 1 (2 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EditKnowledgeTool.execute (cognitive 19) · ×1
  • EditKnowledgeTool.execute (cognitive 19) Packages/OsaurusCore/Tools/KnowledgeWriteTools.swift:822 — EditKnowledgeTool.execute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 pts), error handling 2 (3 pts), ternaries 1 (3 pts), boolean chains 2, 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 · Parser.parsePrimary (cognitive 19) · ×1
  • Parser.parsePrimary (cognitive 19) Packages/OsaurusCore/Utils/CalculatorEngine.swift:630 — Parser.parsePrimary has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 1 (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 · ChatPerfTrace.emit (cognitive 19) · ×1
  • ChatPerfTrace.emit (cognitive 19) Packages/OsaurusCore/Utils/ChatPerfTrace.swift:130 — ChatPerfTrace.emit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 2 (6 pts), loops 2 (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 · ChatDBMessagesService.send (cognitive 19) · ×1
  • ChatDBMessagesService.send (cognitive 19) Packages/OsaurusCore/AppleApps/Messages/MessagesService.swift:490 — ChatDBMessagesService.send has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, error handling 1 (2 pts), loops 1, 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 · AppleScriptExecutor.renderRecord (cognitive 19) · ×1
  • AppleScriptExecutor.renderRecord (cognitive 19) Packages/OsaurusCore/AppleScript/Exec/AppleScriptExecutor.swift:597 — AppleScriptExecutor.renderRecord has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (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 · MockAppleScriptWorld.handle (cognitive 19) · ×1
  • MockAppleScriptWorld.handle (cognitive 19) Packages/OsaurusCore/AppleScript/Exec/MockAppleScriptWorld.swift:81 — MockAppleScriptWorld.handle has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, boolean chains 5, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · BrowserToolExecutor.cookies (cognitive 19) · ×1
  • BrowserToolExecutor.cookies (cognitive 19) Packages/OsaurusCore/Browser/Tool/BrowserToolExecutor.swift:723 — BrowserToolExecutor.cookies has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (18 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 · ConfigApplier.patchToolSelection (cognitive 19) · ×1
  • ConfigApplier.patchToolSelection (cognitive 19) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:969 — ConfigApplier.patchToolSelection has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9, boolean chains 6, loops 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 · ConfigChannelRouting.exportRule (cognitive 19) · ×1
  • ConfigChannelRouting.exportRule (cognitive 19) Packages/OsaurusCore/Configuration/Declarative/ConfigChannelRouting.swift:254 — ConfigChannelRouting.exportRule has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 5 (8 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 · ConfigChannelPosting.desired (cognitive 19) · ×1
  • ConfigChannelPosting.desired (cognitive 19) Packages/OsaurusCore/Configuration/Declarative/ConfigChannelRouting.swift:461 — ConfigChannelPosting.desired has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigDiff.unifiedText (cognitive 19) · ×1
  • ConfigDiff.unifiedText (cognitive 19) Packages/OsaurusCore/Configuration/Declarative/ConfigDiff.swift:178 — ConfigDiff.unifiedText has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (5 pts), match/switch 1 (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 · ConfigEvents.apply (cognitive 19) · ×1
  • ConfigEvents.apply (cognitive 19) Packages/OsaurusCore/Configuration/Declarative/ConfigEvents.swift:1196 — ConfigEvents.apply has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 2 (6 pts), loops 2 (3 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigPlanner.planDelegation (cognitive 19) · ×1
  • ConfigPlanner.planDelegation (cognitive 19) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1730 — ConfigPlanner.planDelegation has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 7, loops 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChatWindowState.showMainSurface (cognitive 19) · ×1
  • ChatWindowState.showMainSurface (cognitive 19) Packages/OsaurusCore/Managers/Chat/ChatWindowState.swift:625 — ChatWindowState.showMainSurface has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 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 · ChatCompletionRequest.init (cognitive 19) · ×1
  • ChatCompletionRequest.init (cognitive 19) Packages/OsaurusCore/Models/API/OpenAIAPI.swift:1043 — ChatCompletionRequest.init has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 7 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Template.parseEnvelope (cognitive 19) · ×1
  • Template.parseEnvelope (cognitive 19) Packages/OsaurusCore/Models/Template/Template.swift:568 — Template.parseEnvelope has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 2, loops 1 (2 pts), boolean chains 1, 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 · PrivacyFilterModelDownloader.runDownload (cognitive 19) · ×1
  • PrivacyFilterModelDownloader.runDownload (cognitive 19) Packages/OsaurusCore/PrivacyFilter/Model/PrivacyFilterModelDownloader.swift:144 — PrivacyFilterModelDownloader.runDownload has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 4 (6 pts), loops 2, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentChannelCustomJSONRunner.renderedURL (cognitive 19) · ×1
  • AgentChannelCustomJSONRunner.renderedURL (cognitive 19) Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:1723 — AgentChannelCustomJSONRunner.renderedURL has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (7 pts), ternaries 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 · AccountRuntime.plan (cognitive 19) · ×1
  • AccountRuntime.plan (cognitive 19) Packages/OsaurusCore/Services/AgentChannel/AgentChannelTransportRuntime.swift:407 — AccountRuntime.plan has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, ternaries 1 (2 pts), 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 · SharedConversationPoller.run (cognitive 19) · ×1
  • SharedConversationPoller.run (cognitive 19) Packages/OsaurusCore/Services/Attention/SharedConversationPoller.swift:63 — SharedConversationPoller.run has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 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 · EventManager.syncTask (cognitive 19) · ×1
  • EventManager.syncTask (cognitive 19) Packages/OsaurusCore/Services/Event/EventManager.swift:969 — EventManager.syncTask has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 6, if/else 6, ternaries 3 (6 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 · ScheduleEventSource.fireMissed (cognitive 19) · ×1
  • ScheduleEventSource.fireMissed (cognitive 19) Packages/OsaurusCore/Services/Event/ScheduleEventSource.swift:97 — ScheduleEventSource.fireMissed has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 2 (4 pts), ternaries 1 (3 pts), match/switch 1 (2 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 · FileChangeJournal.pruneShadows (cognitive 19) · ×1
  • FileChangeJournal.pruneShadows (cognitive 19) Packages/OsaurusCore/Services/FileHistory/FileChangeJournal.swift:678 — FileChangeJournal.pruneShadows has cognitive complexity 19 (threshold 15). Drivers by points: loops 7 (11 pts), if/else 4 (5 pts), error handling 1 (2 pts), boolean chains 1 (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 · FileChangeJournal.markEntries (cognitive 19) · ×1
  • FileChangeJournal.markEntries (cognitive 19) Packages/OsaurusCore/Services/FileHistory/FileChangeJournal+Revert.swift:343 — FileChangeJournal.markEntries has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 7, 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 · IMessageConnectionService.runWatchSession (cognitive 19) · ×1
  • IMessageConnectionService.runWatchSession (cognitive 19) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:847 — IMessageConnectionService.runWatchSession has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 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 · CoreModelService.executeModelCall (cognitive 19) · ×1
  • CoreModelService.executeModelCall (cognitive 19) Packages/OsaurusCore/Services/Inference/CoreModelService.swift:783 — CoreModelService.executeModelCall has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (9 pts), error handling 2 (4 pts), boolean chains 3, ternaries 1 (2 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 · ModelServiceRouter.resolve (cognitive 19) · ×1
  • ModelServiceRouter.resolve (cognitive 19) Packages/OsaurusCore/Services/Inference/ModelService.swift:874 — ModelServiceRouter.resolve has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 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 · ResponsesToolChoiceContract.validate (cognitive 19) · ×1
  • ResponsesToolChoiceContract.validate (cognitive 19) Packages/OsaurusCore/Services/Inference/ResponsesToolChoiceContract.swift:93 — ResponsesToolChoiceContract.validate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 8, 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 · KnowledgeDiff.lcsDiff (cognitive 19) · ×1
  • KnowledgeDiff.lcsDiff (cognitive 19) Packages/OsaurusCore/Services/Knowledge/KnowledgeDiff.swift:82 — KnowledgeDiff.lcsDiff has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 5 (6 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KnowledgeDocumentParser.chunk (cognitive 19) · ×1
  • KnowledgeDocumentParser.chunk (cognitive 19) Packages/OsaurusCore/Services/Knowledge/KnowledgeDocumentParser.swift:202 — KnowledgeDocumentParser.chunk has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 4 (8 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KnowledgeLinkResolver.plainTextMatches (cognitive 19) · ×1
  • KnowledgeLinkResolver.plainTextMatches (cognitive 19) Packages/OsaurusCore/Services/Knowledge/KnowledgeLinkResolver.swift:111 — KnowledgeLinkResolver.plainTextMatches has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MediaGenerationCoordinator.scheduleRecovery (cognitive 19) · ×1
  • MediaGenerationCoordinator.scheduleRecovery (cognitive 19) Packages/OsaurusCore/Services/MediaGeneration/MediaGenerationCoordinator.swift:390 — MediaGenerationCoordinator.scheduleRecovery has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 2 (4 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 · MemorySearchService.ensureVectorDB (cognitive 19) · ×1
  • MemorySearchService.ensureVectorDB (cognitive 19) Packages/OsaurusCore/Services/Memory/MemorySearchService.swift:181 — MemorySearchService.ensureVectorDB has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 3 (10 pts), if/else 4 (6 pts), 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 · MemoryService.backfillFromChatHistory (cognitive 19) · ×1
  • MemoryService.backfillFromChatHistory (cognitive 19) Packages/OsaurusCore/Services/Memory/MemoryService.swift:580 — MemoryService.backfillFromChatHistory has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 1 (3 pts), loops 2 (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 · PluginHostContext.checkSSRF (cognitive 19) · ×1
  • PluginHostContext.checkSSRF (cognitive 19) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:3009 — PluginHostContext.checkSSRF has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 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 · RemoteProviderService.extractInlineImages (cognitive 19) · ×1
  • RemoteProviderService.extractInlineImages (cognitive 19) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:5012 — RemoteProviderService.extractInlineImages has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 2 (4 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 · RemoteProviderService.fetchOsaurusModels (cognitive 19) · ×1
  • RemoteProviderService.fetchOsaurusModels (cognitive 19) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:7194 — RemoteProviderService.fetchOsaurusModels has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), ternaries 2, 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 · RemoteToolDetection.detectInlineToolCall (cognitive 19) · ×1
  • RemoteToolDetection.detectInlineToolCall (cognitive 19) Packages/OsaurusCore/Services/Provider/RemoteToolDetection.swift:26 — RemoteToolDetection.detectInlineToolCall has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 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 · WorkspacesService.applyDefaultBilling (cognitive 19) · ×1
  • WorkspacesService.applyDefaultBilling (cognitive 19) Packages/OsaurusCore/Services/Router/WorkspacesService.swift:1259 — WorkspacesService.applyDefaultBilling has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 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 · ClaudePluginInstaller.synthesizeSkillFromFreeformMarkdown (cognitive 19) · ×1
  • ClaudePluginInstaller.synthesizeSkillFromFreeformMarkdown (cognitive 19) Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:1110 — ClaudePluginInstaller.synthesizeSkillFromFreeformMarkdown has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 2, 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 · SyncConversationMapper.detailWrite (cognitive 19) · ×1
  • SyncConversationMapper.detailWrite (cognitive 19) Packages/OsaurusCore/Services/Sync/SyncConversationMapper.swift:508 — SyncConversationMapper.detailWrite has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, loops 3, ternaries 1 (nesting depth added 2). Of this number, 15 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · TemplateImportRouter.fetch (cognitive 19) · ×1
  • TemplateImportRouter.fetch (cognitive 19) Packages/OsaurusCore/Services/Template/TemplateImportRouter.swift:269 — TemplateImportRouter.fetch has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3, error handling 1, 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 · KeyboardSimulationService.pasteText (cognitive 19) · ×1
  • KeyboardSimulationService.pasteText (cognitive 19) Packages/OsaurusCore/Services/Voice/KeyboardSimulationService.swift:140 — KeyboardSimulationService.pasteText has cognitive complexity 19 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 5 (8 pts), boolean chains 1 (nesting depth added 9). 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 · VADService.setupObservers (cognitive 19) · ×1
  • VADService.setupObservers (cognitive 19) Packages/OsaurusCore/Services/Voice/VADService.swift:199 — VADService.setupObservers has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5 (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 · WhatsAppConnectionService.normalizeInbound (cognitive 19) · ×1
  • WhatsAppConnectionService.normalizeInbound (cognitive 19) Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:1324 — WhatsAppConnectionService.normalizeInbound has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8, ternaries 7, boolean chains 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 · ArchitectInlineEvaluator.runScoped (cognitive 19) · ×1
  • ArchitectInlineEvaluator.runScoped (cognitive 19) Packages/OsaurusCore/Services/Workflow/ArchitectInlineEvaluator.swift:100 — ArchitectInlineEvaluator.runScoped has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, boolean chains 8. 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 · DialogNodeExecutor.plan (cognitive 19) · ×1
  • DialogNodeExecutor.plan (cognitive 19) Packages/OsaurusCore/Services/Workflow/DialogNodeExecutor.swift:27 — DialogNodeExecutor.plan has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (11 pts), ternaries 2 (5 pts), match/switch 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 · HostedWorkflowClient.run (cognitive 19) · ×1
  • HostedWorkflowClient.run (cognitive 19) Packages/OsaurusCore/Services/Workflow/HostedWorkflowLinks.swift:284 — HostedWorkflowClient.run has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 2 (3 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 · WorkflowRunObservations.notes (cognitive 19) · ×1
  • WorkflowRunObservations.notes (cognitive 19) Packages/OsaurusCore/Services/Workflow/WorkflowRunObservations.swift:16 — WorkflowRunObservations.notes has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 4, 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 · TextSubagentKind.matchesApprovedAuthority (cognitive 19) · ×1
  • TextSubagentKind.matchesApprovedAuthority (cognitive 19) Packages/OsaurusCore/Subagent/Kinds/TextSubagentKind.swift:869 — TextSubagentKind.matchesApprovedAuthority has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 12, if/else 4 (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 · TextSubagentKind.run (cognitive 19) · ×1
  • TextSubagentKind.run (cognitive 19) Packages/OsaurusCore/Subagent/Kinds/TextSubagentKind.swift:987 — TextSubagentKind.run has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 2, 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 · WorkflowRunsTool.scope (cognitive 19) · ×1
  • WorkflowRunsTool.scope (cognitive 19) Packages/OsaurusCore/Tools/Workflow/WorkflowRunsTool.swift:164 — WorkflowRunsTool.scope has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, ternaries 1 (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 · AgentGenerationInheritedValues.resolve (cognitive 19) · ×1
  • AgentGenerationInheritedValues.resolve (cognitive 19) Packages/OsaurusCore/Views/Agent/AgentGenerationInheritedValues.swift:18 — AgentGenerationInheritedValues.resolve has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, ternaries 4, boolean chains 3. Of this number, 16 points are the body's own statements and 3 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 · SpawnConfigurationEditor.allowedAgents (cognitive 19) · ×1
  • SpawnConfigurationEditor.allowedAgents (cognitive 19) Packages/OsaurusCore/Views/Agent/SpawnConfigurationEditor.swift:185 — SpawnConfigurationEditor.allowedAgents has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 2 (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 · FloatingInputCard.handleBuiltInSlashAction (cognitive 19) · ×1
  • FloatingInputCard.handleBuiltInSlashAction (cognitive 19) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:2249 — FloatingInputCard.handleBuiltInSlashAction has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 5). 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 · NativeActivityGroupView.stepChips (cognitive 19) · ×1
  • NativeActivityGroupView.stepChips (cognitive 19) Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:402 — NativeActivityGroupView.stepChips has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 1 (5 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NativeFileDiffView.applyInspectionStyle (cognitive 19) · ×1
  • NativeFileDiffView.applyInspectionStyle (cognitive 19) Packages/OsaurusCore/Views/Chat/NativeFileDiffView.swift:243 — NativeFileDiffView.applyInspectionStyle has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, loops 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NativeMarkdownView.applySearchHighlightsIfNeeded (cognitive 19) · ×1
  • NativeMarkdownView.applySearchHighlightsIfNeeded (cognitive 19) Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:361 — NativeMarkdownView.applySearchHighlightsIfNeeded has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NativeMarkdownView.measuredHeight (cognitive 19) · ×1
  • NativeMarkdownView.measuredHeight (cognitive 19) Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:740 — NativeMarkdownView.measuredHeight has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SelectableTextView.updateTextStorageIncrementally (cognitive 19) · ×1
  • SelectableTextView.updateTextStorageIncrementally (cognitive 19) Packages/OsaurusCore/Views/Chat/SelectableTextView.swift:239 — SelectableTextView.updateTextStorageIncrementally has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, loops 2, ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OverviewTab.workflowSection (cognitive 19) · ×1
  • OverviewTab.workflowSection (cognitive 19) Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:1376 — OverviewTab.workflowSection has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, boolean chains 4, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · OverviewTab.whoRows (cognitive 19) · ×1
  • OverviewTab.whoRows (cognitive 19) Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:1684 — OverviewTab.whoRows has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15 (17 pts), 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 · ModelDetailView.manifestStatus (cognitive 19) · ×1
  • ModelDetailView.manifestStatus (cognitive 19) Packages/OsaurusCore/Views/Model/ModelDetailView.swift:1114 — ModelDetailView.manifestStatus has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3, match/switch 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 · ShareWorkflowSheet.liveView (cognitive 19) · ×1
  • ShareWorkflowSheet.liveView (cognitive 19) Packages/OsaurusCore/Views/Template/ShareWorkflowSheet.swift:717 — ShareWorkflowSheet.liveView has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (9 pts), if/else 7 (8 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ActivateWorkspaceSheet.body (cognitive 19) · ×1
  • ActivateWorkspaceSheet.body (cognitive 19) Packages/OsaurusCore/Views/Workspaces/WorkspaceSheets.swift:490 — ActivateWorkspaceSheet.body has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, boolean chains 5, 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 · WorkspaceShareAgentSheet.body (cognitive 19) · ×1
  • WorkspaceShareAgentSheet.body (cognitive 19) Packages/OsaurusCore/Views/Workspaces/WorkspaceSheets.swift:968 — WorkspaceShareAgentSheet.body has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6, 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.
D2 · Cognitive Complexity · EmailMIME.parameters (cognitive 19) · ×1
  • EmailMIME.parameters (cognitive 19) Packages/OsaurusCore/Services/Event/Email/EmailMIME.swift:122 — EmailMIME.parameters has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3, 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 · MCPOAuthDiscovery.fetchProtectedResourceMetadata (cognitive 19) · ×1
  • MCPOAuthDiscovery.fetchProtectedResourceMetadata (cognitive 19) Packages/OsaurusCore/Services/MCP/OAuth/MCPOAuthDiscovery.swift:225 — MCPOAuthDiscovery.fetchProtectedResourceMetadata has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 3 (6 pts), 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 · WorkflowDetailPage.hero (cognitive 19) · ×1
  • WorkflowDetailPage.hero (cognitive 19) Packages/OsaurusCore/Views/Workflow/Library/WorkflowDetailPage.swift:112 — WorkflowDetailPage.hero has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 9 (12 pts), if/else 3 (4 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 · EvalBootstrap.seedHostSnapshots (cognitive 18) · ×1
  • EvalBootstrap.seedHostSnapshots (cognitive 18) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalBootstrap.swift:280 — EvalBootstrap.seedHostSnapshots has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 2 (4 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 · EvalMatrix.formatConsole (cognitive 18) · ×1
  • EvalMatrix.formatConsole (cognitive 18) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalMatrix.swift:609 — EvalMatrix.formatConsole has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EvalReport.formatAggregatedTelemetry (cognitive 18) · ×1
  • EvalReport.formatAggregatedTelemetry (cognitive 18) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReport.swift:970 — EvalReport.formatAggregatedTelemetry has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11, boolean chains 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 · EvalRunner.run (cognitive 18) · ×1
  • EvalRunner.run (cognitive 18) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:48 — EvalRunner.run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EvalScoreboardBuilder.suiteScoreboard (cognitive 18) · ×1
  • EvalScoreboardBuilder.suiteScoreboard (cognitive 18) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalScoreboard.swift:669 — EvalScoreboardBuilder.suiteScoreboard has cognitive complexity 18 (threshold 15). Drivers by points: loops 7 (14 pts), if/else 3 (4 pts) (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · InspectorAttachmentConfigurations.body (cognitive 18) · ×1
  • InspectorAttachmentConfigurations.body (cognitive 18) Packages/OsaurusCore/DevelopmentDesign/InspectorMessagingParts.swift:10 — InspectorAttachmentConfigurations.body has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 3, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileEditTool.parseRequestedEdits (cognitive 18) · ×1
  • FileEditTool.parseRequestedEdits (cognitive 18) Packages/OsaurusCore/Folder/FolderTools.swift:4156 — FileEditTool.parseRequestedEdits has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 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 · FileSearchTool.collectFileMatches (cognitive 18) · ×1
  • FileSearchTool.collectFileMatches (cognitive 18) Packages/OsaurusCore/Folder/FolderTools.swift:5182 — FileSearchTool.collectFileMatches has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 2 (3 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 · Keccak256.keccakF1600 (cognitive 18) · ×1
  • Keccak256.keccakF1600 (cognitive 18) Packages/OsaurusCore/Identity/CryptoHelpers.swift:91 — Keccak256.keccakF1600 has cognitive complexity 18 (threshold 15). Drivers by points: loops 8 (18 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 · AgentManager.migrateClaudeCodeModelsToHarness (cognitive 18) · ×1
  • AgentManager.migrateClaudeCodeModelsToHarness (cognitive 18) Packages/OsaurusCore/Managers/AgentManager+Harness.swift:76 — AgentManager.migrateClaudeCodeModelsToHarness has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 2, loops 1, ternaries 1 (nesting depth added 4). Of this number, 15 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAICompatibleTTSClient.decodeCompressedAudio (cognitive 18) · ×1
  • OpenAICompatibleTTSClient.decodeCompressedAudio (cognitive 18) Packages/OsaurusCore/Managers/OpenAICompatibleTTSClient.swift:164 — OpenAICompatibleTTSClient.decodeCompressedAudio has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, error handling 2, 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 · RemoteProviderManager.refetchModels (cognitive 18) · ×1
  • RemoteProviderManager.refetchModels (cognitive 18) Packages/OsaurusCore/Managers/RemoteProviderManager.swift:1134 — RemoteProviderManager.refetchModels has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5, error handling 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 · RemoteProviderManager.extractErrorMessage (cognitive 18) · ×1
  • RemoteProviderManager.extractErrorMessage (cognitive 18) Packages/OsaurusCore/Managers/RemoteProviderManager.swift:1914 — RemoteProviderManager.extractErrorMessage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 9). 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 · SkillManager.loadReferenceContents (cognitive 18) · ×1
  • SkillManager.loadReferenceContents (cognitive 18) Packages/OsaurusCore/Managers/SkillManager.swift:962 — SkillManager.loadReferenceContents has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 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 · HTTPHandler.handleUpdateAgentToolEndpoint (cognitive 18) · ×1
  • HTTPHandler.handleUpdateAgentToolEndpoint (cognitive 18) Packages/OsaurusCore/Networking/HTTPHandler.swift:6471 — HTTPHandler.handleUpdateAgentToolEndpoint has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 4, error handling 1 (2 pts) (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 · HTTPHandler.handleWorkspaceAgentRunEndpoint (cognitive 18) · ×1
  • HTTPHandler.handleWorkspaceAgentRunEndpoint (cognitive 18) Packages/OsaurusCore/Networking/HTTPHandler.swift:6588 — HTTPHandler.handleWorkspaceAgentRunEndpoint has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, loops 1 (2 pts), error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · HTTPHandler.handleListAgents (cognitive 18) · ×1
  • HTTPHandler.handleListAgents (cognitive 18) Packages/OsaurusCore/Networking/HTTPHandler.swift:10158 — HTTPHandler.handleListAgents has cognitive complexity 18 (threshold 15). Drivers by points: loops 2 (6 pts), if/else 3 (5 pts), ternaries 4, boolean chains 3 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · HTTPHandler.handleRemoteImageGeneration (cognitive 18) · ×1
  • HTTPHandler.handleRemoteImageGeneration (cognitive 18) Packages/OsaurusCore/Networking/HTTPHandler.swift:13812 — HTTPHandler.handleRemoteImageGeneration has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 3 (5 pts), ternaries 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 · ServerController.startServer (cognitive 18) · ×1
  • ServerController.startServer (cognitive 18) Packages/OsaurusCore/Networking/ServerController.swift:183 — ServerController.startServer has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (5 pts), error handling 2 (4 pts), ternaries 2 (4 pts), loops 1 (2 pts), match/switch 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 · DirectDownloader.urlSession (cognitive 18) · ×1
  • DirectDownloader.urlSession (cognitive 18) Packages/OsaurusCore/Services/ModelDownloadService.swift:2120 — DirectDownloader.urlSession has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3, 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 · ModelRuntime.prepareContainer (cognitive 18) · ×1
  • ModelRuntime.prepareContainer (cognitive 18) Packages/OsaurusCore/Services/ModelRuntime.swift:4782 — ModelRuntime.prepareContainer has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 2, loops 1 (2 pts), 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 · ActivityLogStore.whereClause (cognitive 18) · ×1
  • ActivityLogStore.whereClause (cognitive 18) Packages/OsaurusCore/Storage/ActivityLogStore.swift:1007 — ActivityLogStore.whereClause has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, ternaries 2 (3 pts), 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 · TaskQuery.matches (cognitive 18) · ×1
  • TaskQuery.matches (cognitive 18) Packages/OsaurusCore/Storage/TaskDatabase.swift:70 — TaskQuery.matches has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 9. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AppleScriptWarmResidencyHandoff.around (cognitive 18) · ×1
  • AppleScriptWarmResidencyHandoff.around (cognitive 18) Packages/OsaurusCore/Subagent/AppleScriptWarmResidency.swift:219 — AppleScriptWarmResidencyHandoff.around has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (5 pts), error handling 2 (3 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 · SubagentAdmission.admit (cognitive 18) · ×1
  • SubagentAdmission.admit (cognitive 18) Packages/OsaurusCore/Subagent/SubagentAdmission.swift:102 — SubagentAdmission.admit has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 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 · ToolRegistry.normalizeToolResult (cognitive 18) · ×1
  • ToolRegistry.normalizeToolResult (cognitive 18) Packages/OsaurusCore/Tools/ToolRegistry.swift:1998 — ToolRegistry.normalizeToolResult has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, boolean chains 6, ternaries 2 (3 pts), 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 · LogFileTailer.start (cognitive 18) · ×1
  • LogFileTailer.start (cognitive 18) Packages/OsaurusCore/Utils/LogFileTailer.swift:56 — LogFileTailer.start has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CalendarCreateEventTool.run (cognitive 18) · ×1
  • CalendarCreateEventTool.run (cognitive 18) Packages/OsaurusCore/AppleApps/Calendar/CalendarTools.swift:210 — CalendarCreateEventTool.run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 3 (8 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 · ScreenContextDistiller.sampleContents (cognitive 18) · ×1
  • ScreenContextDistiller.sampleContents (cognitive 18) Packages/OsaurusCore/ComputerUse/Perception/ScreenContextDistiller.swift:445 — ScreenContextDistiller.sampleContents has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 5, loops 2, 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 · ConfigApplier.applyApp (cognitive 18) · ×1
  • ConfigApplier.applyApp (cognitive 18) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:517 — ConfigApplier.applyApp has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 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 · ConfigPlanner.planSearchProviders (cognitive 18) · ×1
  • ConfigPlanner.planSearchProviders (cognitive 18) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:2422 — ConfigPlanner.planSearchProviders has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SandboxPluginManager.install (cognitive 18) · ×1
  • SandboxPluginManager.install (cognitive 18) Packages/OsaurusCore/Managers/Plugin/SandboxPluginManager.swift:39 — SandboxPluginManager.install has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2 (3 pts), loops 1 (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 · DispatchEnvelope.parseWatcher (cognitive 18) · ×1
  • DispatchEnvelope.parseWatcher (cognitive 18) Packages/OsaurusCore/Models/Chat/DispatchEnvelope.swift:324 — DispatchEnvelope.parseWatcher has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · FileDiff.partialDelimitedRawValue (cognitive 18) · ×1
  • FileDiff.partialDelimitedRawValue (cognitive 18) Packages/OsaurusCore/Models/Chat/FileDiff.swift:367 — FileDiff.partialDelimitedRawValue has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ServerRuntimeSettingsStore.resolvedMemorySafetyPlan (cognitive 18) · ×1
  • ServerRuntimeSettingsStore.resolvedMemorySafetyPlan (cognitive 18) Packages/OsaurusCore/Models/Configuration/ServerRuntimeSettingsStore.swift:364 — ServerRuntimeSettingsStore.resolvedMemorySafetyPlan has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (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 · ActivityFilterToken.tokens (cognitive 18) · ×1
  • ActivityFilterToken.tokens (cognitive 18) Packages/OsaurusCore/Models/Insights/InsightsScope.swift:119 — ActivityFilterToken.tokens has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, ternaries 1 (2 pts), boolean chains 1, 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 · WorkflowCondition.compare (cognitive 18) · ×1
  • WorkflowCondition.compare (cognitive 18) Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:1950 — WorkflowCondition.compare has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (12 pts), boolean chains 3, if/else 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 · WorkflowRequirementsDeriver.derive · ×1
  • WorkflowRequirementsDeriver.derive::visit (cognitive 18) Packages/OsaurusCore/Models/Workflow/WorkflowRequirementsDeriver.swift:40 — WorkflowRequirementsDeriver.derive::visit has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 4 (8 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 · AgentChannelAutoDestinationResolver.derivedBindings (cognitive 18) · ×1
  • AgentChannelAutoDestinationResolver.derivedBindings (cognitive 18) Packages/OsaurusCore/Services/AgentChannel/AgentChannelAutoDestinationResolver.swift:85 — AgentChannelAutoDestinationResolver.derivedBindings has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentChannelCustomJSONRunner.mapResult (cognitive 18) · ×1
  • AgentChannelCustomJSONRunner.mapResult (cognitive 18) Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:989 — AgentChannelCustomJSONRunner.mapResult has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 3 (6 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 · ChannelAgentRoster.presenceDetail (cognitive 18) · ×1
  • ChannelAgentRoster.presenceDetail (cognitive 18) Packages/OsaurusCore/Services/AgentChannel/ChannelAgentRoster.swift:347 — ChannelAgentRoster.presenceDetail has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PairedDeviceChannel.wire (cognitive 18) · ×1
  • PairedDeviceChannel.wire (cognitive 18) Packages/OsaurusCore/Services/Attention/NotificationChannels.swift:116 — PairedDeviceChannel.wire has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 4, 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 · OwnerDeviceAccessHost.redeem (cognitive 18) · ×1
  • OwnerDeviceAccessHost.redeem (cognitive 18) Packages/OsaurusCore/Services/Auth/OwnerDeviceAccessHost.swift:380 — OwnerDeviceAccessHost.redeem has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 6, ternaries 2, error handling 1, loops 1. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentLoopModelStep.classifyTerminal (cognitive 18) · ×1
  • AgentLoopModelStep.classifyTerminal (cognitive 18) Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:207 — AgentLoopModelStep.classifyTerminal 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 · ChatTitleService.sanitize (cognitive 18) · ×1
  • ChatTitleService.sanitize (cognitive 18) Packages/OsaurusCore/Services/Chat/ChatTitleService.swift:125 — ChatTitleService.sanitize has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 3 (6 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SystemPromptComposer.deriveEnabledManifest (cognitive 18) · ×1
  • SystemPromptComposer.deriveEnabledManifest (cognitive 18) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:1878 — SystemPromptComposer.deriveEnabledManifest has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6, 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 · ToolResultMediaBridge.mime (cognitive 18) · ×1
  • ToolResultMediaBridge.mime (cognitive 18) Packages/OsaurusCore/Services/Chat/ToolResultMediaBridge.swift:211 — ToolResultMediaBridge.mime has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 13, 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 · ChatImportSourceResolver.resolvePage (cognitive 18) · ×1
  • ChatImportSourceResolver.resolvePage (cognitive 18) Packages/OsaurusCore/Services/ChatImport/ChatImportSourceResolver.swift:116 — ChatImportSourceResolver.resolvePage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, 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 · SubagentAdmissionEvaluator.run (cognitive 18) · ×1
  • SubagentAdmissionEvaluator.run (cognitive 18) Packages/OsaurusCore/Services/Context/SubagentAdmissionEvaluator.swift:63 — SubagentAdmissionEvaluator.run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (4 pts), boolean chains 3, 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 · SubagentJobEvaluator.waveEnvelope (cognitive 18) · ×1
  • SubagentJobEvaluator.waveEnvelope (cognitive 18) Packages/OsaurusCore/Services/Context/SubagentJobEvaluator.swift:532 — SubagentJobEvaluator.waveEnvelope has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 4, 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, 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 · CredentialStore.rename (cognitive 18) · ×1
  • CredentialStore.rename (cognitive 18) Packages/OsaurusCore/Services/Credentials/CredentialStore.swift:516 — CredentialStore.rename has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 5 (7 pts), ternaries 2 (3 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 · DiscordConnectionService.diagnostics (cognitive 18) · ×1
  • DiscordConnectionService.diagnostics (cognitive 18) Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:541 — DiscordConnectionService.diagnostics has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), error handling 2 (3 pts), loops 2 (3 pts), boolean chains 2 (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 · PDFEditor.closestField (cognitive 18) · ×1
  • PDFEditor.closestField (cognitive 18) Packages/OsaurusCore/Services/Documents/PDFEditor.swift:300 — PDFEditor.closestField has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PDFEditor.highlight (cognitive 18) · ×1
  • PDFEditor.highlight (cognitive 18) Packages/OsaurusCore/Services/Documents/PDFEditor.swift:552 — PDFEditor.highlight has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (6 pts), boolean chains 2, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PDFTableDetector.cells (cognitive 18) · ×1
  • PDFTableDetector.cells (cognitive 18) Packages/OsaurusCore/Services/Documents/PDFTableDetector.swift:145 — PDFTableDetector.cells has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, 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 · OpenXMLTextRunCollector.parser (cognitive 18) · ×1
  • OpenXMLTextRunCollector.parser (cognitive 18) Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift:1201 — OpenXMLTextRunCollector.parser has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · WorkbookWorkflowValidator.parseCellReference (cognitive 18) · ×1
  • WorkbookWorkflowValidator.parseCellReference (cognitive 18) Packages/OsaurusCore/Services/Documents/WorkbookWorkflowService.swift:588 — WorkbookWorkflowValidator.parseCellReference has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7, 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 · XLSXAdapter.renderWorkbook (cognitive 18) · ×1
  • XLSXAdapter.renderWorkbook (cognitive 18) Packages/OsaurusCore/Services/Documents/XLSXAdapter.swift:253 — XLSXAdapter.renderWorkbook has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 3 (6 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 · XLSXEmitter.parseCellReference (cognitive 18) · ×1
  • XLSXEmitter.parseCellReference (cognitive 18) Packages/OsaurusCore/Services/Documents/XLSXEmitter.swift:325 — XLSXEmitter.parseCellReference has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7, 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 · EventManager.task (cognitive 18) · ×1
  • EventManager.task (cognitive 18) Packages/OsaurusCore/Services/Event/EventManager.swift:1015 — EventManager.task has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (13 pts), if/else 3, boolean chains 1, 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 · EventMatcher.filterRejection (cognitive 18) · ×1
  • EventMatcher.filterRejection (cognitive 18) Packages/OsaurusCore/Services/Event/EventMatcher.swift:118 — EventMatcher.filterRejection has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6, 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 · WebhookVerification.verify (cognitive 18) · ×1
  • WebhookVerification.verify (cognitive 18) Packages/OsaurusCore/Services/Event/WebhookProviderProfile.swift:372 — WebhookVerification.verify has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (8 pts), match/switch 1 (nesting depth added 4). 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 · ClaudeCodeHarnessCodec.decode (cognitive 18) · ×1
  • ClaudeCodeHarnessCodec.decode (cognitive 18) Packages/OsaurusCore/Services/Harness/ClaudeCodeHarnessAdapter.swift:254 — ClaudeCodeHarnessCodec.decode has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 1 (2 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 · IMessageRuntimeAssets.verifyExecutableCandidates (cognitive 18) · ×1
  • IMessageRuntimeAssets.verifyExecutableCandidates (cognitive 18) Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift:266 — IMessageRuntimeAssets.verifyExecutableCandidates has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 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 · AgentDescriptionBackfill.run (cognitive 18) · ×1
  • AgentDescriptionBackfill.run (cognitive 18) Packages/OsaurusCore/Services/Inference/AgentDescriptionBackfill.swift:114 — AgentDescriptionBackfill.run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 5, error handling 3, match/switch 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ImageHTTPParameterBuilder.edit (cognitive 18) · ×1
  • ImageHTTPParameterBuilder.edit (cognitive 18) Packages/OsaurusCore/Services/ModelRuntime/ImageHTTPParameterBuilder.swift:86 — ImageHTTPParameterBuilder.edit has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 6, ternaries 2 (4 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 · OnboardingFirstRun.runEnded (cognitive 18) · ×1
  • OnboardingFirstRun.runEnded (cognitive 18) Packages/OsaurusCore/Services/Onboarding/OnboardingFirstRun.swift:689 — OnboardingFirstRun.runEnded has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 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 · TeamSeeder.create (cognitive 18) · ×1
  • TeamSeeder.create (cognitive 18) Packages/OsaurusCore/Services/Onboarding/TeamSeeder.swift:114 — TeamSeeder.create has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, 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 · PluginProcessHostCallbacks.handle (cognitive 18) · ×1
  • PluginProcessHostCallbacks.handle (cognitive 18) Packages/OsaurusCore/Services/Plugin/PluginProcessHost.swift:404 — PluginProcessHostCallbacks.handle has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 1, match/switch 1 (nesting depth added 6). 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 · ProviderNetworkDiagnostics.remoteModelDiscoveryRow (cognitive 18) · ×1
  • ProviderNetworkDiagnostics.remoteModelDiscoveryRow (cognitive 18) Packages/OsaurusCore/Services/Provider/ProviderNetworkDiagnostics.swift:319 — ProviderNetworkDiagnostics.remoteModelDiscoveryRow has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 2 (3 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RemoteProviderService.makeChunkStream (cognitive 18) · ×1
  • RemoteProviderService.makeChunkStream (cognitive 18) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:1054 — RemoteProviderService.makeChunkStream has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 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 · RemoteToolDetection.matchJSONObjectEnd (cognitive 18) · ×1
  • RemoteToolDetection.matchJSONObjectEnd (cognitive 18) Packages/OsaurusCore/Services/Provider/RemoteToolDetection.swift:84 — RemoteToolDetection.matchJSONObjectEnd has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (17 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 · WorkspaceAgentConnectService.refresh (cognitive 18) · ×1
  • WorkspaceAgentConnectService.refresh (cognitive 18) Packages/OsaurusCore/Services/Router/WorkspaceAgentConnectService.swift:354 — WorkspaceAgentConnectService.refresh has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 1, 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 · SearchEngine.run (cognitive 18) · ×1
  • SearchEngine.run (cognitive 18) Packages/OsaurusCore/Services/Search/SearchEngine.swift:102 — SearchEngine.run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 4, loops 2, match/switch 1 (2 pts) (nesting depth added 6). Of this number, 14 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 · MCPJSONParser.parse (cognitive 18) · ×1
  • MCPJSONParser.parse (cognitive 18) Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:1761 — MCPJSONParser.parse has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, ternaries 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TaskScheduler.pump (cognitive 18) · ×1
  • TaskScheduler.pump (cognitive 18) Packages/OsaurusCore/Services/Task/TaskScheduler.swift:319 — TaskScheduler.pump has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (3 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 · TemplateCascadePlan.make (cognitive 18) · ×1
  • TemplateCascadePlan.make (cognitive 18) Packages/OsaurusCore/Services/Template/TemplateCascadePlan.swift:107 — TemplateCascadePlan.make has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, boolean chains 6, ternaries 2 (4 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · WorkflowsRegistryAPIClient.registryTemplate (cognitive 18) · ×1
  • WorkflowsRegistryAPIClient.registryTemplate (cognitive 18) Packages/OsaurusCore/Services/Template/WorkflowsRegistryAPIClient.swift:710 — WorkflowsRegistryAPIClient.registryTemplate has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 16, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · WhatsAppConnectionService.runWatchSession (cognitive 18) · ×1
  • WhatsAppConnectionService.runWatchSession (cognitive 18) Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:985 — WhatsAppConnectionService.runWatchSession has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), 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 · WhatsAppRuntimeAssets.verifyExecutableCandidates (cognitive 18) · ×1
  • WhatsAppRuntimeAssets.verifyExecutableCandidates (cognitive 18) Packages/OsaurusCore/Services/WhatsApp/WhatsAppRuntimeAssets.swift:161 — WhatsAppRuntimeAssets.verifyExecutableCandidates has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentNodeExecutor.resolve (cognitive 18) · ×1
  • AgentNodeExecutor.resolve (cognitive 18) Packages/OsaurusCore/Services/Workflow/AgentNodeExecutor.swift:83 — AgentNodeExecutor.resolve has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, 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 · CodeNodeExecutor.run (cognitive 18) · ×1
  • CodeNodeExecutor.run (cognitive 18) Packages/OsaurusCore/Services/Workflow/CodeNodeExecutor.swift:269 — CodeNodeExecutor.run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 1, error handling 1, loops 1, 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 · WorkflowDraftTester.reusePlan (cognitive 18) · ×1
  • WorkflowDraftTester.reusePlan (cognitive 18) Packages/OsaurusCore/Services/Workflow/WorkflowDraftTester.swift:74 — WorkflowDraftTester.reusePlan has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7, 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 · ImageSubagentKind.localPermission (cognitive 18) · ×1
  • ImageSubagentKind.localPermission (cognitive 18) Packages/OsaurusCore/Subagent/Kinds/ImageSubagentKind.swift:274 — ImageSubagentKind.localPermission has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 4 (7 pts), if/else 3 (6 pts), ternaries 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DBExecuteTool.execute (cognitive 18) · ×1
  • DBExecuteTool.execute (cognitive 18) Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:1079 — DBExecuteTool.execute has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 2, match/switch 1 (2 pts), ternaries 1 (2 pts), 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 · WorkflowTestTool.runFromNode (cognitive 18) · ×1
  • WorkflowTestTool.runFromNode (cognitive 18) Packages/OsaurusCore/Tools/Workflow/ArchitectTools.swift:677 — WorkflowTestTool.runFromNode has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), match/switch 3 (4 pts), ternaries 1 (2 pts), boolean chains 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 · ComputerUseConfirmOverlay.confirmCard (cognitive 18) · ×1
  • ComputerUseConfirmOverlay.confirmCard (cognitive 18) Packages/OsaurusCore/Views/Chat/ComputerUseConfirmOverlay.swift:86 — ComputerUseConfirmOverlay.confirmCard has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, boolean chains 6, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ChangeSetRow.header (cognitive 18) · ×1
  • ChangeSetRow.header (cognitive 18) Packages/OsaurusCore/Views/Chat/FileChangesPanel.swift:660 — ChangeSetRow.header has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9 (13 pts), boolean chains 3, if/else 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 · FloatingInputCard.textInputArea (cognitive 18) · ×1
  • FloatingInputCard.textInputArea (cognitive 18) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:6069 — FloatingInputCard.textInputArea has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, if/else 4 (5 pts), ternaries 2 (3 pts), error handling 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 · CredentialEditorSheet.body (cognitive 18) · ×1
  • CredentialEditorSheet.body (cognitive 18) Packages/OsaurusCore/Views/Credentials/CredentialEditorSheet.swift:126 — CredentialEditorSheet.body has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8 (9 pts), if/else 5, 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 · ChatPickerRow.body (cognitive 18) · ×1
  • ChatPickerRow.body (cognitive 18) Packages/OsaurusCore/Views/Model/ChatModelPickerCard.swift:831 — ChatPickerRow.body has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 5, ternaries 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 · ChannelOverviewRow.routes (cognitive 18) · ×1
  • ChannelOverviewRow.routes (cognitive 18) Packages/OsaurusCore/Views/Settings/ChannelsOverviewTable.swift:432 — ChannelOverviewRow.routes has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 2 (4 pts), boolean chains 2, 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 · N8nSettingsView.body (cognitive 18) · ×1
  • N8nSettingsView.body (cognitive 18) Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:78 — N8nSettingsView.body has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, boolean chains 4, 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 · PublishedWorkflowDashboard.versions (cognitive 18) · ×1
  • PublishedWorkflowDashboard.versions (cognitive 18) Packages/OsaurusCore/Views/Template/PublishedWorkflowDashboard.swift:412 — PublishedWorkflowDashboard.versions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 3 (6 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 · WorkflowFormFields.inputValue (cognitive 18) · ×1
  • WorkflowFormFields.inputValue (cognitive 18) Packages/OsaurusCore/Views/Workflow/WorkflowFormView.swift:54 — WorkflowFormFields.inputValue has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 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 · CatalogComponentSpec.defaults (cognitive 18) · ×1
  • CatalogComponentSpec.defaults (cognitive 18) Packages/OsaurusCore/Models/Theme/DesignLibrary/DesignLibraryDefaults.swift:53 — CatalogComponentSpec.defaults has cognitive complexity 18 (threshold 15). Drivers by points: if/else 18. 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 · WorkflowSetupWizardView.commit (cognitive 18) · ×1
  • WorkflowSetupWizardView.commit (cognitive 18) Packages/OsaurusCore/Views/Workflow/Library/WorkflowSetupWizardView.swift:443 — WorkflowSetupWizardView.commit has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, ternaries 1 (2 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · main.swift.top-level code (cognitive 18) · ×1
  • main.swift.top-level code (cognitive 18) Packages/OsaurusCore/JSHost/main.swift:30 — main.swift.top-level code has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, boolean chains 6, match/switch 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 · main.swift.handleRequest (cognitive 18) · ×1
  • main.swift.handleRequest (cognitive 18) Packages/OsaurusCore/PluginHost/main.swift:473 — main.swift.handleRequest has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2 (4 pts), boolean chains 2, 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 · MarkdownMessageView.swift.groupBlocksIntoSegments · ×1
  • MarkdownMessageView.swift.groupBlocksIntoSegments::emitBlock (cognitive 18) Packages/OsaurusCore/Views/Chat/MarkdownMessageView.swift:320 — MarkdownMessageView.swift.groupBlocksIntoSegments::emitBlock has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (9 pts), loops 2 (5 pts), if/else 2 (3 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 · Accessibility.swift.focusedViewport (cognitive 18) · ×1
  • Accessibility.swift.focusedViewport (cognitive 18) Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:1217 — Accessibility.swift.focusedViewport has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 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 · bridge.handleLoginEvent (cognitive 18) · ×1
  • bridge.handleLoginEvent (cognitive 18) helpers/osaurus-wa/bridge.go:350 — bridge.handleLoginEvent has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 1 (nesting depth added 8). Of this number, 14 points are the body's own statements and 4 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 · CoordCommand.runLock (cognitive 17) · ×1
  • CoordCommand.runLock (cognitive 17) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Coord/CoordCommand.swift:115 — CoordCommand.runLock has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 3 (5 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 · ToolsDev.runLegacyWatchMode (cognitive 17) · ×1
  • ToolsDev.runLegacyWatchMode (cognitive 17) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsDev.swift:162 — ToolsDev.runLegacyWatchMode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 3). Of this number, 11 points are the body's own statements and 6 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 · ToolsDoctor.execute (cognitive 17) · ×1
  • ToolsDoctor.execute (cognitive 17) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsDoctor.swift:47 — ToolsDoctor.execute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (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 · ToolsInstall.validateBundledManifestIfPresent (cognitive 17) · ×1
  • ToolsInstall.validateBundledManifestIfPresent (cognitive 17) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsInstall.swift:336 — ToolsInstall.validateBundledManifestIfPresent has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 1 (2 pts), boolean chains 1, 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 · EvalRunner.scoreToolUsageAudit (cognitive 17) · ×1
  • EvalRunner.scoreToolUsageAudit (cognitive 17) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerAgentLoop.swift:1562 — EvalRunner.scoreToolUsageAudit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EvalRunner.runArchitectInlineCase (cognitive 17) · ×1
  • EvalRunner.runArchitectInlineCase (cognitive 17) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerArchitectInline.swift:18 — EvalRunner.runArchitectInlineCase has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 3, ternaries 3, loops 1 (2 pts) (nesting depth added 2). 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, 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 · EvalRunner.runMemoryCase (cognitive 17) · ×1
  • EvalRunner.runMemoryCase (cognitive 17) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerMemory.swift:24 — EvalRunner.runMemoryCase has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, loops 3 (5 pts), ternaries 2, boolean chains 1, error handling 1 (nesting depth added 2). Of this number, 15 points are the body's own statements and 2 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 · CatalogLibraryToggle.body (cognitive 17) · ×1
  • CatalogLibraryToggle.body (cognitive 17) Packages/OsaurusCore/DevelopmentDesign/CatalogComponents.swift:794 — CatalogLibraryToggle.body has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 8 (14 pts), if/else 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 · FileEditMatcher.apply (cognitive 17) · ×1
  • FileEditMatcher.apply (cognitive 17) Packages/OsaurusCore/Folder/FileEditMatcher.swift:80 — FileEditMatcher.apply has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3 (5 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 · FileReadImageSupport.load (cognitive 17) · ×1
  • FileReadImageSupport.load (cognitive 17) Packages/OsaurusCore/Folder/FileReadImageSupport.swift:54 — FileReadImageSupport.load 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 · MCPProviderManager.handleCredentialsChanged (cognitive 17) · ×1
  • MCPProviderManager.handleCredentialsChanged (cognitive 17) Packages/OsaurusCore/Managers/MCPProviderManager.swift:1108 — MCPProviderManager.handleCredentialsChanged has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, 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 · SkillImportPolicy.scanExtractedTree (cognitive 17) · ×1
  • SkillImportPolicy.scanExtractedTree (cognitive 17) Packages/OsaurusCore/Managers/SkillImportPolicy.swift:63 — SkillImportPolicy.scanExtractedTree 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 · HTTPHandler.jsonNestingDepthExceedsBudget (cognitive 17) · ×1
  • HTTPHandler.jsonNestingDepthExceedsBudget (cognitive 17) Packages/OsaurusCore/Networking/HTTPRequestParse.swift:54 — HTTPHandler.jsonNestingDepthExceedsBudget has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 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 · LocalReasoningCapability.undefinedKwargFallbackBranch (cognitive 17) · ×1
  • LocalReasoningCapability.undefinedKwargFallbackBranch (cognitive 17) Packages/OsaurusCore/Services/LocalReasoningCapability.swift:363 — LocalReasoningCapability.undefinedKwargFallbackBranch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelDownloadService.delete (cognitive 17) · ×1
  • ModelDownloadService.delete (cognitive 17) Packages/OsaurusCore/Services/ModelDownloadService.swift:1104 — ModelDownloadService.delete has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelDownloadService.updateDownloadProgress (cognitive 17) · ×1
  • ModelDownloadService.updateDownloadProgress (cognitive 17) Packages/OsaurusCore/Services/ModelDownloadService.swift:1502 — ModelDownloadService.updateDownloadProgress has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · ModelSSDResidency.localTableBytes (cognitive 17) · ×1
  • ModelSSDResidency.localTableBytes (cognitive 17) Packages/OsaurusCore/Services/ModelSSDResidency.swift:41 — ModelSSDResidency.localTableBytes has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 6, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentChannelMessageStore.recordReceiveEvent (cognitive 17) · ×1
  • AgentChannelMessageStore.recordReceiveEvent (cognitive 17) Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:780 — AgentChannelMessageStore.recordReceiveEvent has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 1 (2 pts), boolean chains 1, 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 · AgentDatabase.bulkWrite (cognitive 17) · ×1
  • AgentDatabase.bulkWrite (cognitive 17) Packages/OsaurusCore/Storage/AgentDatabase.swift:1422 — AgentDatabase.bulkWrite has cognitive complexity 17 (threshold 15). Drivers by points: loops 6 (11 pts), if/else 4 (6 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 · AttachmentBlobStore.spillOne (cognitive 17) · ×1
  • AttachmentBlobStore.spillOne (cognitive 17) Packages/OsaurusCore/Storage/AttachmentBlobStore.swift:130 — AttachmentBlobStore.spillOne has cognitive complexity 17 (threshold 15). Drivers by points: error handling 4 (8 pts), if/else 4 (8 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · SubagentSession.prepare (cognitive 17) · ×1
  • SubagentSession.prepare (cognitive 17) Packages/OsaurusCore/Subagent/SubagentSession.swift:348 — SubagentSession.prepare has cognitive complexity 17 (threshold 15). Drivers by points: error handling 5, if/else 5, boolean chains 4, ternaries 2, match/switch 1. Of this number, 15 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 · SandboxSearchFilesTool.execute (cognitive 17) · ×1
  • SandboxSearchFilesTool.execute (cognitive 17) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1907 — SandboxSearchFilesTool.execute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 3 (5 pts), boolean chains 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SandboxWriteFileTool.writeWhole (cognitive 17) · ×1
  • SandboxWriteFileTool.writeWhole (cognitive 17) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2290 — SandboxWriteFileTool.writeWhole has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 3 (6 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 · SandboxProcessTool.execute (cognitive 17) · ×1
  • SandboxProcessTool.execute (cognitive 17) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3209 — SandboxProcessTool.execute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 2 (4 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 · ToolWirePropertyOrder.write (cognitive 17) · ×1
  • ToolWirePropertyOrder.write (cognitive 17) Packages/OsaurusCore/Tools/ToolWirePropertyOrder.swift:154 — ToolWirePropertyOrder.write has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (6 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 · CalendarUpdateEventTool.run (cognitive 17) · ×1
  • CalendarUpdateEventTool.run (cognitive 17) Packages/OsaurusCore/AppleApps/Calendar/CalendarTools.swift:297 — CalendarUpdateEventTool.run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, ternaries 2 (4 pts), boolean chains 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 · NativeMacDriver.coordinate (cognitive 17) · ×1
  • NativeMacDriver.coordinate (cognitive 17) Packages/OsaurusCore/ComputerUse/Driver/NativeMacDriver.swift:267 — NativeMacDriver.coordinate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (6 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 · ScreenContextDistiller.statusToken (cognitive 17) · ×1
  • ScreenContextDistiller.statusToken (cognitive 17) Packages/OsaurusCore/ComputerUse/Perception/ScreenContextDistiller.swift:797 — ScreenContextDistiller.statusToken has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, 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 · ConfigApplier.addProvider (cognitive 17) · ×1
  • ConfigApplier.addProvider (cognitive 17) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:2315 — ConfigApplier.addProvider has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), match/switch 3 (4 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigChannelPosting.apply (cognitive 17) · ×1
  • ConfigChannelPosting.apply (cognitive 17) Packages/OsaurusCore/Configuration/Declarative/ConfigChannelRouting.swift:576 — ConfigChannelPosting.apply has cognitive complexity 17 (threshold 15). Drivers by points: loops 3 (6 pts), error handling 2 (5 pts), if/else 3 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigPlanner.planChannels (cognitive 17) · ×1
  • ConfigPlanner.planChannels (cognitive 17) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:1917 — ConfigPlanner.planChannels has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, 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 · OpenResponsesTool.init (cognitive 17) · ×1
  • OpenResponsesTool.init (cognitive 17) Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:556 — OpenResponsesTool.init has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 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 · AgentChannelN8nEnvelope.parse (cognitive 17) · ×1
  • AgentChannelN8nEnvelope.parse (cognitive 17) Packages/OsaurusCore/Models/AgentChannel/AgentChannelN8nModels.swift:307 — AgentChannelN8nEnvelope.parse has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (14 pts), loops 1 (2 pts), boolean chains 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 · ChannelMessageEnvelope.parse (cognitive 17) · ×1
  • ChannelMessageEnvelope.parse (cognitive 17) Packages/OsaurusCore/Models/Chat/DispatchEnvelope.swift:104 — ChannelMessageEnvelope.parse has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6, 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 · AnthropicSSEResponseWriter.writeCompletedThinkingBlock (cognitive 17) · ×1
  • AnthropicSSEResponseWriter.writeCompletedThinkingBlock (cognitive 17) Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1147 — AnthropicSSEResponseWriter.writeCompletedThinkingBlock has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 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 · IMAPMailboxEncoding.decode (cognitive 17) · ×1
  • IMAPMailboxEncoding.decode (cognitive 17) Packages/OsaurusCore/Models/Event/EmailMessage.swift:79 — IMAPMailboxEncoding.decode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (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 · PrivacyFilterPipeline.scanForLeaks (cognitive 17) · ×1
  • PrivacyFilterPipeline.scanForLeaks (cognitive 17) Packages/OsaurusCore/PrivacyFilter/Core/PrivacyFilterPipeline.swift:840 — PrivacyFilterPipeline.scanForLeaks has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (3 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 · AgentChannelWebhookIngress.handleTaskPoll (cognitive 17) · ×1
  • AgentChannelWebhookIngress.handleTaskPoll (cognitive 17) Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:497 — AgentChannelWebhookIngress.handleTaskPoll has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, boolean chains 5, match/switch 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 · ToolResultMediaBridge.hoistingToolImagesToUserMessages (cognitive 17) · ×1
  • ToolResultMediaBridge.hoistingToolImagesToUserMessages (cognitive 17) Packages/OsaurusCore/Services/Chat/ToolResultMediaBridge.swift:148 — ToolResultMediaBridge.hoistingToolImagesToUserMessages has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2, loops 1 (nesting depth added 5). Of this number, 13 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatImportPreflight.annotate (cognitive 17) · ×1
  • ChatImportPreflight.annotate (cognitive 17) Packages/OsaurusCore/Services/ChatImport/ChatImportPreflight.swift:33 — ChatImportPreflight.annotate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 3, 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 · ChatImportSummary.text (cognitive 17) · ×1
  • ChatImportSummary.text (cognitive 17) Packages/OsaurusCore/Services/ChatImport/ChatImportResults.swift:77 — ChatImportSummary.text has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), loops 4 (5 pts), boolean chains 2, 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 · CapabilityClaimsEvaluator.matchedCloseIndex (cognitive 17) · ×1
  • CapabilityClaimsEvaluator.matchedCloseIndex (cognitive 17) Packages/OsaurusCore/Services/Context/CapabilityClaimsEvaluator.swift:1099 — CapabilityClaimsEvaluator.matchedCloseIndex has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 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 · SignInSessionStore.syncConnections (cognitive 17) · ×1
  • SignInSessionStore.syncConnections (cognitive 17) Packages/OsaurusCore/Services/Credentials/SignInSessionStore.swift:195 — SignInSessionStore.syncConnections has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 1 (3 pts), boolean chains 2, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PDFAdapter.glyphs (cognitive 17) · ×1
  • PDFAdapter.glyphs (cognitive 17) Packages/OsaurusCore/Services/Documents/PDFAdapter.swift:182 — PDFAdapter.glyphs has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 11, 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 · PDFEditor.merge (cognitive 17) · ×1
  • PDFEditor.merge (cognitive 17) Packages/OsaurusCore/Services/Documents/PDFEditor.swift:131 — PDFEditor.merge has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (3 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 · WorkbookWorkflowValidator.validateCell (cognitive 17) · ×1
  • WorkbookWorkflowValidator.validateCell (cognitive 17) Packages/OsaurusCore/Services/Documents/WorkbookWorkflowService.swift:445 — WorkbookWorkflowValidator.validateCell has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WorksheetParser.cellValue (cognitive 17) · ×1
  • WorksheetParser.cellValue (cognitive 17) Packages/OsaurusCore/Services/Documents/XLSXAdapter.swift:830 — WorksheetParser.cellValue has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 3 (7 pts), boolean chains 2, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · EmailChannelService.diagnostics (cognitive 17) · ×1
  • EmailChannelService.diagnostics (cognitive 17) Packages/OsaurusCore/Services/Email/EmailChannelService.swift:170 — EmailChannelService.diagnostics has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2, match/switch 1 (2 pts), ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WebhookVerification.timestamped (cognitive 17) · ×1
  • WebhookVerification.timestamped (cognitive 17) Packages/OsaurusCore/Services/Event/WebhookProviderProfile.swift:418 — WebhookVerification.timestamped has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 4, loops 1 (2 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IMessageConnectionService.diagnostics (cognitive 17) · ×1
  • IMessageConnectionService.diagnostics (cognitive 17) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:310 — IMessageConnectionService.diagnostics has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, boolean chains 4, match/switch 1, 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 · PendingImportProcessor.apply (cognitive 17) · ×1
  • PendingImportProcessor.apply (cognitive 17) Packages/OsaurusCore/Services/Import/PendingImportProcessor.swift:137 — PendingImportProcessor.apply has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (4 pts), error handling 2 (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 · PendingImportProcessor.decideSetting (cognitive 17) · ×1
  • PendingImportProcessor.decideSetting (cognitive 17) Packages/OsaurusCore/Services/Import/PendingImportProcessor.swift:444 — PendingImportProcessor.decideSetting has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, if/else 4, 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 · PendingImportProcessor.announce (cognitive 17) · ×1
  • PendingImportProcessor.announce (cognitive 17) Packages/OsaurusCore/Services/Import/PendingImportProcessor.swift:936 — PendingImportProcessor.announce has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StreamingStatsHint.encode (cognitive 17) · ×1
  • StreamingStatsHint.encode (cognitive 17) Packages/OsaurusCore/Services/Inference/ModelService.swift:617 — StreamingStatsHint.encode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ResponsesGenerationAccumulator.consume (cognitive 17) · ×1
  • ResponsesGenerationAccumulator.consume (cognitive 17) Packages/OsaurusCore/Services/Inference/ResponsesGenerationAccumulator.swift:42 — ResponsesGenerationAccumulator.consume has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ResponsesGenerationResult.openResponsesResponse (cognitive 17) · ×1
  • ResponsesGenerationResult.openResponsesResponse (cognitive 17) Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:1483 — ResponsesGenerationResult.openResponsesResponse has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 4 (6 pts), boolean chains 2, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StructuredOutputCapability.support (cognitive 17) · ×1
  • StructuredOutputCapability.support (cognitive 17) Packages/OsaurusCore/Services/Inference/StructuredOutput.swift:323 — StructuredOutputCapability.support has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (7 pts), if/else 5 (6 pts), 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 · KnowledgeDiff.lines (cognitive 17) · ×1
  • KnowledgeDiff.lines (cognitive 17) Packages/OsaurusCore/Services/Knowledge/KnowledgeDiff.swift:33 — KnowledgeDiff.lines has cognitive complexity 17 (threshold 15). Drivers by points: loops 7 (10 pts), boolean chains 5, if/else 2 (nesting depth added 3). 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 · PhoneAgentEditing.apply (cognitive 17) · ×1
  • PhoneAgentEditing.apply (cognitive 17) Packages/OsaurusCore/Services/MobileConnect/PhoneAgentEditing.swift:175 — PhoneAgentEditing.apply has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 2, 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.
D2 · Cognitive Complexity · Registry.capacitySnapshot (cognitive 17) · ×1
  • Registry.capacitySnapshot (cognitive 17) Packages/OsaurusCore/Services/ModelRuntime/MLXBatchAdapter.swift:612 — Registry.capacitySnapshot has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 2 (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 · OnboardingEvalHarness.preparedReads (cognitive 17) · ×1
  • OnboardingEvalHarness.preparedReads (cognitive 17) Packages/OsaurusCore/Services/Onboarding/OnboardingEvalHarness.swift:424 — OnboardingEvalHarness.preparedReads has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (9 pts), boolean chains 5, 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 · OnboardingPanel.make (cognitive 17) · ×1
  • OnboardingPanel.make (cognitive 17) Packages/OsaurusCore/Services/Onboarding/OnboardingPanel.swift:93 — OnboardingPanel.make has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 2, boolean chains 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 · PluginHostContext.taskStateDict (cognitive 17) · ×1
  • PluginHostContext.taskStateDict (cognitive 17) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:3205 — PluginHostContext.taskStateDict has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, 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 · RemoteProviderService.fetchFireworksCatalogModels (cognitive 17) · ×1
  • RemoteProviderService.fetchFireworksCatalogModels (cognitive 17) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:7705 — RemoteProviderService.fetchFireworksCatalogModels 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 · WorkspaceRosterStore.apply (cognitive 17) · ×1
  • WorkspaceRosterStore.apply (cognitive 17) Packages/OsaurusCore/Services/Router/WorkspaceRosterStore.swift:430 — WorkspaceRosterStore.apply has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 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 · SearchHTML.canonicalURL (cognitive 17) · ×1
  • SearchHTML.canonicalURL (cognitive 17) Packages/OsaurusCore/Services/Search/SearchHTMLHelpers.swift:178 — SearchHTML.canonicalURL has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (5 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 · SearchStructuredDataInspector.collectArrays (cognitive 17) · ×1
  • SearchStructuredDataInspector.collectArrays (cognitive 17) Packages/OsaurusCore/Services/Search/SearchStructuredDataStore.swift:201 — SearchStructuredDataInspector.collectArrays has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 1 (3 pts), loops 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 · DialogNodeExecutor.run (cognitive 17) · ×1
  • DialogNodeExecutor.run (cognitive 17) Packages/OsaurusCore/Services/Workflow/DialogNodeExecutor.swift:50 — DialogNodeExecutor.run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 4, match/switch 1 (2 pts), error handling 1, 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 · OAuth2ConnectionFlow.signIn (cognitive 17) · ×1
  • OAuth2ConnectionFlow.signIn (cognitive 17) Packages/OsaurusCore/Services/Workflow/WorkflowConnections.swift:418 — OAuth2ConnectionFlow.signIn has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7, error handling 6, boolean chains 3, 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 · WorkflowEvalHarness.score (cognitive 17) · ×1
  • WorkflowEvalHarness.score (cognitive 17) Packages/OsaurusCore/Services/Workflow/WorkflowEvalHarness.swift:351 — WorkflowEvalHarness.score has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 5 (6 pts), boolean chains 2, 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 · WorkflowNodeError.isRetryable (cognitive 17) · ×1
  • WorkflowNodeError.isRetryable (cognitive 17) Packages/OsaurusCore/Services/Workflow/WorkflowNodeExecutor.swift:211 — WorkflowNodeError.isRetryable has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, match/switch 3 (6 pts), boolean chains 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 · AgentDraftTool.patch (cognitive 17) · ×1
  • AgentDraftTool.patch (cognitive 17) Packages/OsaurusCore/Tools/Agent/AgentDraftTool.swift:179 — AgentDraftTool.patch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), error handling 3, loops 2 (3 pts), boolean chains 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 · DBCreateTableTool.execute (cognitive 17) · ×1
  • DBCreateTableTool.execute (cognitive 17) Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:321 — DBCreateTableTool.execute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 2 (3 pts), boolean chains 2, 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 · DBExportTool.execute (cognitive 17) · ×1
  • DBExportTool.execute (cognitive 17) Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:1432 — DBExportTool.execute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 1 (3 pts), error handling 1 (2 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ArchitectInlineHandoff.draftAndStart (cognitive 17) · ×1
  • ArchitectInlineHandoff.draftAndStart (cognitive 17) Packages/OsaurusCore/Tools/Handoff/ArchitectInlineHandoff.swift:199 — ArchitectInlineHandoff.draftAndStart has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 3). 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, 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 · WorkflowRunsTool.execute (cognitive 17) · ×1
  • WorkflowRunsTool.execute (cognitive 17) Packages/OsaurusCore/Tools/Workflow/WorkflowRunsTool.swift:78 — WorkflowRunsTool.execute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 5 (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 · AgentDetailView.quickActionRow (cognitive 17) · ×1
  • AgentDetailView.quickActionRow (cognitive 17) Packages/OsaurusCore/Views/Agent/AgentsView.swift:5981 — AgentDetailView.quickActionRow has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 6 (9 pts), if/else 5 (7 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatSessionSidebar.workspaceMemberSection (cognitive 17) · ×1
  • ChatSessionSidebar.workspaceMemberSection (cognitive 17) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:1319 — ChatSessionSidebar.workspaceMemberSection has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 3 (7 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 · ChatSession.stop (cognitive 17) · ×1
  • ChatSession.stop (cognitive 17) Packages/OsaurusCore/Views/Chat/ChatView.swift:3070 — ChatSession.stop has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, 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 · FloatingInputCard.checkForSilenceTimeout (cognitive 17) · ×1
  • FloatingInputCard.checkForSilenceTimeout (cognitive 17) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:1723 — FloatingInputCard.checkForSilenceTimeout has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 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 · NativeArtifactCardView.buildPreview (cognitive 17) · ×1
  • NativeArtifactCardView.buildPreview (cognitive 17) Packages/OsaurusCore/Views/Chat/NativeArtifactCardView.swift:374 — NativeArtifactCardView.buildPreview has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, 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 · NativeMarkdownView.configure (cognitive 17) · ×1
  • NativeMarkdownView.configure (cognitive 17) Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:534 — NativeMarkdownView.configure has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, 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 · StreamingMarkdownBalancer.stripFreshlyOpenedTrailingMarker (cognitive 17) · ×1
  • StreamingMarkdownBalancer.stripFreshlyOpenedTrailingMarker (cognitive 17) Packages/OsaurusCore/Views/Chat/StreamingMarkdownBalancer.swift:178 — StreamingMarkdownBalancer.stripFreshlyOpenedTrailingMarker has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, 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 · VaultAccountsView.sessionRow (cognitive 17) · ×1
  • VaultAccountsView.sessionRow (cognitive 17) Packages/OsaurusCore/Views/Credentials/VaultAccountsView.swift:251 — VaultAccountsView.sessionRow has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 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 · OverviewTab.interactionSection (cognitive 17) · ×1
  • OverviewTab.interactionSection (cognitive 17) Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:1312 — OverviewTab.interactionSection has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, 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 · StorageSettingsView.applyEncryption (cognitive 17) · ×1
  • StorageSettingsView.applyEncryption (cognitive 17) Packages/OsaurusCore/Views/Settings/StorageSettingsView.swift:596 — StorageSettingsView.applyEncryption has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 5 (6 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 · WhatsAppSettingsView.startPairing (cognitive 17) · ×1
  • WhatsAppSettingsView.startPairing (cognitive 17) Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:630 — WhatsAppSettingsView.startPairing has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 1 (3 pts), loops 1 (2 pts), boolean chains 1, 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 · TaskPresentation.statusLine (cognitive 17) · ×1
  • TaskPresentation.statusLine (cognitive 17) Packages/OsaurusCore/Views/Task/TaskRow.swift:49 — TaskPresentation.statusLine has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, 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 · WorkspaceDetailView.poolSection (cognitive 17) · ×1
  • WorkspaceDetailView.poolSection (cognitive 17) Packages/OsaurusCore/Views/Workspaces/WorkspaceDetailView.swift:396 — WorkspaceDetailView.poolSection 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 · CreateWorkspaceSheet.body (cognitive 17) · ×1
  • CreateWorkspaceSheet.body (cognitive 17) Packages/OsaurusCore/Views/Workspaces/WorkspaceSheets.swift:244 — CreateWorkspaceSheet.body has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 6, if/else 6, 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 · LoginAssertion.verify (cognitive 17) · ×1
  • LoginAssertion.verify (cognitive 17) Packages/OsaurusCore/Services/Auth/LoginWithOsaurus/LoginAssertion.swift:116 — LoginAssertion.verify has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 6, error handling 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 · NormalizedUnits.init (cognitive 17) · ×1
  • NormalizedUnits.init (cognitive 17) Packages/OsaurusCore/Services/Documents/OOXML/OOXMLText.swift:157 — NormalizedUnits.init has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (4 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 · EmailMIME.parseHeaders (cognitive 17) · ×1
  • EmailMIME.parseHeaders (cognitive 17) Packages/OsaurusCore/Services/Event/Email/EmailMIME.swift:99 — EmailMIME.parseHeaders has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, ternaries 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 · SSEScopeDriver.handle (cognitive 17) · ×1
  • SSEScopeDriver.handle (cognitive 17) Packages/OsaurusCore/Services/Event/Stream/SSEEventSource.swift:317 — SSEScopeDriver.handle has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 1 (2 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 · MCPOAuthService.performRefresh (cognitive 17) · ×1
  • MCPOAuthService.performRefresh (cognitive 17) Packages/OsaurusCore/Services/MCP/OAuth/MCPOAuthService.swift:337 — MCPOAuthService.performRefresh has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 6 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AgentSetupWizardView.finish (cognitive 17) · ×1
  • AgentSetupWizardView.finish (cognitive 17) Packages/OsaurusCore/Views/Agent/Setup/AgentSetupWizardView.swift:297 — AgentSetupWizardView.finish has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, loops 1 (2 pts), match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MediaStepEditor.imageParameters (cognitive 17) · ×1
  • MediaStepEditor.imageParameters (cognitive 17) Packages/OsaurusCore/Views/Workflow/Architect/MediaStepEditor.swift:215 — MediaStepEditor.imageParameters has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WorkflowFlowLayout.crossings (cognitive 17) · ×1
  • WorkflowFlowLayout.crossings (cognitive 17) Packages/OsaurusCore/Views/Workflow/FlowViewer/WorkflowFlowLayout.swift:107 — WorkflowFlowLayout.crossings has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 4 (6 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowSetupWizardView.body (cognitive 17) · ×1
  • WorkflowSetupWizardView.body (cognitive 17) Packages/OsaurusCore/Views/Workflow/Library/WorkflowSetupWizardView.swift:208 — WorkflowSetupWizardView.body has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, ternaries 5, boolean chains 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 · RemoteProviderEditSheet.swift.parsePastedEndpoint (cognitive 17) · ×1
  • RemoteProviderEditSheet.swift.parsePastedEndpoint (cognitive 17) Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:52 — RemoteProviderEditSheet.swift.parsePastedEndpoint has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, boolean chains 5, loops 1 (2 pts), match/switch 1 (2 pts) (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 · ConfigCommand.runExport (cognitive 16) · ×1
  • ConfigCommand.runExport (cognitive 16) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Config.swift:56 — ConfigCommand.runExport has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 1 (2 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 · ConfigCommand.request (cognitive 16) · ×1
  • ConfigCommand.request (cognitive 16) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Config.swift:275 — ConfigCommand.request has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), 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 · PullCommand.fetchMatchingFiles (cognitive 16) · ×1
  • PullCommand.fetchMatchingFiles (cognitive 16) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:301 — PullCommand.fetchMatchingFiles has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 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 · ManifestValidate.validateConfigFields (cognitive 16) · ×1
  • ManifestValidate.validateConfigFields (cognitive 16) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Manifest/ManifestValidate.swift:468 — ManifestValidate.validateConfigFields has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 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 · ComputerUseScorecardBuilder.build (cognitive 16) · ×1
  • ComputerUseScorecardBuilder.build (cognitive 16) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ComputerUseScorecard.swift:299 — ComputerUseScorecardBuilder.build has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 3, loops 2, match/switch 1 (2 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 · EvalBootstrap.applyKVRegimeOverrideIfRequested (cognitive 16) · ×1
  • EvalBootstrap.applyKVRegimeOverrideIfRequested (cognitive 16) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalBootstrap.swift:737 — EvalBootstrap.applyKVRegimeOverrideIfRequested 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 · EvalFixtureServer.respond (cognitive 16) · ×1
  • EvalFixtureServer.respond (cognitive 16) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalFixtureServer.swift:167 — EvalFixtureServer.respond has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 2 (4 pts), boolean chains 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.
D2 · Cognitive Complexity · CacheProofDecodeGate.evaluate (cognitive 16) · ×1
  • CacheProofDecodeGate.evaluate (cognitive 16) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalMetricGates.swift:36 — CacheProofDecodeGate.evaluate 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, 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 · EvalReviewReportBuilder.loadReportsRecursively (cognitive 16) · ×1
  • EvalReviewReportBuilder.loadReportsRecursively (cognitive 16) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReviewReport.swift:733 — EvalReviewReportBuilder.loadReportsRecursively has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, 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 · EvalReviewReportBuilder.compare (cognitive 16) · ×1
  • EvalReviewReportBuilder.compare (cognitive 16) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReviewReport.swift:806 — EvalReviewReportBuilder.compare has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 4, loops 3, 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 · EvalRunner.runCapabilitySearchCase (cognitive 16) · ×1
  • EvalRunner.runCapabilitySearchCase (cognitive 16) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:1236 — EvalRunner.runCapabilitySearchCase has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, 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 · EvalRemoteProviderBootstrap.preset (cognitive 16) · ×1
  • EvalRemoteProviderBootstrap.preset (cognitive 16) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/RemoteProviderBootstrap.swift:93 — EvalRemoteProviderBootstrap.preset has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 12, if/else 2, ternaries 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · TextLineReader.forEachLine (cognitive 16) · ×1
  • TextLineReader.forEachLine (cognitive 16) Packages/OsaurusPlugins/StatsPack/Sources/OsaurusStatsPack/TextLineReader.swift:9 — TextLineReader.forEachLine has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), 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 · CatalogTokenButtonStyle.makeBody (cognitive 16) · ×1
  • CatalogTokenButtonStyle.makeBody (cognitive 16) Packages/OsaurusCore/DevelopmentDesign/CatalogInspector.swift:222 — CatalogTokenButtonStyle.makeBody has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 12, boolean chains 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 · CatalogContentView.body (cognitive 16) · ×1
  • CatalogContentView.body (cognitive 16) Packages/OsaurusCore/DevelopmentDesign/CatalogInspector.swift:290 — CatalogContentView.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, ternaries 5, boolean chains 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 · DesignCatalogLayoutChecks.run (cognitive 16) · ×1
  • DesignCatalogLayoutChecks.run (cognitive 16) Packages/OsaurusCore/DevelopmentDesign/DesignCatalogLayoutChecks.swift:7 — DesignCatalogLayoutChecks.run has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, loops 2 (5 pts), if/else 2 (3 pts), error handling 1 (nesting depth added 4). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkspaceWriteSafety.unifiedDiff (cognitive 16) · ×1
  • WorkspaceWriteSafety.unifiedDiff (cognitive 16) Packages/OsaurusCore/Folder/WorkspaceWriteSafety.swift:459 — WorkspaceWriteSafety.unifiedDiff has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 5, ternaries 2, 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 · BackgroundTaskManager.lookupContinuedSession (cognitive 16) · ×1
  • BackgroundTaskManager.lookupContinuedSession (cognitive 16) Packages/OsaurusCore/Managers/BackgroundTaskManager.swift:1509 — BackgroundTaskManager.lookupContinuedSession 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 · WindowManager.show (cognitive 16) · ×1
  • WindowManager.show (cognitive 16) Packages/OsaurusCore/Managers/WindowManager.swift:128 — WindowManager.show has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, boolean chains 3, ternaries 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 · HTTPHandler.handleAgentWarmEndpoint (cognitive 16) · ×1
  • HTTPHandler.handleAgentWarmEndpoint (cognitive 16) Packages/OsaurusCore/Networking/HTTPHandler.swift:6330 — HTTPHandler.handleAgentWarmEndpoint has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, match/switch 1 (3 pts), error handling 1 (2 pts), ternaries 2, boolean chains 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 · HTTPHandler.handleSecureSessionEndpoint (cognitive 16) · ×1
  • HTTPHandler.handleSecureSessionEndpoint (cognitive 16) Packages/OsaurusCore/Networking/HTTPHandler.swift:9019 — HTTPHandler.handleSecureSessionEndpoint has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 2, match/switch 1 (2 pts), ternaries 1 (nesting depth added 4). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HostAPIBridgeHandler.channelRead (cognitive 16) · ×1
  • HostAPIBridgeHandler.channelRead (cognitive 16) Packages/OsaurusCore/Networking/HostAPIBridgeServer.swift:204 — HostAPIBridgeHandler.channelRead has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, ternaries 1 (2 pts), 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 · GitHubSkillService.listSkillAssets (cognitive 16) · ×1
  • GitHubSkillService.listSkillAssets (cognitive 16) Packages/OsaurusCore/Services/GitHubSkillService.swift:1529 — GitHubSkillService.listSkillAssets has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (5 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 · ModelRuntime.clearDiskCaches (cognitive 16) · ×1
  • ModelRuntime.clearDiskCaches (cognitive 16) Packages/OsaurusCore/Services/ModelRuntime.swift:1805 — ModelRuntime.clearDiskCaches has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, 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 · ModelSSDResidency.validatedNGramBytes (cognitive 16) · ×1
  • ModelSSDResidency.validatedNGramBytes (cognitive 16) Packages/OsaurusCore/Services/ModelSSDResidency.swift:172 — ModelSSDResidency.validatedNGramBytes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 4, 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 · OnboardingModelsProxy.resolve (cognitive 16) · ×1
  • OnboardingModelsProxy.resolve (cognitive 16) Packages/OsaurusCore/Services/OnboardingModelsProxy.swift:148 — OnboardingModelsProxy.resolve has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 2, 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 · StorageExportService.performRotation (cognitive 16) · ×1
  • StorageExportService.performRotation (cognitive 16) Packages/OsaurusCore/Storage/StorageExportService.swift:213 — StorageExportService.performRotation has cognitive complexity 16 (threshold 15). Drivers by points: error handling 5 (8 pts), if/else 3 (5 pts), loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StorageFormatConverter.export (cognitive 16) · ×1
  • StorageFormatConverter.export (cognitive 16) Packages/OsaurusCore/Storage/StorageFormatConverter.swift:110 — StorageFormatConverter.export has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), loops 2 (4 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SubagentChildRequestEstimate.boundedPositionBudget (cognitive 16) · ×1
  • SubagentChildRequestEstimate.boundedPositionBudget (cognitive 16) Packages/OsaurusCore/Subagent/SubagentBatchAdmissionPlanner.swift:87 — SubagentChildRequestEstimate.boundedPositionBudget has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CalculatorTool.payload (cognitive 16) · ×1
  • CalculatorTool.payload (cognitive 16) Packages/OsaurusCore/Tools/CalculatorTool.swift:98 — CalculatorTool.payload has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OsaurusInspectTool.statusEnvelope (cognitive 16) · ×1
  • OsaurusInspectTool.statusEnvelope (cognitive 16) Packages/OsaurusCore/Tools/ConfigurationTools.swift:477 — OsaurusInspectTool.statusEnvelope has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 2, 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 · RenderChartTool.resolveJSONPath (cognitive 16) · ×1
  • RenderChartTool.resolveJSONPath (cognitive 16) Packages/OsaurusCore/Tools/RenderChartTool.swift:576 — RenderChartTool.resolveJSONPath has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, 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 · RenderChartTool.unwrapQuotedDelimitedPayload (cognitive 16) · ×1
  • RenderChartTool.unwrapQuotedDelimitedPayload (cognitive 16) Packages/OsaurusCore/Tools/RenderChartTool.swift:802 — RenderChartTool.unwrapQuotedDelimitedPayload has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (6 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 · SchemaValidator.normalizeKeySpelling (cognitive 16) · ×1
  • SchemaValidator.normalizeKeySpelling (cognitive 16) Packages/OsaurusCore/Tools/SchemaValidator.swift:681 — SchemaValidator.normalizeKeySpelling has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 5, loops 4 (5 pts), if/else 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ShortcutsCLIService.run (cognitive 16) · ×1
  • ShortcutsCLIService.run (cognitive 16) Packages/OsaurusCore/AppleApps/Shortcuts/ShortcutsTools.swift:295 — ShortcutsCLIService.run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 3 (4 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · AppleJSON.serializable (cognitive 16) · ×1
  • AppleJSON.serializable (cognitive 16) Packages/OsaurusCore/AppleApps/Support/AppleToolBase.swift:330 — AppleJSON.serializable has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 3 (6 pts), if/else 3 (4 pts), loops 2 (4 pts), boolean chains 1, 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 · BrowserSession.waitFor (cognitive 16) · ×1
  • BrowserSession.waitFor (cognitive 16) Packages/OsaurusCore/Browser/Runtime/BrowserSession.swift:858 — BrowserSession.waitFor has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 2 (4 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 · FrameScrubber.recognizeAndDetect (cognitive 16) · ×1
  • FrameScrubber.recognizeAndDetect (cognitive 16) Packages/OsaurusCore/ComputerUse/Perception/FrameScrubber.swift:261 — FrameScrubber.recognizeAndDetect has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 2 (4 pts), error handling 3, match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigApplier.applyCommands (cognitive 16) · ×1
  • ConfigApplier.applyCommands (cognitive 16) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:1370 — ConfigApplier.applyCommands has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), 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 · ConfigApplier.applyPlugins (cognitive 16) · ×1
  • ConfigApplier.applyPlugins (cognitive 16) Packages/OsaurusCore/Configuration/Declarative/ConfigApplier.swift:1958 — ConfigApplier.applyPlugins has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (6 pts), error handling 2 (5 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OsaurusConfigTool.handleHistory (cognitive 16) · ×1
  • OsaurusConfigTool.handleHistory (cognitive 16) Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool+History.swift:29 — OsaurusConfigTool.handleHistory has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, error handling 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 · ChatSessionImporter.parseChatGPT (cognitive 16) · ×1
  • ChatSessionImporter.parseChatGPT (cognitive 16) Packages/OsaurusCore/Managers/Chat/ChatSessionImporter.swift:199 — ChatSessionImporter.parseChatGPT has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, 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 · ChatWindowState.restoreTabs (cognitive 16) · ×1
  • ChatWindowState.restoreTabs (cognitive 16) Packages/OsaurusCore/Managers/Chat/ChatWindowState.swift:2289 — ChatWindowState.restoreTabs has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (6 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 · ChatMessage.substitute (cognitive 16) · ×1
  • ChatMessage.substitute (cognitive 16) Packages/OsaurusCore/PrivacyFilter/Core/MessageScrubbing.swift:265 — ChatMessage.substitute has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 2, 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 · AgentChannelLiveProofReadiness.telegram (cognitive 16) · ×1
  • AgentChannelLiveProofReadiness.telegram (cognitive 16) Packages/OsaurusCore/Models/AgentChannel/AgentChannelLiveProofReadiness.swift:40 — AgentChannelLiveProofReadiness.telegram has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, boolean chains 3, 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 · AgentChannelLiveProofReadiness.slack (cognitive 16) · ×1
  • AgentChannelLiveProofReadiness.slack (cognitive 16) Packages/OsaurusCore/Models/AgentChannel/AgentChannelLiveProofReadiness.swift:98 — AgentChannelLiveProofReadiness.slack has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, loops 1 (2 pts), boolean chains 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 · LegacyInboundDispatchCarryOver.connectionsFile (cognitive 16) · ×1
  • LegacyInboundDispatchCarryOver.connectionsFile (cognitive 16) Packages/OsaurusCore/Models/AgentChannel/LegacyInboundDispatchCarryOver.swift:29 — LegacyInboundDispatchCarryOver.connectionsFile has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 5 (7 pts), loops 2 (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AnthropicReasoningContract.wireControls (cognitive 16) · ×1
  • AnthropicReasoningContract.wireControls (cognitive 16) Packages/OsaurusCore/Models/Configuration/AnthropicReasoningContract.swift:133 — AnthropicReasoningContract.wireControls has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 4, match/switch 1 (3 pts), ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MLXModel.localBundleDownloadSizeBytes (cognitive 16) · ×1
  • MLXModel.localBundleDownloadSizeBytes (cognitive 16) Packages/OsaurusCore/Models/Configuration/MLXModel.swift:255 — MLXModel.localBundleDownloadSizeBytes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 5, 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 · ServerRuntimeSettingsStore.shouldRepairMemorySafetyOwnedCacheDefaults (cognitive 16) · ×1
  • ServerRuntimeSettingsStore.shouldRepairMemorySafetyOwnedCacheDefaults (cognitive 16) Packages/OsaurusCore/Models/Configuration/ServerRuntimeSettingsStore.swift:689 — ServerRuntimeSettingsStore.shouldRepairMemorySafetyOwnedCacheDefaults has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 15, if/else 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 · OsaurusEvent.sourceSummary (cognitive 16) · ×1
  • OsaurusEvent.sourceSummary (cognitive 16) Packages/OsaurusCore/Models/Event/OsaurusEvent.swift:1043 — OsaurusEvent.sourceSummary has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 2 (3 pts), match/switch 2 (3 pts) (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Template.parseExactly (cognitive 16) · ×1
  • Template.parseExactly (cognitive 16) Packages/OsaurusCore/Models/Template/Template.swift:518 — Template.parseExactly has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 3, error handling 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, 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 · WorkflowDiff.plainLines (cognitive 16) · ×1
  • WorkflowDiff.plainLines (cognitive 16) Packages/OsaurusCore/Models/Workflow/WorkflowDraft.swift:721 — WorkflowDiff.plainLines has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), match/switch 4 (6 pts), ternaries 2 (4 pts) (nesting depth added 5). Of this number, 13 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowValidator.toolOutputWarnings (cognitive 16) · ×1
  • WorkflowValidator.toolOutputWarnings (cognitive 16) Packages/OsaurusCore/Models/Workflow/WorkflowValidator.swift:71 — WorkflowValidator.toolOutputWarnings 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 · PrivacyFilterModelBundle.verify (cognitive 16) · ×1
  • PrivacyFilterModelBundle.verify (cognitive 16) Packages/OsaurusCore/PrivacyFilter/Model/PrivacyFilterModelBundle.swift:142 — PrivacyFilterModelBundle.verify has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (14 pts), 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 · AgentBundleService.resolveImportIdentity (cognitive 16) · ×1
  • AgentBundleService.resolveImportIdentity (cognitive 16) Packages/OsaurusCore/Services/AgentBridge/AgentBundleService.swift:255 — AgentBundleService.resolveImportIdentity has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, 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 · AgentChannelTemplateRenderer.replacement (cognitive 16) · ×1
  • AgentChannelTemplateRenderer.replacement (cognitive 16) Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:1650 — AgentChannelTemplateRenderer.replacement has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 2 (3 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 · AgentChannelPublishService.operatorSend (cognitive 16) · ×1
  • AgentChannelPublishService.operatorSend (cognitive 16) Packages/OsaurusCore/Services/AgentChannel/AgentChannelPublishService.swift:594 — AgentChannelPublishService.operatorSend has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 5, 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 · AgentChannelWebhookIngress.handleInbound (cognitive 16) · ×1
  • AgentChannelWebhookIngress.handleInbound (cognitive 16) Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:216 — AgentChannelWebhookIngress.handleInbound has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 3, match/switch 3 (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 · ChannelReplyTokenService.validateToken (cognitive 16) · ×1
  • ChannelReplyTokenService.validateToken (cognitive 16) Packages/OsaurusCore/Services/Channels/ChannelReplyTokenService.swift:96 — ChannelReplyTokenService.validateToken has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), match/switch 1 (2 pts), error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AgentToolLoop.runBatchInParallel (cognitive 16) · ×1
  • AgentToolLoop.runBatchInParallel (cognitive 16) Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:1709 — AgentToolLoop.runBatchInParallel has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 4 (5 pts), boolean chains 1, error handling 1 (nesting depth added 4). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ContextBudgetManager.countRecentMessages (cognitive 16) · ×1
  • ContextBudgetManager.countRecentMessages (cognitive 16) Packages/OsaurusCore/Services/Chat/ContextBudgetManager.swift:702 — ContextBudgetManager.countRecentMessages has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 1 (2 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 · ContextCompactionService.summarize (cognitive 16) · ×1
  • ContextCompactionService.summarize (cognitive 16) Packages/OsaurusCore/Services/Chat/ContextCompactionService.swift:386 — ContextCompactionService.summarize has cognitive complexity 16 (threshold 15). Drivers by points: error handling 7, if/else 4 (5 pts), match/switch 1 (2 pts), ternaries 2 (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SystemPromptComposer.hasAnyConfiguredAgentChannel (cognitive 16) · ×1
  • SystemPromptComposer.hasAnyConfiguredAgentChannel (cognitive 16) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:1747 — SystemPromptComposer.hasAnyConfiguredAgentChannel has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 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 · SystemPromptComposer.compactWorkspaceSpec (cognitive 16) · ×1
  • SystemPromptComposer.compactWorkspaceSpec (cognitive 16) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3453 — SystemPromptComposer.compactWorkspaceSpec has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 3 (6 pts), boolean chains 1, 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 · ChatImportSummary.describe (cognitive 16) · ×1
  • ChatImportSummary.describe (cognitive 16) Packages/OsaurusCore/Services/ChatImport/ChatImportResults.swift:116 — ChatImportSummary.describe has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 3, match/switch 1 (nesting depth added 6). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to one function item inside it that branches (noun). 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 · CredentialMigration.importPlugins (cognitive 16) · ×1
  • CredentialMigration.importPlugins (cognitive 16) Packages/OsaurusCore/Services/Credentials/CredentialMigration.swift:243 — CredentialMigration.importPlugins has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CredentialMigration.importGlobal (cognitive 16) · ×1
  • CredentialMigration.importGlobal (cognitive 16) Packages/OsaurusCore/Services/Credentials/CredentialMigration.swift:337 — CredentialMigration.importGlobal has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 3, loops 2, 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 · PDFTableDetector.tables (cognitive 16) · ×1
  • PDFTableDetector.tables (cognitive 16) Packages/OsaurusCore/Services/Documents/PDFTableDetector.swift:201 — PDFTableDetector.tables has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 4 (7 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EmailChannelTransportRuntime.tick (cognitive 16) · ×1
  • EmailChannelTransportRuntime.tick (cognitive 16) Packages/OsaurusCore/Services/Email/EmailChannelTransportRuntime.swift:189 — EmailChannelTransportRuntime.tick has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 4, error handling 2, match/switch 1 (2 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EventManager.finalize (cognitive 16) · ×1
  • EventManager.finalize (cognitive 16) Packages/OsaurusCore/Services/Event/EventManager.swift:1100 — EventManager.finalize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, 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 · EventMigration.legacyChannelEvents (cognitive 16) · ×1
  • EventMigration.legacyChannelEvents (cognitive 16) Packages/OsaurusCore/Services/Event/EventMigration.swift:244 — EventMigration.legacyChannelEvents has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (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 · PendingImportProcessor.referencingAgents (cognitive 16) · ×1
  • PendingImportProcessor.referencingAgents (cognitive 16) Packages/OsaurusCore/Services/Import/PendingImportProcessor.swift:839 — PendingImportProcessor.referencingAgents has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 3 (5 pts), 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 · ActivityExportService.describe (cognitive 16) · ×1
  • ActivityExportService.describe (cognitive 16) Packages/OsaurusCore/Services/Insights/ActivityExportService.swift:337 — ActivityExportService.describe has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, ternaries 2 (4 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · KnowledgeDocumentParser.extraFields (cognitive 16) · ×1
  • KnowledgeDocumentParser.extraFields (cognitive 16) Packages/OsaurusCore/Services/Knowledge/KnowledgeDocumentParser.swift:84 — KnowledgeDocumentParser.extraFields has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 4, 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 · MCPProviderProbeService.mapFailure (cognitive 16) · ×1
  • MCPProviderProbeService.mapFailure (cognitive 16) Packages/OsaurusCore/Services/MCP/MCPProviderProbeService.swift:441 — MCPProviderProbeService.mapFailure has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 6, match/switch 2 (4 pts) (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TokenizerBridge.deepseekV4String (cognitive 16) · ×1
  • TokenizerBridge.deepseekV4String (cognitive 16) Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.swift:806 — TokenizerBridge.deepseekV4String has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DiscoveryCenter.liveSnapshot (cognitive 16) · ×1
  • DiscoveryCenter.liveSnapshot (cognitive 16) Packages/OsaurusCore/Services/Onboarding/DiscoveryCenter.swift:604 — DiscoveryCenter.liveSnapshot has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 3 (6 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PluginHostContext.prepareInference (cognitive 16) · ×1
  • PluginHostContext.prepareInference (cognitive 16) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:908 — PluginHostContext.prepareInference has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 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 · PluginHostContext.ssrfBlockedIPv4 (cognitive 16) · ×1
  • PluginHostContext.ssrfBlockedIPv4 (cognitive 16) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:3071 — PluginHostContext.ssrfBlockedIPv4 has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 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 · SharedAgentIdentity.make (cognitive 16) · ×1
  • SharedAgentIdentity.make (cognitive 16) Packages/OsaurusCore/Services/Router/SharedAgentIdentity.swift:120 — SharedAgentIdentity.make has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, boolean chains 5, ternaries 3. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · WorkspaceAuditLog.verify (cognitive 16) · ×1
  • WorkspaceAuditLog.verify (cognitive 16) Packages/OsaurusCore/Services/Router/WorkspaceAuditLog.swift:317 — WorkspaceAuditLog.verify has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkspaceSyncService.receive (cognitive 16) · ×1
  • WorkspaceSyncService.receive (cognitive 16) Packages/OsaurusCore/Services/Router/WorkspaceSyncService.swift:265 — WorkspaceSyncService.receive has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (7 pts), loops 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · BraveScrapeBackend.parseHTML (cognitive 16) · ×1
  • BraveScrapeBackend.parseHTML (cognitive 16) Packages/OsaurusCore/Services/Search/NativeSearchBackends.swift:178 — BraveScrapeBackend.parseHTML has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 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 · SearchHTML.decodeHTMLEntities (cognitive 16) · ×1
  • SearchHTML.decodeHTMLEntities (cognitive 16) Packages/OsaurusCore/Services/Search/SearchHTMLHelpers.swift:18 — SearchHTML.decodeHTMLEntities has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SearchHTML.blockedIPv6Reason (cognitive 16) · ×1
  • SearchHTML.blockedIPv6Reason (cognitive 16) Packages/OsaurusCore/Services/Search/SearchHTMLHelpers.swift:283 — SearchHTML.blockedIPv6Reason has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4 (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 · SearchHTML.blockedIPv4Reason (cognitive 16) · ×1
  • SearchHTML.blockedIPv4Reason (cognitive 16) Packages/OsaurusCore/Services/Search/SearchHTMLHelpers.swift:364 — SearchHTML.blockedIPv4Reason has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 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 · ClaudePluginInstaller.inferCron (cognitive 16) · ×1
  • ClaudePluginInstaller.inferCron (cognitive 16) Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:1575 — ClaudePluginInstaller.inferCron has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 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 · SlackSocketModeTransportRuntime.runStep (cognitive 16) · ×1
  • SlackSocketModeTransportRuntime.runStep (cognitive 16) Packages/OsaurusCore/Services/Slack/SlackSocketModeTransportRuntime.swift:185 — SlackSocketModeTransportRuntime.runStep has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), error handling 4, boolean chains 2, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SpaceLauncher.prepare (cognitive 16) · ×1
  • SpaceLauncher.prepare (cognitive 16) Packages/OsaurusCore/Services/Spaces/SpaceLauncher.swift:42 — SpaceLauncher.prepare has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 1 (3 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 · SyncInboundApplier.flush (cognitive 16) · ×1
  • SyncInboundApplier.flush (cognitive 16) Packages/OsaurusCore/Services/Sync/SyncInboundApplier.swift:326 — SyncInboundApplier.flush has cognitive complexity 16 (threshold 15). Drivers by points: loops 5 (9 pts), if/else 5 (7 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 · SyncInboundApplier.applyStaleSessions (cognitive 16) · ×1
  • SyncInboundApplier.applyStaleSessions (cognitive 16) Packages/OsaurusCore/Services/Sync/SyncInboundApplier.swift:365 — SyncInboundApplier.applyStaleSessions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (6 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 · SyncTurnStreamer.tick (cognitive 16) · ×1
  • SyncTurnStreamer.tick (cognitive 16) Packages/OsaurusCore/Services/Sync/SyncTurnStreamer.swift:75 — SyncTurnStreamer.tick has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 6, 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 · ToolIndexService.syncFromRegistry (cognitive 16) · ×1
  • ToolIndexService.syncFromRegistry (cognitive 16) Packages/OsaurusCore/Services/Tool/ToolIndexService.swift:18 — ToolIndexService.syncFromRegistry has cognitive complexity 16 (threshold 15). Drivers by points: error handling 3 (6 pts), if/else 5 (6 pts), loops 2 (3 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 · ToolSearchService.searchHybridWithDiagnostic (cognitive 16) · ×1
  • ToolSearchService.searchHybridWithDiagnostic (cognitive 16) Packages/OsaurusCore/Services/Tool/ToolSearchService.swift:471 — ToolSearchService.searchHybridWithDiagnostic has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, error handling 1, 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 · DialogCoordinator.normalize (cognitive 16) · ×1
  • DialogCoordinator.normalize (cognitive 16) Packages/OsaurusCore/Services/Workflow/DialogCoordinator.swift:153 — DialogCoordinator.normalize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 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 · MediaNodeExecutor.validate (cognitive 16) · ×1
  • MediaNodeExecutor.validate (cognitive 16) Packages/OsaurusCore/Services/Workflow/MediaNodeExecutor.swift:639 — MediaNodeExecutor.validate has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 2 (6 pts), boolean chains 4, if/else 1 (3 pts), match/switch 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 · WorkflowArtifactCollector.share (cognitive 16) · ×1
  • WorkflowArtifactCollector.share (cognitive 16) Packages/OsaurusCore/Services/Workflow/WorkflowArtifacts.swift:88 — WorkflowArtifactCollector.share has cognitive complexity 16 (threshold 15). Drivers by points: error handling 2 (4 pts), if/else 4, ternaries 2 (4 pts), boolean chains 2, match/switch 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 · WorkflowConnectionResolver.resolve (cognitive 16) · ×1
  • WorkflowConnectionResolver.resolve (cognitive 16) Packages/OsaurusCore/Services/Workflow/WorkflowConnections.swift:279 — WorkflowConnectionResolver.resolve has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 2 (4 pts), boolean chains 3, 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 · WorkflowRunner.schedule (cognitive 16) · ×1
  • WorkflowRunner.schedule (cognitive 16) Packages/OsaurusCore/Services/Workflow/WorkflowRunner.swift:818 — WorkflowRunner.schedule has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 3, loops 2 (3 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 · HiddenAgentHandoffKind.run (cognitive 16) · ×1
  • HiddenAgentHandoffKind.run (cognitive 16) Packages/OsaurusCore/Tools/Handoff/HiddenAgentHandoffRunner.swift:268 — HiddenAgentHandoffKind.run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 2 (3 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 · WorkflowDiscoverTool.models (cognitive 16) · ×1
  • WorkflowDiscoverTool.models (cognitive 16) Packages/OsaurusCore/Tools/Workflow/WorkflowDiscoverTool.swift:224 — WorkflowDiscoverTool.models has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 1, ternaries 1 (nesting depth added 4). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentGenerationSettingsEditor.body (cognitive 16) · ×1
  • AgentGenerationSettingsEditor.body (cognitive 16) Packages/OsaurusCore/Views/Agent/AgentGenerationSettingsEditor.swift:60 — AgentGenerationSettingsEditor.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, boolean chains 5, error handling 1 (2 pts), 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 · AgentsView.body (cognitive 16) · ×1
  • AgentsView.body (cognitive 16) Packages/OsaurusCore/Views/Agent/AgentsView.swift:103 — AgentsView.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 4, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · WorkspaceAgentSidebarRow.body (cognitive 16) · ×1
  • WorkspaceAgentSidebarRow.body (cognitive 16) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:2358 — WorkspaceAgentSidebarRow.body has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (9 pts), if/else 5 (7 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 · ChatSession.modelVisibleAssistantMessage (cognitive 16) · ×1
  • ChatSession.modelVisibleAssistantMessage (cognitive 16) Packages/OsaurusCore/Views/Chat/ChatView.swift:2822 — ChatSession.modelVisibleAssistantMessage has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, ternaries 4, 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 · ChatSession.streamMockToolTimeline (cognitive 16) · ×1
  • ChatSession.streamMockToolTimeline (cognitive 16) Packages/OsaurusCore/Views/Chat/ChatView.swift:6788 — ChatSession.streamMockToolTimeline has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3, 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 · NativeMarkdownView.rectOfSearchOccurrence (cognitive 16) · ×1
  • NativeMarkdownView.rectOfSearchOccurrence (cognitive 16) Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:298 — NativeMarkdownView.rectOfSearchOccurrence has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 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 · NativeMessageCellView.measureFittedRowHeight (cognitive 16) · ×1
  • NativeMessageCellView.measureFittedRowHeight (cognitive 16) Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2221 — NativeMessageCellView.measureFittedRowHeight has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, 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 · SelectableTextView.updateNSView (cognitive 16) · ×1
  • SelectableTextView.updateNSView (cognitive 16) Packages/OsaurusCore/Views/Chat/SelectableTextView.swift:134 — SelectableTextView.updateNSView has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6 (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 · StreamingMarkdownBalancer.trailingProseStart (cognitive 16) · ×1
  • StreamingMarkdownBalancer.trailingProseStart (cognitive 16) Packages/OsaurusCore/Views/Chat/StreamingMarkdownBalancer.swift:41 — StreamingMarkdownBalancer.trailingProseStart has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 2 (3 pts), boolean chains 1, 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 · ToolDisplayName.friendly (cognitive 16) · ×1
  • ToolDisplayName.friendly (cognitive 16) Packages/OsaurusCore/Views/Chat/ToolDisplayName.swift:102 — ToolDisplayName.friendly has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 1 (2 pts), boolean chains 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 · ToolDisplayName.configLabel (cognitive 16) · ×1
  • ToolDisplayName.configLabel (cognitive 16) Packages/OsaurusCore/Views/Chat/ToolDisplayName.swift:260 — ToolDisplayName.configLabel has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 1, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · KeysView.keyRow (cognitive 16) · ×1
  • KeysView.keyRow (cognitive 16) Packages/OsaurusCore/Views/Credentials/KeysView.swift:345 — KeysView.keyRow has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, ternaries 4 (6 pts), boolean chains 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 · AppKeyEditorSheet.body (cognitive 16) · ×1
  • AppKeyEditorSheet.body (cognitive 16) Packages/OsaurusCore/Views/Credentials/KeysView.swift:561 — AppKeyEditorSheet.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SettingsEmptyState.hero (cognitive 16) · ×1
  • SettingsEmptyState.hero (cognitive 16) Packages/OsaurusCore/Views/DesignSystem/SettingsEmptyState.swift:144 — SettingsEmptyState.hero has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (9 pts), if/else 6, boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MemoryConsoleInspectSheet.metadataGrid (cognitive 16) · ×1
  • MemoryConsoleInspectSheet.metadataGrid (cognitive 16) Packages/OsaurusCore/Views/Memory/MemoryManagementConsoleView.swift:666 — MemoryConsoleInspectSheet.metadataGrid has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15, 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 · MCPPreviewView.body (cognitive 16) · ×1
  • MCPPreviewView.body (cognitive 16) Packages/OsaurusCore/Views/Plugin/ClaudePluginDetailView.swift:1126 — MCPPreviewView.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 · HarnessRuntimeEditorSheet.parseEnvironment (cognitive 16) · ×1
  • HarnessRuntimeEditorSheet.parseEnvironment (cognitive 16) Packages/OsaurusCore/Views/Settings/AgentRuntimesView.swift:354 — HarnessRuntimeEditorSheet.parseEnvironment has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 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 · CommandLineToolSection.resolveCLIExecutableURL (cognitive 16) · ×1
  • CommandLineToolSection.resolveCLIExecutableURL (cognitive 16) Packages/OsaurusCore/Views/Settings/CommandLineToolSection.swift:87 — CommandLineToolSection.resolveCLIExecutableURL has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 8. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · N8nSettingsView.locationConsequences (cognitive 16) · ×1
  • N8nSettingsView.locationConsequences (cognitive 16) Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:519 — N8nSettingsView.locationConsequences has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 2 (3 pts), match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · StorageSettingsView.convergenceSummary (cognitive 16) · ×1
  • StorageSettingsView.convergenceSummary (cognitive 16) Packages/OsaurusCore/Views/Settings/StorageSettingsView.swift:639 — StorageSettingsView.convergenceSummary has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 4 (5 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ShareWorkflowSheet.retryListing (cognitive 16) · ×1
  • ShareWorkflowSheet.retryListing (cognitive 16) Packages/OsaurusCore/Views/Template/ShareWorkflowSheet.swift:1044 — ShareWorkflowSheet.retryListing has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 2 (4 pts), boolean chains 1, 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 · WorkflowFormFields.fields (cognitive 16) · ×1
  • WorkflowFormFields.fields (cognitive 16) Packages/OsaurusCore/Views/Workflow/WorkflowFormView.swift:18 — WorkflowFormFields.fields has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 4, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · WorkflowSavePromptOverlay.body (cognitive 16) · ×1
  • WorkflowSavePromptOverlay.body (cognitive 16) Packages/OsaurusCore/Views/Workflow/WorkflowSavePrompt.swift:151 — WorkflowSavePromptOverlay.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 5 (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 · WorkspaceAuditCard.body (cognitive 16) · ×1
  • WorkspaceAuditCard.body (cognitive 16) Packages/OsaurusCore/Views/Workspaces/WorkspaceAuditView.swift:41 — WorkspaceAuditCard.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JoinWorkspaceSheet.body (cognitive 16) · ×1
  • JoinWorkspaceSheet.body (cognitive 16) Packages/OsaurusCore/Views/Workspaces/WorkspaceSheets.swift:621 — JoinWorkspaceSheet.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 3, 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 · DOCXEditor.markdownParagraph (cognitive 16) · ×1
  • DOCXEditor.markdownParagraph (cognitive 16) Packages/OsaurusCore/Services/Documents/OOXML/DOCXEditor.swift:371 — DOCXEditor.markdownParagraph has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 3 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 6). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EmailMIME.quotedPrintable (cognitive 16) · ×1
  • EmailMIME.quotedPrintable (cognitive 16) Packages/OsaurusCore/Services/Event/Email/EmailMIME.swift:348 — EmailMIME.quotedPrintable has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 5, loops 1, match/switch 1 (nesting depth added 4). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IMAPClient.fetch (cognitive 16) · ×1
  • IMAPClient.fetch (cognitive 16) Packages/OsaurusCore/Services/Event/Email/IMAPClient.swift:463 — IMAPClient.fetch has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (3 pts), match/switch 1 (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 · AppleScriptCatalogSource.item (cognitive 16) · ×1
  • AppleScriptCatalogSource.item (cognitive 16) Packages/OsaurusCore/Views/Model/Catalog/AppleScriptCatalogSource.swift:80 — AppleScriptCatalogSource.item has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 3 (6 pts), match/switch 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 · MTPSection.body (cognitive 16) · ×1
  • MTPSection.body (cognitive 16) Packages/OsaurusCore/Views/Settings/ServerSettings/MTPSection.swift:57 — MTPSection.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, loops 2 (3 pts), ternaries 2 (3 pts), boolean chains 2, match/switch 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · DraftStepList.card (cognitive 16) · ×1
  • DraftStepList.card (cognitive 16) Packages/OsaurusCore/Views/Workflow/Architect/ArchitectSidebarPanel.swift:964 — DraftStepList.card has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 9 (10 pts), if/else 5, boolean chains 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 · WorkflowFlowInspector.more (cognitive 16) · ×1
  • WorkflowFlowInspector.more (cognitive 16) Packages/OsaurusCore/Views/Workflow/FlowViewer/WorkflowFlowInspector.swift:276 — WorkflowFlowInspector.more has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 3 (7 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 · WorkflowReviewStep.body (cognitive 16) · ×1
  • WorkflowReviewStep.body (cognitive 16) Packages/OsaurusCore/Views/Workflow/Library/WorkflowSetupWizardView.swift:1584 — WorkflowReviewStep.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, 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 · main.swift.buildHelperHostAPI (cognitive 16) · ×1
  • main.swift.buildHelperHostAPI (cognitive 16) Packages/OsaurusCore/PluginHost/main.swift:269 — main.swift.buildHelperHostAPI has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15, 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 · Accessibility.swift.computeFocusDelta (cognitive 16) · ×1
  • Accessibility.swift.computeFocusDelta (cognitive 16) Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:1054 — Accessibility.swift.computeFocusDelta has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 2 (5 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.
D30 · Dependency Vulnerabilities · Medium vulnerability · ×1
  • REDACTED
D35 · Change Coupling · Change-coupling hub · ×1
  • Change-coupling hub: Package.swift → LocalVisionEvidence.swift, ModelFamilyNames.swift, ModelMediaCapabilities.swift, GenerationEventMapper.swift, ImageGenerationService.swift, MLXBatchAdapter.swift, SwiftTransformersTokenizerLoader.swift, ImageGenerationPanelView.swift Packages/OsaurusCore/Package.swift — `Packages/OsaurusCore/Package.swift` changes together with 8 other files — `Packages/OsaurusCore/Models/Configuration/LocalVisionEvidence.swift`, `Packages/OsaurusCore/Models/Configuration/ModelFamilyNames.swift`, `Packages/OsaurusCore/Models/Configuration/ModelMediaCapabilities.swift`, `Packages/OsaurusCore/Services/ModelRuntime/GenerationEventMapper.swift`, `Packages/OsaurusCore/Services/ModelRuntime/ImageGenerationService.swift`, `Packages/OsaurusCore/Services/ModelRuntime/MLXBatchAdapter.swift`, `Packages/OsaurusCore/Services/ModelRuntime/SwiftTransformersTokenizerLoader.swift`, `Packages/OsaurusCore/Views/Model/ImageGenerationPanelView.swift` — none of which declares a dependency on it: one file is the hub of 8 separate couplings, not 8 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 8.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (4 members, 31 shared lines) · ×1
  • Near-duplicate member family (4 members, 31 shared lines) Packages/OsaurusCore/Networking/HTTPHandler.swift:10158 — Packages/OsaurusCore/Networking/HTTPHandler.swift:10158-10278 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16911-16980 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16982-17088 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17328-17423 — These 4 members are variants of one another: a block of 31 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 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 · Near-duplicate member family (4 members, 20 shared lines) · ×1
  • Near-duplicate member family (4 members, 20 shared lines) Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:1321 — Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:1321-1355 | Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:1359-1417 | Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:1430-1468 | Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:1470-1520 — These 4 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 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 · Near-duplicate member family (4 members, 10 shared lines) · ×1
  • Near-duplicate member family (4 members, 10 shared lines) Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:179 — Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:179-193 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:721-734 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1021-1035 | Packages/OsaurusCore/Models/Chat/ResponseWriters.swift:1365-1379 — These 4 members are variants of one another: a block of 10 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 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 · Near-duplicate member pair (106 shared lines) · ×1
  • Near-duplicate member pair (106 shared lines) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsCreate.swift:110 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsCreate.swift:110-590 | Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsCreate.swift:592-968 — These two members are variants of one another: 106 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 (77 shared lines) · ×1
  • Near-duplicate member pair (77 shared lines) Packages/OsaurusCore/Networking/HTTPHandler.swift:16047 — Packages/OsaurusCore/Networking/HTTPHandler.swift:16047-16130 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16333-16415 — These two members are variants of one another: 77 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 (68 shared lines) · ×1
  • Near-duplicate member pair (68 shared lines) Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:572 — Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:572-723 | Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift:274-394 — These two members are variants of one another: 68 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 (55 shared lines) · ×1
  • Near-duplicate member pair (55 shared lines) Packages/OsaurusCore/Networking/HTTPHandler.swift:17110 — Packages/OsaurusCore/Networking/HTTPHandler.swift:17110-17310 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17425-17815 — These two members are variants of one another: 55 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 (43 shared lines) · ×1
  • Near-duplicate member pair (43 shared lines) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3806 — Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3806-3888 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3892-3986 — These two members are variants of one another: 43 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 (34 shared lines) · ×1
  • Near-duplicate member pair (34 shared lines) Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:4484 — Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:4484-4550 | Packages/OsaurusCore/Views/Chat/FloatingInputCard.swift:4688-4775 — These two members are variants of one another: 34 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 (18 shared lines) · ×1
  • Near-duplicate member pair (18 shared lines) Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:124 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:124-172 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelMessageFormatter.swift:330-388 — These two members are variants of one another: 18 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 (17 shared lines) · ×1
  • Near-duplicate member pair (17 shared lines) Packages/OsaurusCore/Services/MediaGeneration/MediaGenerationTypes.swift:224 — Packages/OsaurusCore/Services/MediaGeneration/MediaGenerationTypes.swift:224-272 | Packages/OsaurusCore/Services/MediaGeneration/VeniceMediaCatalog.swift:97-143 — These two members are variants of one another: 17 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 · Members sharing a duplicated core (21 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (21 members, 50+ identical tokens) Packages/OsaurusCore/Tools/AgentChannelTools.swift:373 — Packages/OsaurusCore/Tools/AgentChannelTools.swift:373-379 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:407-420 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:453-471 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:507-526 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:562-581 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:626-647 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:683-700 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:741-763 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:805-827 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:853-878 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:901-923 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:955-981 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1025-1044 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1093-1115 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1168-1193 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1238-1263 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1308-1333 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1385-1420 | Packages/OsaurusCore/Tools/CalculatorTool.swift:58-94 | Packages/OsaurusCore/Tools/CurrentTimeTool.swift:48-99 | Packages/OsaurusCore/Tools/SandboxSecretTools.swift:149-291 — These 21 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 21 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 21 times.
D4 · Code Duplication · Members sharing a duplicated core (19 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (19 members, 50+ identical tokens) Packages/OsaurusCore/Browser/Tool/BrowserUseTool.swift:76 — Packages/OsaurusCore/Browser/Tool/BrowserUseTool.swift:76-143 | Packages/OsaurusCore/ComputerUse/Tool/ComputerUseTool.swift:126-180 | Packages/OsaurusCore/Folder/FileCopyTool.swift:89-282 | Packages/OsaurusCore/Folder/FolderTools.swift:2766-3010 | Packages/OsaurusCore/Folder/PromptWorkingFolderTool.swift:128-183 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1547-1568 | Packages/OsaurusCore/Tools/AgentLoopTools.swift:59-176 | Packages/OsaurusCore/Tools/AgentLoopTools.swift:211-282 | Packages/OsaurusCore/Tools/AgentLoopTools.swift:397-462 | Packages/OsaurusCore/Tools/AgentLoopTools.swift:549-615 | Packages/OsaurusCore/Tools/AskOwnerTool.swift:38-92 | Packages/OsaurusCore/Tools/CalculatorTool.swift:58-94 | Packages/OsaurusCore/Tools/KnowledgeCurationTools.swift:99-184 | Packages/OsaurusCore/Tools/KnowledgeTools.swift:451-644 | Packages/OsaurusCore/Tools/KnowledgeWriteTools.swift:822-928 | Packages/OsaurusCore/Tools/NativeImageTools.swift:173-202 | Packages/OsaurusCore/Tools/SkillUpdateTool.swift:96-165 | Packages/OsaurusCore/Tools/VideoTool.swift:88-121 | Packages/OsaurusCore/Tools/WebSearchTools.swift:272-340 — These 19 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 19 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 19 times.
D4 · Code Duplication · Members sharing a duplicated core (17 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (17 members, 50+ identical tokens) Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:321 — Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:321-401 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:445-498 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:534-561 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:606-660 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:699-760 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:795-835 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:861-892 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:915-944 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:987-1039 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:1079-1140 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:1239-1378 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:1432-1513 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:1572-1616 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:1639-1677 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:1735-1753 | Packages/OsaurusCore/Tools/Database/SchedulerTools.swift:131-188 | Packages/OsaurusCore/Tools/Database/SchedulerTools.swift:320-347 — These 17 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 17 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 17 times.
D4 · Code Duplication · Members sharing a duplicated core (10 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (10 members, 50+ identical tokens) Packages/OsaurusCore/Networking/HTTPHandler.swift:5585 — Packages/OsaurusCore/Networking/HTTPHandler.swift:5585-5650 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6065-6105 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6896-6952 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7050-7088 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7174-7212 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7623-7661 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7798-7850 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7978-8043 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8060-8100 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8211-8304 — These 10 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 10 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 10 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) Packages/OsaurusCore/AppleApps/AppleAppsPluginMigration.swift:73 — Packages/OsaurusCore/AppleApps/AppleAppsPluginMigration.swift:73-84 | Packages/OsaurusCore/Browser/BrowserConfigurationStore.swift:67-80 | Packages/OsaurusCore/ComputerUse/Policy/ComputerUsePolicyStore.swift:106-115 | Packages/OsaurusCore/Models/Configuration/MCPProviderConfiguration.swift:470-480 | Packages/OsaurusCore/Models/Configuration/RelayConfiguration.swift:63-73 | Packages/OsaurusCore/Models/Configuration/SearchProviderConfiguration.swift:472-482 | Packages/OsaurusCore/Models/Tool/ToolConfigurationStore.swift:106-115 | Packages/OsaurusCore/Models/Voice/SpeechConfiguration.swift:254-264 | Packages/OsaurusCore/Models/Voice/TTSConfiguration.swift:175-185 — 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 · Edited copy of a member (68 corresponding lines) · ×1
  • Edited copy of a member (68 corresponding lines) Packages/OsaurusCore/Views/Voice/VoiceComponents.swift:660 — Packages/OsaurusCore/Views/Voice/VoiceComponents.swift:660-736 | Packages/OsaurusCore/Views/Voice/VoiceComponents.swift:941-1008 — These two members are one piece of code written twice and then edited apart: 68 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (99 corresponding lines) · ×1
  • Edited copy of a member (99 corresponding lines) Packages/OsaurusCore/Views/Plugin/GitHubImportSheet.swift:237 — Packages/OsaurusCore/Views/Plugin/GitHubImportSheet.swift:237-335 | Packages/OsaurusCore/Views/Plugin/GitHubImportSheet.swift:339-460 — These two members are one piece of code written twice and then edited apart: 99 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (70 corresponding lines) · ×1
  • Edited copy of a member (70 corresponding lines) Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:955 — Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:955-1024 | Packages/OsaurusCore/Views/Settings/RemoteProviderEditSheet.swift:1903-1975 — These two members are one piece of code written twice and then edited apart: 70 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (95 corresponding lines) · ×1
  • Edited copy of a member (95 corresponding lines) Packages/OsaurusCore/Services/Auth/ConsentPanelPresenter.swift:35 — Packages/OsaurusCore/Services/Auth/ConsentPanelPresenter.swift:35-129 | Packages/OsaurusCore/Services/Provider/ProviderCredentialPromptService.swift:255-366 — These two members are one piece of code written twice and then edited apart: 95 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (93 corresponding lines) · ×1
  • Edited copy of a member (93 corresponding lines) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1027 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1027-1119 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:1133-1229 — These two members are one piece of code written twice and then edited apart: 93 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (83 corresponding lines) · ×1
  • Edited copy of a member (83 corresponding lines) Packages/OsaurusCore/Tools/KnowledgeWriteTools.swift:133 — Packages/OsaurusCore/Tools/KnowledgeWriteTools.swift:133-215 | Packages/OsaurusCore/Tools/KnowledgeWriteTools.swift:471-559 — These two members are one piece of code written twice and then edited apart: 83 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (73 corresponding lines) · ×1
  • Edited copy of a member (73 corresponding lines) Packages/OsaurusCore/Services/Inference/FoundationModelService.swift:317 — Packages/OsaurusCore/Services/Inference/FoundationModelService.swift:317-389 | Packages/OsaurusCore/Services/Inference/FoundationModelService.swift:507-596 — These two members are one piece of code written twice and then edited apart: 73 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 42+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 42+ corresponding lines) Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:405 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:405-446 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:474-555 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:599-672 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 42 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (51 corresponding lines) · ×1
  • Edited copy of a member (51 corresponding lines) Packages/OsaurusCore/Services/AgentDelegation/NativeImageJobCoordinator.swift:509 — Packages/OsaurusCore/Services/AgentDelegation/NativeImageJobCoordinator.swift:509-559 | Packages/OsaurusCore/Services/AgentDelegation/NativeImageJobCoordinator.swift:561-612 — These two members are one piece of code written twice and then edited apart: 51 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 65+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 65+ corresponding lines) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:1446 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:1446-1516 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalMatrix.swift:231-295 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReport.swift:162-236 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 65 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (76 corresponding lines) · ×1
  • Edited copy of a member (76 corresponding lines) Packages/OsaurusCore/Networking/HTTPHandler.swift:12879 — Packages/OsaurusCore/Networking/HTTPHandler.swift:12879-12954 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12957-13032 — These two members are one piece of code written twice and then edited apart: 76 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 40+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 40+ corresponding lines) Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:732 — Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:732-781 | Packages/OsaurusCore/Services/Email/EmailChannelService.swift:324-363 | Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:501-552 | Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:1053-1108 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:816-867 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:596-651 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 40 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (46 corresponding lines) · ×1
  • Edited copy of a member (46 corresponding lines) Packages/OsaurusCore/Services/Memory/MemorySearchService.swift:330 — Packages/OsaurusCore/Services/Memory/MemorySearchService.swift:330-375 | Packages/OsaurusCore/Services/Memory/MemorySearchService.swift:377-441 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 43+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 43+ corresponding lines) Packages/OsaurusCore/Views/Agent/Database/DatabaseHistoryView.swift:56 — Packages/OsaurusCore/Views/Agent/Database/DatabaseHistoryView.swift:56-98 | Packages/OsaurusCore/Views/Agent/Database/DatabaseSavedViewsView.swift:72-114 | Packages/OsaurusCore/Views/Agent/Database/DatabaseTablesView.swift:201-244 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 43 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (58 corresponding lines) · ×1
  • Edited copy of a member (58 corresponding lines) Packages/OsaurusCore/Managers/HotKeyManager.swift:32 — Packages/OsaurusCore/Managers/HotKeyManager.swift:32-89 | Packages/OsaurusCore/Managers/TranscriptionHotKeyManager.swift:46-112 — These two members are one piece of code written twice and then edited apart: 58 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (84 corresponding lines) · ×1
  • Edited copy of a member (84 corresponding lines) Packages/OsaurusCore/ComputerUse/Driver/Mac/BackgroundDriver.swift:457 — Packages/OsaurusCore/ComputerUse/Driver/Mac/BackgroundDriver.swift:457-542 | Packages/OsaurusCore/ComputerUse/Driver/Mac/InputController.swift:184-267 — These two members are one piece of code written twice and then edited apart: 84 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (55 corresponding lines) · ×1
  • Edited copy of a member (55 corresponding lines) Packages/OsaurusCore/Services/Context/SubagentJobEvaluator.swift:131 — Packages/OsaurusCore/Services/Context/SubagentJobEvaluator.swift:131-185 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCase.swift:3975-4033 — These two members are one piece of code written twice and then edited apart: 55 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (74 corresponding lines) · ×1
  • Edited copy of a member (74 corresponding lines) Packages/OsaurusCore/Services/Chat/ChatTitleService.swift:45 — Packages/OsaurusCore/Services/Chat/ChatTitleService.swift:45-118 | Packages/OsaurusCore/Services/Chat/FollowUpSuggestionService.swift:61-156 — These two members are one piece of code written twice and then edited apart: 74 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 57+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 57+ corresponding lines) Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:735 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:735-798 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:800-856 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:858-928 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 57 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (64 corresponding lines) · ×1
  • Edited copy of a member (64 corresponding lines) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:687 — Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:687-770 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:2434-2497 — These two members are one piece of code written twice and then edited apart: 64 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 35+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 35+ corresponding lines) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:620 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:620-655 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:828-871 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:499-533 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 35 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 38+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 38+ corresponding lines) Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:436 — Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:436-481 | Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:483-529 | Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:531-568 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 38 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 50+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 50+ corresponding lines) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1121 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1121-1175 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:1207-1256 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:1260-1318 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 50 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 34+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 34+ corresponding lines) Packages/OsaurusCore/ComputerUse/Driver/MockMacDriver.swift:124 — Packages/OsaurusCore/ComputerUse/Driver/MockMacDriver.swift:124-160 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/FixtureCUDriver.swift:74-113 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ScriptedCUDriver.swift:204-237 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 34 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 25+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 25+ corresponding lines) Packages/OsaurusCore/Storage/MethodDatabase.swift:272 — Packages/OsaurusCore/Storage/MethodDatabase.swift:272-297 | Packages/OsaurusCore/Storage/MethodDatabase.swift:299-323 | Packages/OsaurusCore/Storage/ToolDatabase.swift:353-379 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 25 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 22+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 22+ corresponding lines) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1673 — Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1673-1705 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3175-3207 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3556-3586 | Packages/OsaurusCore/Tools/ConfigurationTools.swift:1673-1694 | Packages/OsaurusCore/Tools/SandboxSecretTools.swift:119-147 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 22 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 41+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 41+ corresponding lines) Packages/OsaurusCore/Views/Settings/ArchitectSettingsView.swift:30 — Packages/OsaurusCore/Views/Settings/ArchitectSettingsView.swift:30-70 | Packages/OsaurusCore/Views/Settings/ConfiguratorSettingsView.swift:28-72 | Packages/OsaurusCore/Views/Settings/OrchestratorSettingsView.swift:40-83 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 41 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 41+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 41+ corresponding lines) Packages/OsaurusCore/Services/Knowledge/KnowledgeSearchService.swift:74 — Packages/OsaurusCore/Services/Knowledge/KnowledgeSearchService.swift:74-115 | Packages/OsaurusCore/Services/Method/MethodSearchService.swift:52-92 | Packages/OsaurusCore/Services/Skill/SkillSearchService.swift:77-118 | Packages/OsaurusCore/Services/Tool/ToolSearchService.swift:174-224 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 41 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 43+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 43+ corresponding lines) Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1347 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1347-1391 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1471-1513 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1526-1572 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1587-1630 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 43 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (7 members, 16+ corresponding lines) · ×1
  • Edited copies of one member (7 members, 16+ corresponding lines) Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1894 — Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1894-1910 | Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:1244-1259 | Packages/OsaurusCore/Storage/FileHistoryDatabase.swift:598-613 | Packages/OsaurusCore/Storage/MethodDatabase.swift:236-255 | Packages/OsaurusCore/Storage/RouterBillingDatabase.swift:354-370 | Packages/OsaurusCore/Storage/SchedulerDatabase.swift:635-650 | Packages/OsaurusCore/Storage/ToolDatabase.swift:321-338 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (61 corresponding lines) · ×1
  • Edited copy of a member (61 corresponding lines) Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:274 — Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:274-356 | Packages/OsaurusCore/Storage/MethodDatabase.swift:145-205 — These two members are one piece of code written twice and then edited apart: 61 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 18+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 18+ corresponding lines) Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:404 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:404-424 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:449-470 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:472-491 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelCustomJSONRunner.swift:520-537 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (7 members, 7+ corresponding lines) · ×1
  • Edited copies of one member (7 members, 7+ corresponding lines) Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:266 — Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:266-272 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:274-281 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:311-318 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:350-357 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:497-503 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:579-586 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:671-678 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 17+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 17+ corresponding lines) Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:982 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:982-998 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1000-1018 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1020-1038 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1040-1058 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelConnectionService.swift:1081-1099 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 12+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 12+ corresponding lines) Packages/OsaurusCore/AppleApps/Maps/MapsTools.swift:157 — Packages/OsaurusCore/AppleApps/Maps/MapsTools.swift:157-168 | Packages/OsaurusCore/AppleApps/Maps/MapsTools.swift:202-217 | Packages/OsaurusCore/AppleApps/Maps/MapsTools.swift:229-244 | Packages/OsaurusCore/AppleApps/Maps/MapsTools.swift:258-274 | Packages/OsaurusCore/AppleApps/Maps/MapsTools.swift:287-302 | Packages/OsaurusCore/AppleApps/Messages/MessagesTools.swift:88-102 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 20+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 20+ corresponding lines) Packages/OsaurusCore/Models/Configuration/MLXModel.swift:114 — Packages/OsaurusCore/Models/Configuration/MLXModel.swift:114-134 | Packages/OsaurusCore/Models/Configuration/MLXModel.swift:232-252 | Packages/OsaurusCore/Models/Configuration/MLXModel.swift:291-311 | Packages/OsaurusCore/Models/Configuration/MLXModel.swift:316-335 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 17+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 17+ corresponding lines) Packages/OsaurusCore/Services/AgentBridge/LocalAgentBridge.swift:212 — Packages/OsaurusCore/Services/AgentBridge/LocalAgentBridge.swift:212-228 | Packages/OsaurusCore/Services/AgentBridge/LocalAgentBridge.swift:250-266 | Packages/OsaurusCore/Services/AgentBridge/LocalAgentBridge.swift:335-351 | Packages/OsaurusCore/Services/AgentBridge/LocalAgentBridge.swift:356-372 | Packages/OsaurusCore/Services/AgentBridge/LocalAgentBridge.swift:374-390 | Packages/OsaurusCore/Services/AgentBridge/LocalAgentBridge.swift:392-413 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 9+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 9+ corresponding lines) Packages/OsaurusCore/Storage/ConfigHistoryDatabase.swift:417 — Packages/OsaurusCore/Storage/ConfigHistoryDatabase.swift:417-425 | Packages/OsaurusCore/Storage/EventRunDatabase.swift:488-496 | Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:416-424 | Packages/OsaurusCore/Storage/TaskDatabase.swift:663-671 | Packages/OsaurusCore/Storage/WorkflowRunDatabase.swift:274-282 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (7 members, 6+ corresponding lines) · ×1
  • Edited copies of one member (7 members, 6+ corresponding lines) Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:359 — Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:359-365 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:505-510 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:611-616 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:618-623 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:680-685 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:704-709 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:807-812 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 13+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 13+ corresponding lines) Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1129 — Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:1129-1148 | Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:735-754 | Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:1026-1045 | Packages/OsaurusCore/Storage/MethodDatabase.swift:325-337 | Packages/OsaurusCore/Storage/ToolDatabase.swift:387-399 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (7 members, 13+ corresponding lines) · ×1
  • Edited copies of one member (7 members, 13+ corresponding lines) Packages/OsaurusCore/Models/AgentChannel/AgentChannelConfiguration.swift:1076 — Packages/OsaurusCore/Models/AgentChannel/AgentChannelConfiguration.swift:1076-1089 | Packages/OsaurusCore/Models/Discord/DiscordConnectionConfiguration.swift:120-132 | Packages/OsaurusCore/Models/Email/EmailChannelConfiguration.swift:298-311 | Packages/OsaurusCore/Models/IMessage/IMessageConnectionConfiguration.swift:293-305 | Packages/OsaurusCore/Models/Slack/SlackConnectionConfiguration.swift:236-248 | Packages/OsaurusCore/Models/Telegram/TelegramConnectionConfiguration.swift:202-214 | Packages/OsaurusCore/Models/WhatsApp/WhatsAppConnectionConfiguration.swift:249-261 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 6+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 6+ corresponding lines) Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:1960 — Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:1960-1966 | Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:1995-2001 | Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:2028-2034 | Packages/OsaurusCore/Services/Chat/AgentToolLoop.swift:2036-2042 | Packages/OsaurusCore/Services/Context/SubagentJobEvaluator.swift:1190-1196 | Packages/OsaurusCore/Tools/Handoff/ConfiguratorHandoffTool.swift:250-255 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (7 members, 9+ corresponding lines) · ×1
  • Edited copies of one member (7 members, 9+ corresponding lines) Packages/OsaurusCore/AppleApps/Calendar/CalendarTools.swift:395 — Packages/OsaurusCore/AppleApps/Calendar/CalendarTools.swift:395-407 | Packages/OsaurusCore/AppleApps/Contacts/ContactsTools.swift:270-282 | Packages/OsaurusCore/AppleApps/Contacts/ContactsTools.swift:364-376 | Packages/OsaurusCore/AppleApps/Notes/NotesTools.swift:127-135 | Packages/OsaurusCore/AppleApps/Notes/NotesTools.swift:196-206 | Packages/OsaurusCore/AppleApps/Reminders/RemindersTools.swift:275-287 | Packages/OsaurusCore/AppleApps/Reminders/RemindersTools.swift:301-313 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (45 corresponding lines) · ×1
  • Edited copy of a member (45 corresponding lines) Packages/OsaurusCore/Storage/AgentDatabase.swift:506 — Packages/OsaurusCore/Storage/AgentDatabase.swift:506-554 | Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:320-364 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 14+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 14+ corresponding lines) Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:697 — Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:697-712 | Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1110-1124 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:1067-1080 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1214-1228 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 8+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 8+ corresponding lines) Packages/OsaurusCore/Services/Router/OsaurusRouterSupportTypes.swift:198 — Packages/OsaurusCore/Services/Router/OsaurusRouterSupportTypes.swift:198-205 | Packages/OsaurusCore/Tools/Database/SchedulerTools.swift:23-30 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReviewReport.swift:994-1002 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalScoreboard.swift:895-903 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 15+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 15+ corresponding lines) Packages/OsaurusCore/Models/Documents/CSVDocument.swift:43 — Packages/OsaurusCore/Models/Documents/CSVDocument.swift:43-61 | Packages/OsaurusCore/Models/Documents/PDFDocumentRepresentation.swift:62-76 | Packages/OsaurusCore/Models/Documents/PDFDocumentRepresentation.swift:106-120 | Packages/OsaurusCore/Models/Documents/PresentationDocument.swift:111-125 | Packages/OsaurusCore/Models/Documents/PresentationDocument.swift:218-232 | Packages/OsaurusCore/Models/Documents/Workbook.swift:77-93 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (8 members, 7+ corresponding lines) · ×1
  • Edited copies of one member (8 members, 7+ corresponding lines) Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:147 — Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:147-153 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:340-346 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:435-442 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:540-546 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:644-650 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:652-659 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:661-668 | Packages/OsaurusCore/PrivacyFilter/Core/PrivacyChecksums.swift:835-841 — These 8 members are one piece of code written 8 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 8 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 16+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 16+ corresponding lines) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:211 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:211-226 | Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:218-233 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:238-253 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:229-244 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 5+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 5+ corresponding lines) Packages/OsaurusCore/Services/Channels/ChannelSecurityDiagnostics.swift:96 — Packages/OsaurusCore/Services/Channels/ChannelSecurityDiagnostics.swift:96-109 | Packages/OsaurusCore/Services/MCP/MCPProviderProbeService.swift:166-170 | Packages/OsaurusCore/Services/Provider/OpenAICodexOAuthService.swift:754-758 | Packages/OsaurusCore/Services/Provider/ProviderReplayDiagnostics.swift:261-269 | Packages/OsaurusCore/Services/Provider/XAIOAuthService.swift:476-480 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 4+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 4+ corresponding lines) Packages/OsaurusCore/Services/Attention/Participant.swift:227 — Packages/OsaurusCore/Services/Attention/Participant.swift:227-230 | Packages/OsaurusCore/Services/Router/OsaurusRouterWorkspaceTypes.swift:236-239 | Packages/OsaurusCore/Services/Router/SharedAgentIdentity.swift:107-110 | Packages/OsaurusCore/Services/Sync/SyncStatusModel.swift:446-450 | Packages/OsaurusCore/Views/Insights/InsightsDetailPane.swift:202-205 | Packages/OsaurusCore/Views/Settings/OsaurusConnectView.swift:267-270 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (8 members, 4+ corresponding lines) · ×1
  • Edited copies of one member (8 members, 4+ corresponding lines) Packages/OsaurusCore/Views/Settings/AgentChannelCustomConnectionSheet.swift:213 — Packages/OsaurusCore/Views/Settings/AgentChannelCustomConnectionSheet.swift:213-216 | Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:228-231 | Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:235-238 | Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:242-245 | Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:388-391 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:255-258 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:246-249 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:245-248 — These 8 members are one piece of code written 8 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 8 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (7 members, 1+ corresponding lines) · ×1
  • Edited copies of one member (7 members, 1+ corresponding lines) Packages/OsaurusCore/Identity/IdentityModels.swift:235 — Packages/OsaurusCore/Identity/IdentityModels.swift:235-237 | Packages/OsaurusCore/Services/Attention/CallerDeclaration.swift:43-45 | Packages/OsaurusCore/Services/Attention/ConversationMailbox.swift:101-101 | Packages/OsaurusCore/Services/Auth/OwnerDeviceAccessHost.swift:37-39 | Packages/OsaurusCore/Services/Keychain/SourceCredentialVault.swift:22-24 | Packages/OsaurusCore/Services/Router/InvitePeerIdentityStore.swift:17-19 | Packages/OsaurusCore/Services/Router/WorkspaceMembershipAttestation.swift:173-175 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 1 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 1+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 1+ corresponding lines) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:98 — Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:98-100 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelN8nPendingContactCenter.swift:47-49 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelTransportHealth.swift:186-188 | Packages/OsaurusCore/Services/FavoriteModelsStore.swift:125-129 | Packages/OsaurusCore/Services/FileHistory/FileChangeJournal.swift:654-654 | Packages/OsaurusCore/Services/Workflow/SavedAnswersStore.swift:65-65 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 1 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (61–63 lines × 2) · ×1
  • Duplicated block (61–63 lines × 2) Packages/OsaurusCore/Services/Chat/ChatEngine.swift:1974 — Packages/OsaurusCore/Services/Chat/ChatEngine.swift:1974-2036 | Packages/OsaurusCore/Services/Chat/ChatEngine.swift:2144-2204 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Chat/ChatEngine.swift:1974` 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 (59 lines × 2) · ×1
  • Duplicated block (59 lines × 2) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsCreate.swift:137 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsCreate.swift:137-195 | Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsCreate.swift:615-673 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsCreate.swift:615` 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 (53 lines × 2) · ×1
  • Duplicated block (53 lines × 2) Packages/OsaurusCore/Services/ModelRuntime.swift:4865 — Packages/OsaurusCore/Services/ModelRuntime.swift:4865-4917 | Packages/OsaurusCore/Services/ModelRuntime.swift:4967-5019 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/ModelRuntime.swift:4865` 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 (52 lines × 2) · ×1
  • Duplicated block (52 lines × 2) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:602 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:602-653 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:822-873 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 680 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 (34–51 lines × 2) · ×1
  • Duplicated block (34–51 lines × 2) Packages/OsaurusCore/Storage/MemoryDatabase.swift:740 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:740-790 | Packages/OsaurusCore/Storage/MethodDatabase.swift:166-199 — 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 `Packages/OsaurusCore/Storage/MemoryDatabase.swift:740` 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, `Packages/OsaurusCore/Storage/MemoryDatabase.swift:792` calls `DEFAULT`, `datetime` and `Packages/OsaurusCore/Storage/MethodDatabase.swift:199` 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 (47–49 lines × 2) · ×1
  • Duplicated block (47–49 lines × 2) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:1114 — Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:1114-1162 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:1675-1721 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:1114` 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 (46 lines × 2) · ×1
  • Duplicated block (46 lines × 2) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:132 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:132-177 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:150-195 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 368 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 `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:132` 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 (45 lines × 2) · ×1
  • Duplicated block (45 lines × 2) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:553 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:553-597 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:773-817 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 680 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 (43–44 lines × 2) · ×1
  • Duplicated block (43–44 lines × 2) Packages/OsaurusCore/Services/ModelRuntime.swift:4919 — Packages/OsaurusCore/Services/ModelRuntime.swift:4919-4962 | Packages/OsaurusCore/Services/ModelRuntime.swift:5021-5063 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/ModelRuntime.swift:4919` 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 (42–43 lines × 2) · ×1
  • Duplicated block (42–43 lines × 2) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsCreate.swift:519 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsCreate.swift:519-561 | Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsCreate.swift:901-942 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (36–41 lines × 2) · ×1
  • Duplicated block (36–41 lines × 2) Packages/OsaurusCore/AppleScript/Exec/AppleScriptExecutor.swift:385 — Packages/OsaurusCore/AppleScript/Exec/AppleScriptExecutor.swift:385-425 | Packages/OsaurusCore/AppleScript/Exec/AppleScriptExecutor.swift:448-483 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/AppleScript/Exec/AppleScriptExecutor.swift:385` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Packages/OsaurusCore/AppleScript/Exec/AppleScriptExecutor.swift:446` calls `OSAScript` and `Packages/OsaurusCore/AppleScript/Exec/AppleScriptExecutor.swift:383` 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 (38 lines × 2) · ×1
  • Duplicated block (38 lines × 2) Packages/OsaurusCore/Tools/AgentChannelTools.swift:111 — Packages/OsaurusCore/Tools/AgentChannelTools.swift:111-148 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:183-220 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/AgentChannelTools.swift:111` 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 (35–38 lines × 2) · ×1
  • Duplicated block (35–38 lines × 2) Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:673 — Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:673-710 | Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:942-976 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:673` 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 (36 lines × 3) · ×1
  • Duplicated block (36 lines × 3) Packages/OsaurusCore/Models/Agent/Skill.swift:126 — Packages/OsaurusCore/Models/Agent/Skill.swift:126-161 | Packages/OsaurusCore/Models/Agent/Skill.swift:293-328 | Packages/OsaurusCore/Models/Agent/Skill.swift:382-417 — 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 `Packages/OsaurusCore/Models/Agent/Skill.swift:126` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (34–36 lines × 2) · ×1
  • Duplicated block (34–36 lines × 2) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerMemory.swift:129 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerMemory.swift:129-162 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerReasoningChannel.swift:190-225 — before extracting anything, compare `Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerMemory.swift` and `Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerReasoningChannel.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 55 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 `Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerMemory.swift:129` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (22–35 lines × 2) · ×1
  • Duplicated block (22–35 lines × 2) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:1245 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:1245-1266 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:1399-1433 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:1245` 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 (16–34 lines × 8) · ×1
  • Duplicated block (16–34 lines × 8) Packages/OsaurusCore/Models/Agent/Skill.swift:153 — Packages/OsaurusCore/Models/Agent/Skill.swift:153-168 | Packages/OsaurusCore/Models/Agent/Skill.swift:199-214 | Packages/OsaurusCore/Models/Agent/Skill.swift:238-253 | Packages/OsaurusCore/Models/Agent/Skill.swift:258-291 | Packages/OsaurusCore/Models/Agent/Skill.swift:320-335 | Packages/OsaurusCore/Models/Agent/Skill.swift:365-380 | Packages/OsaurusCore/Models/Agent/Skill.swift:409-424 | Packages/OsaurusCore/Models/Agent/Skill.swift:429-461 — all 8 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 `Packages/OsaurusCore/Models/Agent/Skill.swift:153` 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 (32–34 lines × 2) · ×1
  • Duplicated block (32–34 lines × 2) Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:652 — Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:652-683 | Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift:337-370 — before extracting anything, compare `Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift` and `Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 146 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 `Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:652` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (31–33 lines × 2) · ×1
  • Duplicated block (31–33 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:9607 — Packages/OsaurusCore/Networking/HTTPHandler.swift:9607-9637 | Packages/OsaurusCore/Networking/HTTPHandler.swift:9853-9885 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:9607` 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 (87 lines × 2) · ×1
  • Duplicated block (87 lines × 2) Packages/OsaurusCore/Views/Event/EventFormComponents.swift:632 — Packages/OsaurusCore/Views/Event/EventFormComponents.swift:632-718 | Packages/OsaurusCore/Views/Event/EventFormComponents.swift:1041-1127 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (31 lines × 2) · ×1
  • Duplicated block (31 lines × 2) Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:255 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Pull.swift:255-285 | Packages/OsaurusCore/Services/HuggingFaceService.swift:964-994 — 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 (29–31 lines × 2) · ×1
  • Duplicated block (29–31 lines × 2) Packages/OsaurusCore/Services/Inference/FoundationModelService.swift:336 — Packages/OsaurusCore/Services/Inference/FoundationModelService.swift:336-366 | Packages/OsaurusCore/Services/Inference/FoundationModelService.swift:534-562 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Inference/FoundationModelService.swift:336` 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, `Packages/OsaurusCore/Services/Inference/FoundationModelService.swift:533` calls `LanguageModelSession`, `makeStream` and `Packages/OsaurusCore/Services/Inference/FoundationModelService.swift:336` 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 (20–29 lines × 3) · ×1
  • Duplicated block (20–29 lines × 3) Packages/OsaurusCore/Services/Method/MethodSearchService.swift:57 — Packages/OsaurusCore/Services/Method/MethodSearchService.swift:57-76 | Packages/OsaurusCore/Services/Skill/SkillSearchService.swift:82-101 | Packages/OsaurusCore/Services/Tool/ToolSearchService.swift:179-207 — before extracting anything, compare `Packages/OsaurusCore/Services/Method/MethodSearchService.swift` and `Packages/OsaurusCore/Services/Skill/SkillSearchService.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 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 `Packages/OsaurusCore/Services/Method/MethodSearchService.swift:57` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Services/Tool/ToolSearchService.swift:209` calls `processPendingIndexEntries` and `Packages/OsaurusCore/Services/Method/MethodSearchService.swift:78` 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 (28 lines × 4) · ×1
  • Duplicated block (28 lines × 4) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:122 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:122-149 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:127-154 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:131-158 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:131-158 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:122` 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 (27 lines × 3) · ×1
  • Duplicated block (27 lines × 3) Packages/OsaurusCore/Subagent/SubagentSession.swift:730 — Packages/OsaurusCore/Subagent/SubagentSession.swift:730-756 | Packages/OsaurusCore/Subagent/SubagentSession.swift:769-795 | Packages/OsaurusCore/Subagent/SubagentSession.swift:969-995 — 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 `Packages/OsaurusCore/Subagent/SubagentSession.swift:730` 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 (25–27 lines × 2) · ×1
  • Duplicated block (25–27 lines × 2) Packages/OsaurusCore/ComputerUse/Driver/Mac/BackgroundDriver.swift:458 — Packages/OsaurusCore/ComputerUse/Driver/Mac/BackgroundDriver.swift:458-484 | Packages/OsaurusCore/ComputerUse/Driver/Mac/InputController.swift:185-209 — 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 `Packages/OsaurusCore/ComputerUse/Driver/Mac/BackgroundDriver.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.
D4 · Code Duplication · Duplicated block (26–27 lines × 2) · ×1
  • Duplicated block (26–27 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:681 — Packages/OsaurusCore/Networking/HTTPHandler.swift:681-707 | Packages/OsaurusCore/Networking/HTTPHandler.swift:743-768 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:743` 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 (20–27 lines × 2) · ×1
  • Duplicated block (20–27 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:13659 — Packages/OsaurusCore/Networking/HTTPHandler.swift:13659-13685 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14418-14437 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:13659` 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 (24–26 lines × 2) · ×1
  • Duplicated block (24–26 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:18270 — Packages/OsaurusCore/Networking/HTTPHandler.swift:18270-18295 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18301-18324 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:18270` 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 (22–26 lines × 2) · ×1
  • Duplicated block (22–26 lines × 2) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:137 — Packages/OsaurusCore/Views/Plugin/PluginsView.swift:137-162 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:2482-2503 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (22–25 lines × 7) · ×1
  • Duplicated block (22–25 lines × 7) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:928 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:928-952 | Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:849-870 | Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1287-1311 | Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:1735-1759 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:1241-1265 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:1116-1140 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1391-1415 — 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 7 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:1735` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `timedOutWaitingForMore` to `Bool = false` in one and `Bool` 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 (24–25 lines × 3) · ×1
  • Duplicated block (24–25 lines × 3) Packages/OsaurusCore/Views/Settings/ArchitectSettingsView.swift:40 — Packages/OsaurusCore/Views/Settings/ArchitectSettingsView.swift:40-63 | Packages/OsaurusCore/Views/Settings/ConfiguratorSettingsView.swift:41-64 | Packages/OsaurusCore/Views/Settings/OrchestratorSettingsView.swift:52-76 — 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 `Packages/OsaurusCore/Views/Settings/ArchitectSettingsView.swift:40` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Packages/OsaurusCore/Views/Settings/ConfiguratorSettingsView.swift:40` calls `ConfigHistorySection` and `Packages/OsaurusCore/Views/Settings/ArchitectSettingsView.swift:39` 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 (25 lines × 3) · ×1
  • Duplicated block (25 lines × 3) Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:132 — Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:132-156 | Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:140-164 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:149-173 — 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 `Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:132` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (24–25 lines × 2) · ×1
  • Duplicated block (24–25 lines × 2) Packages/OsaurusCore/Services/Chat/ChatEngine.swift:2040 — Packages/OsaurusCore/Services/Chat/ChatEngine.swift:2040-2063 | Packages/OsaurusCore/Services/Chat/ChatEngine.swift:2067-2091 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Chat/ChatEngine.swift:2040` 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 (21–25 lines × 2) · ×1
  • Duplicated block (21–25 lines × 2) Packages/OsaurusCore/Storage/MemoryDatabase.swift:2396 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:2396-2416 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2420-2444 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (20–25 lines × 2) · ×1
  • Duplicated block (20–25 lines × 2) Packages/OsaurusCore/Subagent/Kinds/TextSubagentKind.swift:1325 — Packages/OsaurusCore/Subagent/Kinds/TextSubagentKind.swift:1325-1349 | Packages/OsaurusCore/Subagent/Kinds/TextSubagentKind.swift:1415-1434 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Subagent/Kinds/TextSubagentKind.swift:1325` 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 (18–24 lines × 3) · ×1
  • Duplicated block (18–24 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:13670 — Packages/OsaurusCore/Networking/HTTPHandler.swift:13670-13693 | Packages/OsaurusCore/Networking/HTTPHandler.swift:13708-13725 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14427-14444 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (23–24 lines × 2) · ×1
  • Duplicated block (23–24 lines × 2) Packages/OsaurusCore/Services/LocalGenerationDefaults.swift:257 — Packages/OsaurusCore/Services/LocalGenerationDefaults.swift:257-279 | Packages/OsaurusCore/Services/LocalGenerationDefaults.swift:394-417 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/LocalGenerationDefaults.swift:257` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (21–24 lines × 2) · ×1
  • Duplicated block (21–24 lines × 2) Packages/OsaurusCore/Tools/SandboxSecretTools.swift:38 — Packages/OsaurusCore/Tools/SandboxSecretTools.swift:38-58 | Packages/OsaurusCore/Tools/SandboxSecretTools.swift:149-172 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/SandboxSecretTools.swift:38` 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 (20–24 lines × 2) · ×1
  • Duplicated block (20–24 lines × 2) Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:582 — Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:582-601 | Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift:288-311 — before extracting anything, compare `Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift` and `Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 146 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 (22–24 lines × 2) · ×1
  • Duplicated block (22–24 lines × 2) Packages/OsaurusCore/Views/Management/SharedSidebarComponents.swift:77 — Packages/OsaurusCore/Views/Management/SharedSidebarComponents.swift:77-100 | Packages/OsaurusCore/Views/Management/SharedSidebarComponents.swift:143-164 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Management/SharedSidebarComponents.swift:77` 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 (17–23 lines × 2) · ×1
  • Duplicated block (17–23 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:2149 — Packages/OsaurusCore/Networking/HTTPHandler.swift:2149-2165 | Packages/OsaurusCore/Networking/HTTPHandler.swift:2183-2205 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:2149` 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 (12–23 lines × 2) · ×1
  • Duplicated block (12–23 lines × 2) Packages/OsaurusCore/Views/Chat/NativeBlockViews.swift:961 — Packages/OsaurusCore/Views/Chat/NativeBlockViews.swift:961-972 | Packages/OsaurusCore/Views/Chat/NativeMarkdownView.swift:1622-1644 — 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 `Packages/OsaurusCore/Views/Chat/NativeBlockViews.swift:961` 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 (22 lines × 3) · ×1
  • Duplicated block (22 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:6409 — Packages/OsaurusCore/Networking/HTTPHandler.swift:6409-6430 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8454-8475 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8478-8499 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:6409` 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 (18–22 lines × 3) · ×1
  • Duplicated block (18–22 lines × 3) Packages/OsaurusCore/Tools/KnowledgeWriteTools.swift:142 — Packages/OsaurusCore/Tools/KnowledgeWriteTools.swift:142-163 | Packages/OsaurusCore/Tools/KnowledgeWriteTools.swift:496-515 | Packages/OsaurusCore/Tools/KnowledgeWriteTools.swift:836-853 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (19–22 lines × 2) · ×1
  • Duplicated block (19–22 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:15327 — Packages/OsaurusCore/Networking/HTTPHandler.swift:15327-15345 | Packages/OsaurusCore/Networking/HTTPHandler.swift:15351-15372 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:15327` 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 (16–22 lines × 2) · ×1
  • Duplicated block (16–22 lines × 2) Packages/OsaurusCore/Subagent/SubagentSession.swift:947 — Packages/OsaurusCore/Subagent/SubagentSession.swift:947-968 | Packages/OsaurusCore/Subagent/SubagentSession.swift:1082-1097 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Subagent/SubagentSession.swift:947` 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 (20–22 lines × 2) · ×1
  • Duplicated block (20–22 lines × 2) Packages/OsaurusCore/Views/Common/SimpleComponents.swift:117 — Packages/OsaurusCore/Views/Common/SimpleComponents.swift:117-136 | Packages/OsaurusCore/Views/Common/SimpleComponents.swift:187-208 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Common/SimpleComponents.swift:117` 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 (18–22 lines × 2) · ×1
  • Duplicated block (18–22 lines × 2) Packages/OsaurusCore/Views/Plugin/PluginsView.swift:731 — Packages/OsaurusCore/Views/Plugin/PluginsView.swift:731-752 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:2429-2446 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Plugin/PluginsView.swift:731` 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 (16–21 lines × 2) · ×1
  • Duplicated block (16–21 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:9963 — Packages/OsaurusCore/Networking/HTTPHandler.swift:9963-9978 | Packages/OsaurusCore/Networking/HTTPHandler.swift:10068-10088 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:9963` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (20–21 lines × 2) · ×1
  • Duplicated block (20–21 lines × 2) Packages/OsaurusCore/Storage/AgentDatabase.swift:928 — Packages/OsaurusCore/Storage/AgentDatabase.swift:928-947 | Packages/OsaurusCore/Storage/AgentDatabase.swift:1010-1030 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Storage/AgentDatabase.swift:928` 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 (13–21 lines × 2) · ×1
  • Duplicated block (13–21 lines × 2) Packages/OsaurusCore/Tools/SandboxSecretTools.swift:220 — Packages/OsaurusCore/Tools/SandboxSecretTools.swift:220-240 | Packages/OsaurusCore/Tools/SandboxSecretTools.swift:266-278 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/SandboxSecretTools.swift:220` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (18–21 lines × 2) · ×1
  • Duplicated block (18–21 lines × 2) Packages/OsaurusCore/Views/Settings/ProvidersView.swift:865 — Packages/OsaurusCore/Views/Settings/ProvidersView.swift:865-882 | Packages/OsaurusCore/Views/Settings/ProvidersView.swift:901-921 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (14–20 lines × 5) · ×1
  • Duplicated block (14–20 lines × 5) Packages/OsaurusCore/Networking/HTTPHandler.swift:6897 — Packages/OsaurusCore/Networking/HTTPHandler.swift:6897-6916 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7051-7070 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7799-7818 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7979-7998 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8061-8074 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:6897` 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 (19–20 lines × 4) · ×1
  • Duplicated block (19–20 lines × 4) Packages/OsaurusCore/Networking/HTTPHandler.swift:1839 — Packages/OsaurusCore/Networking/HTTPHandler.swift:1839-1858 | Packages/OsaurusCore/Networking/HTTPHandler.swift:1910-1929 | Packages/OsaurusCore/Networking/HTTPHandler.swift:2050-2068 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16886-16905 — 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 (15–20 lines × 2) · ×1
  • Duplicated block (15–20 lines × 2) Packages/OsaurusCore/Folder/FolderTools.swift:2897 — Packages/OsaurusCore/Folder/FolderTools.swift:2897-2916 | Packages/OsaurusCore/Folder/FolderTools.swift:3822-3836 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Folder/FolderTools.swift:2897` 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 (10–20 lines × 2) · ×1
  • Duplicated block (10–20 lines × 2) Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:2174 — Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:2174-2183 | Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:2253-2272 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Plugin/PluginHostAPI.swift:2174` 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 (19–20 lines × 2) · ×1
  • Duplicated block (19–20 lines × 2) Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:1020 — Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:1020-1039 | Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:1659-1677 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/Database/DatabaseTools.swift:1020` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–20 lines × 2) · ×1
  • Duplicated block (14–20 lines × 2) Packages/OsaurusCore/Views/Chat/ClarifyPromptOverlay.swift:293 — Packages/OsaurusCore/Views/Chat/ClarifyPromptOverlay.swift:293-312 | Packages/OsaurusCore/Views/Model/ModelDetailView.swift:1604-1617 — 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–19 lines × 5) · ×1
  • Duplicated block (13–19 lines × 5) Packages/OsaurusCore/Networking/HTTPHandler.swift:10260 — Packages/OsaurusCore/Networking/HTTPHandler.swift:10260-10278 | Packages/OsaurusCore/Networking/HTTPHandler.swift:13587-13599 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16962-16980 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17070-17088 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17405-17423 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:10260` 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 (19 lines × 4) · ×1
  • Duplicated block (19 lines × 4) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:145 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:145-163 | Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:146-164 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:159-177 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:163-181 — 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 `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:145` 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 (19 lines × 3) · ×1
  • Duplicated block (19 lines × 3) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1073 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1073-1091 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:801-819 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1169-1187 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 237 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 (17–19 lines × 3) · ×1
  • Duplicated block (17–19 lines × 3) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1144 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1144-1160 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:876-894 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1248-1264 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 237 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 `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1144` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9–19 lines × 3) · ×1
  • Duplicated block (9–19 lines × 3) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerComputerUseLoop.swift:201 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerComputerUseLoop.swift:201-219 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:629-637 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:766-774 — 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 `Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerComputerUseLoop.swift:201` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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–19 lines × 2) · ×1
  • Duplicated block (11–19 lines × 2) Packages/OsaurusCore/Managers/MCPProviderManager.swift:1593 — Packages/OsaurusCore/Managers/MCPProviderManager.swift:1593-1611 | Packages/OsaurusCore/Services/MCP/MCPProviderProbeService.swift:409-419 — 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 `Packages/OsaurusCore/Managers/MCPProviderManager.swift:1593` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (4–19 lines × 4) · ×1
  • Duplicated block (4–19 lines × 4) Packages/OsaurusCore/Networking/HTTPHandler.swift:15177 — Packages/OsaurusCore/Networking/HTTPHandler.swift:15177-15180 | Packages/OsaurusCore/Networking/HTTPHandler.swift:15776-15779 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18188-18206 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18943-18961 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:18188` 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, `Packages/OsaurusCore/Networking/HTTPHandler.swift:15779` calls `HTTPHeaders` and `Packages/OsaurusCore/Networking/HTTPHandler.swift:15180` does not — after which the two agree again for 5 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (16–19 lines × 2) · ×1
  • Duplicated block (16–19 lines × 2) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:1092 — Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:1092-1110 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:1656-1671 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:1092` 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 (18 lines × 6) · ×1
  • Duplicated block (18 lines × 6) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:973 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:973-990 | Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:884-901 | Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1328-1345 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:1294-1311 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:1017-1034 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1432-1449 — 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 6 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (17–18 lines × 4) · ×1
  • Duplicated block (17–18 lines × 4) Packages/OsaurusCore/Subagent/SubagentSession.swift:685 — Packages/OsaurusCore/Subagent/SubagentSession.swift:685-701 | Packages/OsaurusCore/Subagent/SubagentSession.swift:845-861 | Packages/OsaurusCore/Subagent/SubagentSession.swift:912-929 | Packages/OsaurusCore/Subagent/SubagentSession.swift:1034-1051 — 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 `Packages/OsaurusCore/Subagent/SubagentSession.swift:685` 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 (16–18 lines × 3) · ×1
  • Duplicated block (16–18 lines × 3) Packages/OsaurusCore/Views/Chat/ChatHistoryPane.swift:1087 — Packages/OsaurusCore/Views/Chat/ChatHistoryPane.swift:1087-1102 | Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:3501-3518 | Packages/OsaurusCore/Views/Chat/ChatTabStripView.swift:1044-1061 — 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 `Packages/OsaurusCore/Views/Chat/ChatHistoryPane.swift:1087` 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 (25–30 lines × 2) · ×1
  • Duplicated block (25–30 lines × 2) Packages/OsaurusCore/Models/Theme/CustomTheme.swift:348 — Packages/OsaurusCore/Models/Theme/CustomTheme.swift:348-377 | Packages/OsaurusCore/Models/Theme/Theme.swift:812-836 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (13–18 lines × 2) · ×1
  • Duplicated block (13–18 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:2352 — Packages/OsaurusCore/Networking/HTTPHandler.swift:2352-2369 | Packages/OsaurusCore/Networking/HTTPHandler.swift:2672-2684 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:2352` 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 (9–18 lines × 2) · ×1
  • Duplicated block (9–18 lines × 2) Packages/OsaurusCore/Views/Chat/ClarifyPromptOverlay.swift:343 — Packages/OsaurusCore/Views/Chat/ClarifyPromptOverlay.swift:343-360 | Packages/OsaurusCore/Views/Model/ModelDetailView.swift:1642-1650 — 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 `Packages/OsaurusCore/Views/Chat/ClarifyPromptOverlay.swift:343` 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–18 lines × 2) · ×1
  • Duplicated block (14–18 lines × 2) Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:396 — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:396-409 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:366-383 — before extracting anything, compare `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift` and `Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 680 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 (16–17 lines × 5) · ×1
  • Duplicated block (16–17 lines × 5) Packages/OsaurusCore/Networking/HTTPHandler.swift:1837 — Packages/OsaurusCore/Networking/HTTPHandler.swift:1837-1853 | Packages/OsaurusCore/Networking/HTTPHandler.swift:1908-1924 | Packages/OsaurusCore/Networking/HTTPHandler.swift:2048-2063 | Packages/OsaurusCore/Networking/HTTPHandler.swift:2249-2264 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16884-16900 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:1837` 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–17 lines × 4) · ×1
  • Duplicated block (15–17 lines × 4) Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:729 — Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:729-743 | Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1142-1158 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:874-890 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:1246-1262 — 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. 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, `Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1160` calls `diagnostics` and `Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:745` 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 (13–17 lines × 3) · ×1
  • Duplicated block (13–17 lines × 3) Packages/OsaurusCore/Models/Event/ScheduleTiming.swift:121 — Packages/OsaurusCore/Models/Event/ScheduleTiming.swift:121-133 | Packages/OsaurusCore/Models/Schedule/Schedule.swift:700-716 | Packages/OsaurusCore/Models/Schedule/ScheduleRunHistory.swift:323-337 — 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 `Packages/OsaurusCore/Models/Event/ScheduleTiming.swift:121` 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 (10–17 lines × 2) · ×1
  • Duplicated block (10–17 lines × 2) Packages/OsaurusCore/Models/Chat/ContentBlock.swift:977 — Packages/OsaurusCore/Models/Chat/ContentBlock.swift:977-986 | Packages/OsaurusCore/Models/Chat/ContentBlock.swift:998-1014 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Models/Chat/ContentBlock.swift:998` 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 (29–30 lines × 2) · ×1
  • Duplicated block (29–30 lines × 2) Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:508 — Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:508-537 | Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:599-627 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:506` calls `bump` and `Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift:597` 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–17 lines × 2) · ×1
  • Duplicated block (11–17 lines × 2) Packages/OsaurusCore/Views/Chat/ClarifyPromptOverlay.swift:325 — Packages/OsaurusCore/Views/Chat/ClarifyPromptOverlay.swift:325-341 | Packages/OsaurusCore/Views/Model/ModelDetailView.swift:1630-1640 — 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 `Packages/OsaurusCore/Views/Chat/ClarifyPromptOverlay.swift:325` 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 (13–17 lines × 2) · ×1
  • Duplicated block (13–17 lines × 2) Packages/OsaurusCore/Views/Chat/EditableTextView.swift:113 — Packages/OsaurusCore/Views/Chat/EditableTextView.swift:113-129 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:1445-1457 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (16 lines × 6) · ×1
  • Duplicated block (16 lines × 6) Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:128 — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:128-143 | Packages/OsaurusCore/Views/Settings/EmailSettingsView.swift:129-144 | Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:137-152 | Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift:142-157 | Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift:146-161 | Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift:146-161 — 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 6 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:128` 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 (16 lines × 5) · ×1
  • Duplicated block (16 lines × 5) Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:766 — Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:766-781 | Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:537-552 | Packages/OsaurusCore/Services/Slack/SlackConnectionService.swift:1093-1108 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:852-867 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:636-651 — 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 `Packages/OsaurusCore/Services/Discord/DiscordConnectionService.swift:766` 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 (16 lines × 4) · ×1
  • Duplicated block (16 lines × 4) Packages/OsaurusCore/Networking/HTTPHandler.swift:6974 — Packages/OsaurusCore/Networking/HTTPHandler.swift:6974-6989 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7115-7130 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7693-7708 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7872-7887 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:6974` 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 (13–16 lines × 4) · ×1
  • Duplicated block (13–16 lines × 4) Packages/OsaurusCore/Storage/MemoryDatabase.swift:1503 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:1503-1518 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:1537-1549 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:1921-1933 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:1952-1964 — 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 `Packages/OsaurusCore/Storage/MemoryDatabase.swift:1503` 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 (12–16 lines × 4) · ×1
  • Duplicated block (12–16 lines × 4) Packages/OsaurusCore/Storage/MemoryDatabase.swift:1627 — Packages/OsaurusCore/Storage/MemoryDatabase.swift:1627-1638 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:1655-1666 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:1672-1687 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:1698-1713 — 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 `Packages/OsaurusCore/Storage/MemoryDatabase.swift:1627` 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 (5–16 lines × 3) · ×1
  • Duplicated block (5–16 lines × 3) Packages/OsaurusCore/Services/Documents/WorkbookWorkflowService.swift:598 — Packages/OsaurusCore/Services/Documents/WorkbookWorkflowService.swift:598-613 | Packages/OsaurusCore/Services/Documents/XLSXAdapter.swift:867-871 | Packages/OsaurusCore/Services/Documents/XLSXEmitter.swift:335-348 — 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 `Packages/OsaurusCore/Services/Documents/WorkbookWorkflowService.swift:598` 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 (14–15 lines × 3) · ×1
  • Duplicated block (14–15 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:4750 — Packages/OsaurusCore/Networking/HTTPHandler.swift:4750-4763 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17470-17483 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17525-17539 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:4750` 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 (12–15 lines × 3) · ×1
  • Duplicated block (12–15 lines × 3) Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:455 — Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:455-469 | Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:503-517 | Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:546-557 — 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 `Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:455` 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, `Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:470` calls `sqlite3_bind_int`, `Int32` and `Packages/OsaurusCore/Services/Memory/MemoryManagementConsoleService.swift:558` 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–15 lines × 2) · ×1
  • Duplicated block (12–15 lines × 2) Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:1330 — Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:1330-1341 | Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:1368-1382 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:1330` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8–15 lines × 2) · ×1
  • Duplicated block (8–15 lines × 2) Packages/OsaurusCore/Views/Settings/AgentChannelSettingsComponents.swift:118 — Packages/OsaurusCore/Views/Settings/AgentChannelSettingsComponents.swift:118-132 | Packages/OsaurusCore/Views/Settings/ChannelsOverviewTable.swift:346-353 — 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 `Packages/OsaurusCore/Views/Settings/AgentChannelSettingsComponents.swift:118` 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 (2–14 lines × 22) · ×1
  • Duplicated block (2–14 lines × 22) Packages/OsaurusCore/Browser/Tool/BrowserUseTool.swift:83 — Packages/OsaurusCore/Browser/Tool/BrowserUseTool.swift:83-96 | Packages/OsaurusCore/ComputerUse/Tool/ComputerUseTool.swift:127-135 | Packages/OsaurusCore/Folder/FileCopyTool.swift:90-98 | Packages/OsaurusCore/Folder/FolderTools.swift:2767-2775 | Packages/OsaurusCore/Folder/PromptWorkingFolderTool.swift:135-148 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1548-1550 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1554-1555 | Packages/OsaurusCore/Tools/AgentLoopTools.swift:76-89 | Packages/OsaurusCore/Tools/AgentLoopTools.swift:215-223 | Packages/OsaurusCore/Tools/AgentLoopTools.swift:404-417 | Packages/OsaurusCore/Tools/AgentLoopTools.swift:556-569 | Packages/OsaurusCore/Tools/AskOwnerTool.swift:39-41 | Packages/OsaurusCore/Tools/CalculatorTool.swift:59-62 | Packages/OsaurusCore/Tools/KnowledgeCurationTools.swift:100-103 | Packages/OsaurusCore/Tools/KnowledgeCurationTools.swift:111-121 | Packages/OsaurusCore/Tools/KnowledgeTools.swift:452-455 | Packages/OsaurusCore/Tools/KnowledgeWriteTools.swift:823-827 | Packages/OsaurusCore/Tools/NativeImageTools.swift:174-177 | Packages/OsaurusCore/Tools/SkillUpdateTool.swift:97-100 | Packages/OsaurusCore/Tools/VideoTool.swift:89-91 | Packages/OsaurusCore/Tools/WebSearchTools.swift:273-276 | Packages/OsaurusCore/Tools/WebSearchTools.swift:277-287 — there are 22 copies across 16 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 22 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Browser/Tool/BrowserUseTool.swift:83` 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, `Packages/OsaurusCore/Tools/WebSearchTools.swift:274` calls `value`, `requireString` and `Packages/OsaurusCore/ComputerUse/Tool/ComputerUseTool.swift:127` 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 (14 lines × 4) · ×1
  • Duplicated block (14 lines × 4) Packages/OsaurusCore/Networking/HTTPHandler.swift:2077 — Packages/OsaurusCore/Networking/HTTPHandler.swift:2077-2090 | Packages/OsaurusCore/Networking/HTTPHandler.swift:2110-2123 | Packages/OsaurusCore/Networking/HTTPHandler.swift:2145-2158 | Packages/OsaurusCore/Networking/HTTPHandler.swift:2179-2192 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:2077` 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–14 lines × 4) · ×1
  • Duplicated block (8–14 lines × 4) Packages/OsaurusCore/Networking/HTTPHandler.swift:15016 — Packages/OsaurusCore/Networking/HTTPHandler.swift:15016-15023 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16023-16036 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16311-16322 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18061-18074 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:15016` 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 (13–14 lines × 3) · ×1
  • Duplicated block (13–14 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:12562 — Packages/OsaurusCore/Networking/HTTPHandler.swift:12562-12574 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12710-12723 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12728-12740 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:12562` 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 (9–14 lines × 3) · ×1
  • Duplicated block (9–14 lines × 3) Packages/OsaurusCore/Views/Chat/ChatView.swift:10805 — Packages/OsaurusCore/Views/Chat/ChatView.swift:10805-10813 | Packages/OsaurusCore/Views/Chat/ChatView.swift:10846-10859 | Packages/OsaurusCore/Views/Chat/ChatView.swift:11111-11124 — 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 `Packages/OsaurusCore/Views/Chat/ChatView.swift:10805` 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 (4–14 lines × 3) · ×1
  • Duplicated block (4–14 lines × 3) Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:523 — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:523-534 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:846-849 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:620-633 — 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 `Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:523` 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–14 lines × 2) · ×1
  • Duplicated block (9–14 lines × 2) Packages/OsaurusCore/Tools/KnowledgeWriteTools.swift:112 — Packages/OsaurusCore/Tools/KnowledgeWriteTools.swift:112-125 | Packages/OsaurusCore/Tools/KnowledgeWriteTools.swift:457-465 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/KnowledgeWriteTools.swift:112` 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 (7–14 lines × 2) · ×1
  • Duplicated block (7–14 lines × 2) Packages/OsaurusCore/Views/Identity/LoginConsentView.swift:58 — Packages/OsaurusCore/Views/Identity/LoginConsentView.swift:58-64 | Packages/OsaurusCore/Views/Provider/ProviderCredentialPromptSheet.swift:168-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 `Packages/OsaurusCore/Views/Identity/LoginConsentView.swift:58` 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 × 13) · ×1
  • Duplicated block (13 lines × 13) Packages/OsaurusCore/Networking/HTTPHandler.swift:5660 — Packages/OsaurusCore/Networking/HTTPHandler.swift:5660-5672 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6165-6177 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6252-6264 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6331-6343 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6472-6484 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6589-6601 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6956-6968 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7097-7109 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7433-7445 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7675-7687 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7854-7866 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8310-8322 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8503-8515 — all 13 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:5660` 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 (7–13 lines × 7) · ×1
  • Duplicated block (7–13 lines × 7) Packages/OsaurusCore/Networking/HTTPHandler.swift:10257 — Packages/OsaurusCore/Networking/HTTPHandler.swift:10257-10269 | Packages/OsaurusCore/Networking/HTTPHandler.swift:10425-10437 | Packages/OsaurusCore/Networking/HTTPHandler.swift:13584-13590 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14563-14569 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16959-16971 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17067-17079 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17402-17414 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:10257` 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 (12–13 lines × 3) · ×1
  • Duplicated block (12–13 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:5678 — Packages/OsaurusCore/Networking/HTTPHandler.swift:5678-5690 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6490-6501 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6607-6619 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:5678` 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–13 lines × 3) · ×1
  • Duplicated block (8–13 lines × 3) Packages/OsaurusCore/Networking/HTTPHandler.swift:7403 — Packages/OsaurusCore/Networking/HTTPHandler.swift:7403-7410 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7476-7485 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7894-7906 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:7403` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (6–13 lines × 3) · ×1
  • Duplicated block (6–13 lines × 3) Packages/OsaurusCore/Views/Identity/LoginConsentView.swift:58 — Packages/OsaurusCore/Views/Identity/LoginConsentView.swift:58-63 | Packages/OsaurusCore/Views/Plugin/MCPElicitationView.swift:61-66 | Packages/OsaurusCore/Views/Provider/ProviderCredentialPromptSheet.swift:168-180 — 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 `Packages/OsaurusCore/Views/Identity/LoginConsentView.swift:58` 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, `Packages/OsaurusCore/Views/Plugin/MCPElicitationView.swift:60` calls `settingsChrome` and `Packages/OsaurusCore/Views/Identity/LoginConsentView.swift:57` 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 (9–13 lines × 3) · ×1
  • Duplicated block (9–13 lines × 3) Packages/OsaurusCore/Views/Settings/CommandLineToolSection.swift:92 — Packages/OsaurusCore/Views/Settings/CommandLineToolSection.swift:92-101 | Packages/OsaurusCore/Views/Settings/CommandLineToolSection.swift:106-114 | Packages/OsaurusCore/Views/Settings/CommandLineToolSection.swift:118-130 — 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. 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–13 lines × 2) · ×1
  • Duplicated block (10–13 lines × 2) Packages/OsaurusCLI/Sources/OsaurusCLICore/Services/Configuration.swift:29 — Packages/OsaurusCLI/Sources/OsaurusCLICore/Services/Configuration.swift:29-41 | Packages/OsaurusCLI/Sources/OsaurusCLICore/Services/Configuration.swift:61-70 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCLI/Sources/OsaurusCLICore/Services/Configuration.swift:29` 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–13 lines × 2) · ×1
  • Duplicated block (9–13 lines × 2) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:2705 — Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:2705-2717 | Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:2835-2843 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:2705` 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 lines × 9) · ×1
  • Duplicated block (12 lines × 9) Packages/OsaurusCore/Networking/HTTPHandler.swift:4704 — Packages/OsaurusCore/Networking/HTTPHandler.swift:4704-4715 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14836-14847 | Packages/OsaurusCore/Networking/HTTPHandler.swift:15298-15309 | Packages/OsaurusCore/Networking/HTTPHandler.swift:15864-15875 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16161-16172 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17111-17122 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17426-17437 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17820-17831 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18466-18477 — all 9 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:4704` 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 lines × 7) · ×1
  • Duplicated block (12 lines × 7) Packages/OsaurusCore/Networking/HTTPHandler.swift:5678 — Packages/OsaurusCore/Networking/HTTPHandler.swift:5678-5689 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6490-6501 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6607-6618 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6974-6985 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7115-7126 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7693-7704 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7872-7883 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:5678` 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 lines × 4) · ×1
  • Duplicated block (12 lines × 4) Packages/OsaurusCore/Views/Workflow/Library/WorkflowSetupWizardView.swift:754 — Packages/OsaurusCore/Views/Workflow/Library/WorkflowSetupWizardView.swift:754-765 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowSetupWizardView.swift:1171-1182 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowSetupWizardView.swift:1289-1300 | Packages/OsaurusCore/Views/Workflow/Library/WorkflowSetupWizardView.swift:1450-1461 — 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 `Packages/OsaurusCore/Views/Workflow/Library/WorkflowSetupWizardView.swift:754` 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–12 lines × 3) · ×1
  • Duplicated block (8–12 lines × 3) Packages/OsaurusCore/Views/Credits/CreditsView.swift:780 — Packages/OsaurusCore/Views/Credits/CreditsView.swift:780-791 | Packages/OsaurusCore/Views/Router/RouterAccountUsageCenterView.swift:563-570 | Packages/OsaurusCore/Views/Workspaces/WorkspacePoolActivityView.swift:372-379 — 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 (7–12 lines × 2) · ×1
  • Duplicated block (7–12 lines × 2) Packages/OsaurusCore/Networking/HTTPHandler.swift:2329 — Packages/OsaurusCore/Networking/HTTPHandler.swift:2329-2340 | Packages/OsaurusCore/Networking/HTTPHandler.swift:2660-2666 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:2329` 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 (3–12 lines × 3) · ×1
  • Duplicated block (3–12 lines × 3) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:1786 — Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:1786-1788 | Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:1799-1810 | Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:1822-1833 — 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 `Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:1799` 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 (11 lines × 13) · ×1
  • Duplicated block (11 lines × 13) Packages/OsaurusCore/Networking/HTTPHandler.swift:4709 — Packages/OsaurusCore/Networking/HTTPHandler.swift:4709-4719 | Packages/OsaurusCore/Networking/HTTPHandler.swift:10516-10526 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12547-12557 | Packages/OsaurusCore/Networking/HTTPHandler.swift:13050-13060 | Packages/OsaurusCore/Networking/HTTPHandler.swift:13209-13219 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14841-14851 | Packages/OsaurusCore/Networking/HTTPHandler.swift:15303-15313 | Packages/OsaurusCore/Networking/HTTPHandler.swift:15869-15879 | Packages/OsaurusCore/Networking/HTTPHandler.swift:16166-16176 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17116-17126 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17431-17441 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17825-17835 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18471-18481 — all 13 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, `Packages/OsaurusCore/Networking/HTTPHandler.swift:10533` calls `injectingEmptyModelIfMissing` and `Packages/OsaurusCore/Networking/HTTPHandler.swift:4721` 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–11 lines × 11) · ×1
  • Duplicated block (7–11 lines × 11) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3499 — Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3499-3505 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3595-3603 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3641-3647 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3662-3668 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3675-3681 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3694-3700 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1685-1691 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2112-2122 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2146-2152 | Packages/OsaurusCore/Tools/ConfigurationTools.swift:1683-1690 | Packages/OsaurusCore/Tools/SandboxSecretTools.swift:125-131 — there are 11 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 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 `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3499` 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, `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3671` calls `array` and `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3508` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10–11 lines × 7) · ×1
  • Duplicated block (10–11 lines × 7) Packages/OsaurusCore/Networking/HTTPHandler.swift:4818 — Packages/OsaurusCore/Networking/HTTPHandler.swift:4818-4827 | Packages/OsaurusCore/Networking/HTTPHandler.swift:4915-4924 | Packages/OsaurusCore/Networking/HTTPHandler.swift:4982-4991 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18163-18173 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18213-18223 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18918-18928 | Packages/OsaurusCore/Networking/HTTPHandler.swift:18968-18978 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:4818` 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–11 lines × 2) · ×1
  • Duplicated block (6–11 lines × 2) Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:584 — Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:584-589 | Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:608-618 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Slack/SlackAPIClient.swift:584` 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 (4–11 lines × 3) · ×1
  • Duplicated block (4–11 lines × 3) Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:238 — Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:238-248 | Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift:228-238 | Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:1401-1404 — before extracting anything, compare `Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift` and `Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 146 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 `Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:238` 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 after the matched lines, `Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:249` calls `tearDownChildren` and `Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift:239` 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 (10 lines × 5) · ×1
  • Duplicated block (10 lines × 5) Packages/OsaurusCore/Networking/HTTPHandler.swift:10161 — Packages/OsaurusCore/Networking/HTTPHandler.swift:10161-10170 | Packages/OsaurusCore/Networking/HTTPHandler.swift:10287-10296 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12883-12892 | Packages/OsaurusCore/Networking/HTTPHandler.swift:12961-12970 | Packages/OsaurusCore/Networking/HTTPHandler.swift:13039-13048 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:10161` 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 (9–10 lines × 4) · ×1
  • Duplicated block (9–10 lines × 4) Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:615 — Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:615-623 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:648-657 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:737-745 | Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:855-863 — 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 `Packages/OsaurusCore/Configuration/Declarative/ConfigPlanner.swift:615` 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–10 lines × 4) · ×1
  • Duplicated block (8–10 lines × 4) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3547 — Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3547-3556 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3637-3645 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3659-3666 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3690-3698 — 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 `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3547` 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–10 lines × 3) · ×1
  • Duplicated block (7–10 lines × 3) Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:695 — Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:695-701 | Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift:377-383 | Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:2246-2255 — before extracting anything, compare `Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift` and `Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 146 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 `Packages/OsaurusCore/Views/Chat/NativeToolCallGroupView.swift:2246` 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, `Packages/OsaurusCore/Views/Chat/NativeActivityGroupView.swift:692` calls `constraint` and `Packages/OsaurusCore/Views/Chat/NativeThinkingView.swift:374` 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 (7–10 lines × 2) · ×1
  • Duplicated block (7–10 lines × 2) Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:1848 — Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:1848-1857 | Packages/OsaurusCore/Views/Tool/ToolAdvancedDiagnosticsSection.swift:208-214 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Settings/AgentChannelDestinationViews.swift:1848` 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 lines × 9) · ×1
  • Duplicated block (9 lines × 9) Packages/OsaurusCore/AppleApps/AppleAppsPluginMigration.swift:76 — Packages/OsaurusCore/AppleApps/AppleAppsPluginMigration.swift:76-84 | Packages/OsaurusCore/Browser/BrowserConfigurationStore.swift:71-79 | Packages/OsaurusCore/ComputerUse/Policy/ComputerUsePolicyStore.swift:107-115 | Packages/OsaurusCore/Models/Configuration/MCPProviderConfiguration.swift:472-480 | Packages/OsaurusCore/Models/Configuration/RelayConfiguration.swift:65-73 | Packages/OsaurusCore/Models/Configuration/SearchProviderConfiguration.swift:474-482 | Packages/OsaurusCore/Models/Tool/ToolConfigurationStore.swift:107-115 | Packages/OsaurusCore/Models/Voice/SpeechConfiguration.swift:256-264 | Packages/OsaurusCore/Models/Voice/TTSConfiguration.swift:177-185 — before extracting anything, compare `Packages/OsaurusCore/ComputerUse/Policy/ComputerUsePolicyStore.swift` and `Packages/OsaurusCore/Models/Tool/ToolConfigurationStore.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 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 `Packages/OsaurusCore/AppleApps/AppleAppsPluginMigration.swift:76` 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, `Packages/OsaurusCore/Models/Configuration/MCPProviderConfiguration.swift:482` calls `configurationFileURL`, `resolvePath`, `mcpProviderConfigFile` and `Packages/OsaurusCore/ComputerUse/Policy/ComputerUsePolicyStore.swift:116` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–9 lines × 6) · ×1
  • Duplicated block (8–9 lines × 6) Packages/OsaurusCore/Networking/HTTPHandler.swift:17201 — Packages/OsaurusCore/Networking/HTTPHandler.swift:17201-17209 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17398-17405 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17575-17583 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17622-17630 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17744-17752 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17780-17788 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Networking/HTTPHandler.swift:17201` 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 × 4) · ×1
  • Duplicated block (10–11 lines × 4) Packages/OsaurusCore/Services/Email/EmailChannelService.swift:346 — Packages/OsaurusCore/Services/Email/EmailChannelService.swift:346-355 | Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:534-544 | Packages/OsaurusCore/Services/Telegram/TelegramConnectionService.swift:849-859 | Packages/OsaurusCore/Services/WhatsApp/WhatsAppConnectionService.swift:633-643 — 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 `Packages/OsaurusCore/Services/Email/EmailChannelService.swift:346` 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 (5–9 lines × 4) · ×1
  • Duplicated block (5–9 lines × 4) Packages/OsaurusCore/Services/MCP/MCPProviderProbeService.swift:175 — Packages/OsaurusCore/Services/MCP/MCPProviderProbeService.swift:175-183 | Packages/OsaurusCore/Services/Provider/OpenAICodexOAuthService.swift:459-463 | Packages/OsaurusCore/Services/Provider/ProviderReplayDiagnostics.swift:205-213 | Packages/OsaurusCore/Services/Provider/XAIOAuthService.swift:320-324 — 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 `Packages/OsaurusCore/Services/MCP/MCPProviderProbeService.swift:175` 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–9 lines × 3) · ×1
  • Duplicated block (7–9 lines × 3) Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:583 — Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:583-591 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:1185-1193 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:1203-1209 — 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, `Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:1216` calls `NSPoint` and `Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:598` 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 (4–9 lines × 4) · ×1
  • Duplicated block (4–9 lines × 4) Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:553 — Packages/OsaurusCore/Storage/KnowledgeDatabase.swift:553-556 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:890-893 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:939-944 | Packages/OsaurusCore/Storage/MemoryDatabase.swift:2220-2228 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Storage/MemoryDatabase.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 after the matched lines, `Packages/OsaurusCore/Storage/MemoryDatabase.swift:946` calls `sqlite3_bind_int`, `Int32` and `Packages/OsaurusCore/Storage/MemoryDatabase.swift:895` 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 (7–9 lines × 2) · ×1
  • Duplicated block (7–9 lines × 2) Packages/OsaurusCore/Views/Agent/Database/DatabaseHistoryView.swift:65 — Packages/OsaurusCore/Views/Agent/Database/DatabaseHistoryView.swift:65-73 | Packages/OsaurusCore/Views/Agent/Database/DatabaseSavedViewsView.swift:81-87 — 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 `Packages/OsaurusCore/Views/Agent/Database/DatabaseHistoryView.swift:65` 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, `Packages/OsaurusCore/Views/Agent/Database/DatabaseSavedViewsView.swift:90` calls `Spacer` and `Packages/OsaurusCore/Views/Agent/Database/DatabaseHistoryView.swift:76` 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 (3–9 lines × 4) · ×1
  • Duplicated block (3–9 lines × 4) Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:2098 — Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:2098-2106 | Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:2388-2390 | Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:2692-2694 | Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:3024-3032 — 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 `Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:2098` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `spacing` to `NavigatorRowMetrics.iconGap` in one and `theme.catalogLayoutMetric("component.library.41.elements.layout.remoteAgentSidebarRow.body.horizontalGap", inheriting: NativeComponentInspectionStyle.metric(41, "gap", theme.space.s10, theme))` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:3032` calls `animation`, `springAnimation` and `Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:2390` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (5–8 lines × 15) · ×1
  • Duplicated block (5–8 lines × 15) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3499 — Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3499-3503 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3550-3557 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3595-3600 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3641-3645 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3662-3666 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3675-3679 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3694-3698 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1685-1689 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1887-1893 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2112-2119 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2146-2150 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2687-2692 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3186-3190 | Packages/OsaurusCore/Tools/ConfigurationTools.swift:1683-1688 | Packages/OsaurusCore/Tools/SandboxSecretTools.swift:125-129 — there are 15 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 15 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3499` 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, `Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3192` calls `number` and `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3505` 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 (6–8 lines × 8) · ×1
  • Duplicated block (6–8 lines × 8) Packages/OsaurusCore/Networking/HTTPHandler.swift:5671 — Packages/OsaurusCore/Networking/HTTPHandler.swift:5671-5676 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6483-6488 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6967-6972 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7108-7113 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7387-7394 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7444-7449 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7686-7691 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7865-7870 — all 8 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:5671` 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 (7–8 lines × 7) · ×1
  • Duplicated block (7–8 lines × 7) Packages/OsaurusCore/Networking/HTTPHandler.swift:5637 — Packages/OsaurusCore/Networking/HTTPHandler.swift:5637-5643 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6938-6945 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7075-7081 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7837-7843 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8030-8036 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8087-8093 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8291-8297 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:5637` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8 lines × 7) · ×1
  • Duplicated block (8 lines × 7) Packages/OsaurusCore/Networking/HTTPHandler.swift:17204 — Packages/OsaurusCore/Networking/HTTPHandler.swift:17204-17211 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17286-17293 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17400-17407 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17578-17585 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17625-17632 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17747-17754 | Packages/OsaurusCore/Networking/HTTPHandler.swift:17783-17790 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:17204` 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–8 lines × 4) · ×1
  • Duplicated block (7–8 lines × 4) Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:1337 — Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:1337-1343 | Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:1377-1384 | Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:1446-1452 | Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:1487-1493 — 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 `Packages/OsaurusCore/Views/Chat/ChatEmptyState.swift:1337` 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 (2–8 lines × 3) · ×1
  • Duplicated block (2–8 lines × 3) Packages/OsaurusCore/AppleApps/Mail/MailService.swift:361 — Packages/OsaurusCore/AppleApps/Mail/MailService.swift:361-368 | Packages/OsaurusCore/AppleApps/Music/MusicService.swift:76-77 | Packages/OsaurusCore/AppleApps/Notes/NotesService.swift:64-71 — 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 `Packages/OsaurusCore/AppleApps/Mail/MailService.swift:361` 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) Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool.swift:192 — Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool.swift:192-199 | Packages/OsaurusCore/Configuration/Declarative/OsaurusImportTool.swift:44-47 | Packages/OsaurusCore/Tools/ConfigurationTools.swift:1155-1160 — 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 `Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool.swift:192` 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–8 lines × 2) · ×1
  • Duplicated block (7–8 lines × 2) Packages/OsaurusCore/Services/HuggingFaceService.swift:452 — Packages/OsaurusCore/Services/HuggingFaceService.swift:452-458 | Packages/OsaurusCore/Services/HuggingFaceService.swift:777-784 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/HuggingFaceService.swift:452` 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 before the matched lines, `Packages/OsaurusCore/Services/HuggingFaceService.swift:776` calls `URLQueryItem` and `Packages/OsaurusCore/Services/HuggingFaceService.swift:451` 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) Packages/OsaurusCore/Views/Workflow/Architect/MediaStepEditor.swift:244 — Packages/OsaurusCore/Views/Workflow/Architect/MediaStepEditor.swift:244-251 | Packages/OsaurusCore/Views/Workflow/Architect/MediaStepEditor.swift:470-475 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Workflow/Architect/MediaStepEditor.swift:244` 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 lines × 15) · ×1
  • Duplicated block (7 lines × 15) Packages/OsaurusCore/Networking/HTTPHandler.swift:5666 — Packages/OsaurusCore/Networking/HTTPHandler.swift:5666-5672 | Packages/OsaurusCore/Networking/HTTPHandler.swift:5765-5771 | Packages/OsaurusCore/Networking/HTTPHandler.swift:5859-5865 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6171-6177 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6258-6264 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6337-6343 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6478-6484 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6595-6601 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6962-6968 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7103-7109 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7439-7445 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7681-7687 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7860-7866 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8316-8322 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8509-8515 — all 15 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Networking/HTTPHandler.swift:6266` calls `split` and `Packages/OsaurusCore/Networking/HTTPHandler.swift:5773` 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 (7 lines × 14) · ×1
  • Duplicated block (7 lines × 14) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3496 — Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3496-3503 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3561-3570 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3597-3605 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3643-3649 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3664-3670 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3673-3679 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1682-1689 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1884-1893 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2096-2105 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2109-2118 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2144-2150 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3184-3190 | Packages/OsaurusCore/Tools/ConfigurationTools.swift:1681-1687 | Packages/OsaurusCore/Tools/SandboxSecretTools.swift:127-133 — there are 14 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 14 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3496` 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, `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3671` calls `array` and `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3504` 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 lines × 9) · ×1
  • Duplicated block (7 lines × 9) Packages/OsaurusCore/Models/Agent/Skill.swift:117 — Packages/OsaurusCore/Models/Agent/Skill.swift:117-124 | Packages/OsaurusCore/Models/Agent/Skill.swift:161-168 | Packages/OsaurusCore/Models/Agent/Skill.swift:207-214 | Packages/OsaurusCore/Models/Agent/Skill.swift:246-253 | Packages/OsaurusCore/Models/Agent/Skill.swift:284-291 | Packages/OsaurusCore/Models/Agent/Skill.swift:328-335 | Packages/OsaurusCore/Models/Agent/Skill.swift:373-380 | Packages/OsaurusCore/Models/Agent/Skill.swift:417-424 | Packages/OsaurusCore/Models/Agent/Skill.swift:455-461 — all 9 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 `Packages/OsaurusCore/Models/Agent/Skill.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. 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–7 lines × 9) · ×1
  • Duplicated block (4–7 lines × 9) Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1673 — Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1673-1679 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1852-1858 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2087-2093 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3175-3181 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3556-3562 | Packages/OsaurusCore/Tools/ConfigurationTools.swift:1674-1677 | Packages/OsaurusCore/Tools/SandboxPluginRegisterTool.swift:33-39 | Packages/OsaurusCore/Tools/SandboxSecretTools.swift:24-30 | Packages/OsaurusCore/Tools/SandboxSecretTools.swift:119-125 — there are 9 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 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 `Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1673` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3182` calls `array` and `Packages/OsaurusCore/Tools/SandboxSecretTools.swift:126` 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–7 lines × 5) · ×1
  • Duplicated block (6–7 lines × 5) Packages/OsaurusCore/Networking/HTTPHandler.swift:8664 — Packages/OsaurusCore/Networking/HTTPHandler.swift:8664-8669 | Packages/OsaurusCore/Networking/HTTPHandler.swift:10253-10259 | Packages/OsaurusCore/Networking/HTTPHandler.swift:13581-13586 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14748-14753 | Packages/OsaurusCore/Networking/HTTPHandler.swift:14779-14784 — 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:8664` 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 (5–7 lines × 4) · ×1
  • Duplicated block (5–7 lines × 4) Packages/OsaurusCore/Views/Identity/IdentityView.swift:664 — Packages/OsaurusCore/Views/Identity/IdentityView.swift:664-670 | Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:303-307 | Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:381-385 | Packages/OsaurusCore/Views/Memory/MemoryComponents.swift:455-459 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Identity/IdentityView.swift:664` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `spacing` to `theme.space.s16` in one and `theme.space.s0` 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 (2–7 lines × 6) · ×1
  • Duplicated block (2–7 lines × 6) Packages/OsaurusCore/Services/Chat/Routing/AgentWrapperCatalog.swift:92 — Packages/OsaurusCore/Services/Chat/Routing/AgentWrapperCatalog.swift:92-93 | Packages/OsaurusCore/Services/Method/MethodSearchService.swift:265-271 | Packages/OsaurusCore/Services/Skill/SkillSearchService.swift:361-367 | Packages/OsaurusCore/Services/Sync/SyncConversationMapper.swift:175-177 | Packages/OsaurusCore/Services/Tool/ToolSearchService.swift:901-907 | Packages/OsaurusCore/Utils/TextSimilarity.swift:70-73 — before extracting anything, compare `Packages/OsaurusCore/Services/Method/MethodSearchService.swift` and `Packages/OsaurusCore/Services/Skill/SkillSearchService.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 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 `Packages/OsaurusCore/Services/Chat/Routing/AgentWrapperCatalog.swift:92` 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 (2–7 lines × 3) · ×1
  • Duplicated block (2–7 lines × 3) Packages/OsaurusCore/Configuration/Declarative/ConfigYAML.swift:345 — Packages/OsaurusCore/Configuration/Declarative/ConfigYAML.swift:345-351 | Packages/OsaurusCore/Models/Configuration/SettingsSearchIndex.swift:266-267 | Packages/OsaurusCore/Services/Documents/PDFEditor.swift:331-337 — 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 `Packages/OsaurusCore/Configuration/Declarative/ConfigYAML.swift:345` 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 (4–7 lines × 4) · ×1
  • Duplicated block (4–7 lines × 4) Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:7205 — Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:7205-7208 | Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:7227-7230 | Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:7327-7333 | Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:7358-7364 — 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 `Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:7327` 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 (6 lines × 18) · ×1
  • Duplicated block (6 lines × 18) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3486 — Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3486-3491 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3498-3503 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3549-3556 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3563-3570 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3594-3599 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3640-3645 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3661-3666 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3674-3679 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3693-3698 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1684-1689 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:1886-1893 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2098-2105 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2111-2118 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2145-2150 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2686-2691 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:3185-3190 | Packages/OsaurusCore/Tools/ConfigurationTools.swift:1682-1687 | Packages/OsaurusCore/Tools/SandboxSecretTools.swift:124-129 — there are 18 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 18 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3486` 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, `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3492` calls `object`, `number`, `Double` and `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3600` 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 (6 lines × 9) · ×1
  • Duplicated block (6 lines × 9) Packages/OsaurusCore/Networking/HTTPHandler.swift:5671 — Packages/OsaurusCore/Networking/HTTPHandler.swift:5671-5676 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6483-6488 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6777-6782 | Packages/OsaurusCore/Networking/HTTPHandler.swift:6967-6972 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7108-7113 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7389-7394 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7444-7449 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7686-7691 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7865-7870 — all 9 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:5671` 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 (6 lines × 6) · ×1
  • Duplicated block (6 lines × 6) Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3528 — Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3528-3534 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3646-3652 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3680-3686 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3695-3701 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2147-2152 | Packages/OsaurusCore/Tools/ConfigurationTools.swift:1684-1690 — there are 6 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 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 `Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3528` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7 lines × 5) · ×1
  • Duplicated block (7 lines × 5) Packages/OsaurusCore/Models/Discord/DiscordConnectionConfiguration.swift:139 — Packages/OsaurusCore/Models/Discord/DiscordConnectionConfiguration.swift:139-145 | Packages/OsaurusCore/Models/IMessage/IMessageConnectionConfiguration.swift:309-315 | Packages/OsaurusCore/Models/Slack/SlackConnectionConfiguration.swift:255-261 | Packages/OsaurusCore/Models/Telegram/TelegramConnectionConfiguration.swift:221-227 | Packages/OsaurusCore/Models/WhatsApp/WhatsAppConnectionConfiguration.swift:265-271 — before extracting anything, compare `Packages/OsaurusCore/Models/Discord/DiscordConnectionConfiguration.swift` and `Packages/OsaurusCore/Models/Slack/SlackConnectionConfiguration.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (5–6 lines × 4) · ×1
  • Duplicated block (5–6 lines × 4) Packages/OsaurusCore/Views/Settings/AgentChannelCustomConnectionSheet.swift:494 — Packages/OsaurusCore/Views/Settings/AgentChannelCustomConnectionSheet.swift:494-498 | Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:630-635 | Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:751-756 | Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift:904-908 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Views/Settings/AgentChannelCustomConnectionSheet.swift:494` 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 (2–6 lines × 3) · ×1
  • Duplicated block (2–6 lines × 3) Packages/OsaurusCore/Configuration/Declarative/ConfigYAML.swift:353 — Packages/OsaurusCore/Configuration/Declarative/ConfigYAML.swift:353-358 | Packages/OsaurusCore/Models/Configuration/SettingsSearchIndex.swift:267-268 | Packages/OsaurusCore/Services/Documents/PDFEditor.swift:339-344 — 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 `Packages/OsaurusCore/Configuration/Declarative/ConfigYAML.swift:353` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Packages/OsaurusCore/Services/Documents/PDFEditor.swift:339` calls `min` and `Packages/OsaurusCore/Models/Configuration/SettingsSearchIndex.swift:267` 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 (3–6 lines × 4) · ×1
  • Duplicated block (3–6 lines × 4) Packages/OsaurusCore/Services/Search/NativeSearchBackends.swift:71 — Packages/OsaurusCore/Services/Search/NativeSearchBackends.swift:71-73 | Packages/OsaurusCore/Services/Search/NativeSearchBackends.swift:90-92 | Packages/OsaurusCore/Services/Search/NativeSearchBackends.swift:214-219 | Packages/OsaurusCore/Services/Search/NativeSearchBackends.swift:301-306 — 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 `Packages/OsaurusCore/Services/Search/NativeSearchBackends.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. 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, `Packages/OsaurusCore/Services/Search/NativeSearchBackends.swift:306` calls `prefix` and `Packages/OsaurusCore/Services/Search/NativeSearchBackends.swift:92` 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 (4–6 lines × 3) · ×1
  • Duplicated block (4–6 lines × 3) Packages/OsaurusCore/Tools/Database/DatabaseExport.swift:173 — Packages/OsaurusCore/Tools/Database/DatabaseExport.swift:173-178 | Packages/OsaurusCore/Tools/Database/DatabaseExport.swift:232-237 | Packages/OsaurusCore/Tools/Database/DatabaseExport.swift:290-293 — 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 `Packages/OsaurusCore/Tools/Database/DatabaseExport.swift:173` 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, `Packages/OsaurusCore/Tools/Database/DatabaseExport.swift:178` calls `createFile` and `Packages/OsaurusCore/Tools/Database/DatabaseExport.swift:293` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (5 lines × 12) · ×1
  • Duplicated block (5 lines × 12) Packages/OsaurusCore/Tools/AgentChannelTools.swift:512 — Packages/OsaurusCore/Tools/AgentChannelTools.swift:512-516 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:567-571 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:631-635 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:748-752 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:812-816 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:862-866 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:908-912 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:964-968 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1030-1034 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1100-1104 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1247-1251 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1404-1408 — all 12 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 `Packages/OsaurusCore/Tools/AgentChannelTools.swift:512` 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 before the matched lines, `Packages/OsaurusCore/Tools/AgentChannelTools.swift:745` calls `value`, `requireString` and `Packages/OsaurusCore/Tools/AgentChannelTools.swift:510` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (5 lines × 9) · ×1
  • Duplicated block (5 lines × 9) Packages/OsaurusCore/Networking/HTTPHandler.swift:5296 — Packages/OsaurusCore/Networking/HTTPHandler.swift:5296-5306 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7024-7034 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7152-7156 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7414-7418 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7508-7512 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7754-7758 | Packages/OsaurusCore/Networking/HTTPHandler.swift:7913-7923 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8539-8549 | Packages/OsaurusCore/Networking/HTTPHandler.swift:8626-8636 — all 9 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 `Packages/OsaurusCore/Networking/HTTPHandler.swift:5296` 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 (5 lines × 7) · ×1
  • Duplicated block (5 lines × 7) Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2444 — Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2444-2448 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2494-2498 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2816-2820 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2862-2866 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2931-2935 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2966-2970 | Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:3607-3611 — 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 `Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2444` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2500` calls `constraint` and `Packages/OsaurusCore/Views/Chat/NativeMessageCellView.swift:2822` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (5–10 lines × 3) · ×1
  • Duplicated block (5–10 lines × 3) Packages/OsaurusCore/Services/Chat/Routing/AgentWrapperCatalog.swift:54 — Packages/OsaurusCore/Services/Chat/Routing/AgentWrapperCatalog.swift:54-58 | Packages/OsaurusCore/Services/Chat/SystemPromptComposer.swift:3616-3625 | Packages/OsaurusCore/Tools/BuiltinSandboxTools.swift:2127-2136 — 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 `Packages/OsaurusCore/Services/Chat/Routing/AgentWrapperCatalog.swift:54` 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 (2–5 lines × 22) · ×1
  • Duplicated block (2–5 lines × 22) Packages/OsaurusCore/Tools/AgentChannelTools.swift:375 — Packages/OsaurusCore/Tools/AgentChannelTools.swift:375-376 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:410-414 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:455-456 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:509-510 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:564-565 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:628-629 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:685-686 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:743-744 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:807-808 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:855-856 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:903-904 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:957-958 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1027-1028 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1095-1096 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1170-1171 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1177-1181 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1240-1241 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1310-1311 | Packages/OsaurusCore/Tools/AgentChannelTools.swift:1387-1388 | Packages/OsaurusCore/Tools/CalculatorTool.swift:63-65 | Packages/OsaurusCore/Tools/CurrentTimeTool.swift:50-57 | Packages/OsaurusCore/Tools/SandboxSecretTools.swift:195-210 — there are 22 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 22 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Packages/OsaurusCore/Tools/AgentChannelTools.swift:410` 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, `Packages/OsaurusCore/Tools/AgentChannelTools.swift:410` calls `optionalString` and `Packages/OsaurusCore/Tools/AgentChannelTools.swift:375` does not — after which the two agree again for 5 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 (4–5 lines × 5) · ×1
  • Duplicated block (4–5 lines × 5) Packages/OsaurusCore/Views/Event/EventFormComponents.swift:113 — Packages/OsaurusCore/Views/Event/EventFormComponents.swift:113-116 | Packages/OsaurusCore/Views/Event/EventFormComponents.swift:148-152 | Packages/OsaurusCore/Views/Event/EventFormComponents.swift:271-274 | Packages/OsaurusCore/Views/Event/EventFormComponents.swift:291-294 | Packages/OsaurusCore/Views/Event/EventFormComponents.swift:366-370 — 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 `Packages/OsaurusCore/Views/Event/EventFormComponents.swift:113` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Packages/OsaurusCore/Views/Event/EventFormComponents.swift:112` calls `VStack` and `Packages/OsaurusCore/Views/Event/EventFormComponents.swift:148` 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 (4–5 lines × 3) · ×1
  • Duplicated block (4–5 lines × 3) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:132 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:132-135 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ComputerUseScorecard.swift:47-51 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReport.swift:741-745 — 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 `Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ComputerUseScorecard.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 first that the copies are not typed on the same thing: the declarations holding them bind `cases` to `[AgentLoopRegressionCaseSnapshot]` in one and `[EvalCaseReport]` 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 × 6) · ×1
  • Duplicated block (9 lines × 6) Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:569 — Packages/OsaurusCore/Storage/AgentChannelMessageStore.swift:569-577 | Packages/OsaurusCore/Storage/AgentDatabase.swift:492-500 | Packages/OsaurusCore/Storage/ChatHistoryDatabase.swift:278-286 | Packages/OsaurusCore/Storage/KnowledgeWriteLogDatabase.swift:166-174 | Packages/OsaurusCore/Storage/RouterBillingDatabase.swift:256-264 | Packages/OsaurusCore/Storage/SchedulerDatabase.swift:270-278 — 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 6 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (10 lines × 6) · ×1
  • Duplicated block (10 lines × 6) Packages/OsaurusCore/Views/Agent/AgentsView.swift:701 — Packages/OsaurusCore/Views/Agent/AgentsView.swift:701-710 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:817-826 | Packages/OsaurusCore/Views/Plugin/PluginsView.swift:2657-2666 | Packages/OsaurusCore/Views/Settings/OrchestratorSettingsView.swift:193-202 | Packages/OsaurusCore/Views/Settings/ServerSettingsTabContent.swift:550-559 | Packages/OsaurusCore/Views/Workspaces/WorkspacesView.swift:227-236 — 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 (8 lines × 8) · ×1
  • Duplicated block (8 lines × 8) Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:247 — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:247-254 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ComputerUseScorecard.swift:155-162 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalCompat.swift:178-185 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalDiff.swift:159-166 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalMatrix.swift:380-387 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReport.swift:752-759 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalReviewReport.swift:320-327 | Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalScoreboard.swift:46-53 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 8 call sites, so a change lands once.
D4 · Code Duplication · Edited copy of a member (2 corresponding lines) · ×1
  • Edited copy of a member (2 corresponding lines) scripts/live-proof/classify-runtime-proof-summary.py:298 — scripts/live-proof/classify-runtime-proof-summary.py:298-299 | scripts/live-proof/render-runtime-proof-matrix.py:127-128 — These two members are one piece of code written twice and then edited apart: 2 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (5–7 lines × 2) · ×1
  • Duplicated block (5–7 lines × 2) Packages/OsaurusCore/Services/Sandbox/SandboxEgressPolicy.swift:171 — Packages/OsaurusCore/Services/Sandbox/SandboxEgressPolicy.swift:171-175 | Packages/OsaurusCore/Services/Sandbox/SandboxEgressPolicy.swift:188-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 `Packages/OsaurusCore/Services/Sandbox/SandboxEgressPolicy.swift:188` 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 (13–15 lines × 3) · ×1
  • Duplicated block (13–15 lines × 3) scripts/live-proof/run-post1266-family-cache-tool-matrix.py:292 — scripts/live-proof/run-post1266-family-cache-tool-matrix.py:292-306 | scripts/live-proof/run-post1266-family-cache-tool-matrix.py:326-338 | scripts/live-proof/run-post1266-family-cache-tool-matrix.py:358-370 — 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.
D5 · Coupling · Off the main sequence · ×1
  • Off the main sequence: OsaurusNetworking — OsaurusNetworking: 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.
SC1 · Supply-chain hygiene · JavaScript dependencies are not locked · ×1
  • JavaScript dependencies are not locked docs/examples/login-with-osaurus/package.json:13 — docs/examples/login-with-osaurus/package.json declares dependencies that no committed lockfile resolves — there is no package-lock.json / yarn.lock / pnpm-lock.yaml / bun.lock beside it, and no locked workspace above it names it — so its installs aren't reproducible (SSDF PW.4.4). Commit its package manager's lockfile (or add it to the locked workspace) and install from it (`npm ci`, `yarn --immutable`, `pnpm i --frozen-lockfile` or `bun i --frozen-lockfile`). Advisory — never scored.
Minor — 126 finding(s)
X10 · Duplicated predicate · Duplicated predicate · ×40
  • Duplicated predicate scripts/live-proof/run-local-family-multiturn-tool-cache-proof.py:220 — `isinstance(left.get(key, 0), int) and isinstance(right.get(key, 0), int)` appears character-identically in 2 files — scripts/live-proof/run-local-family-multiturn-tool-cache-proof.py, scripts/live-proof/run-local-vl-media-cache-proof.py. 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 scripts/i18n/apply-ko.py:54 — `unit and isinstance(unit.get("value"), str) and unit["value"].strip()` appears character-identically in 2 files — scripts/i18n/apply-ko.py, scripts/i18n/export-untranslated.py. 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 Packages/OsaurusCore/Configuration/Declarative/ConfigChannelRouting.swift:425 — `!$0.isBuiltIn && $0.name.caseInsensitiveCompare(value) == .orderedSame` appears character-identically in 2 files — Packages/OsaurusCore/Configuration/Declarative/ConfigChannelRouting.swift, Packages/OsaurusCore/Configuration/Declarative/ConfigEvents.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Packages/OsaurusCore/Models/Event/OsaurusEvent.swift:530 — `!$0.isEmpty && seen.insert($0.lowercased()).inserted` appears character-identically in 2 files — Packages/OsaurusCore/Models/Event/OsaurusEvent.swift, Packages/OsaurusCore/Tools/CapabilityTools.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Packages/OsaurusCore/Services/Sync/SyncAttentionFeed.swift:217 — `!$0.isSelf && !$0.revoked && $0.devicePlatform.usesMacFeeds` appears character-identically in 2 files — Packages/OsaurusCore/Services/Sync/SyncAttentionFeed.swift, Packages/OsaurusCore/Services/Sync/SyncPhoneDevices.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Packages/OsaurusCore/Networking/HTTPHandler.swift:5718 — `!agent.isBuiltIn || agent.id == Agent.defaultId` appears character-identically in 2 files — Packages/OsaurusCore/Networking/HTTPHandler.swift, Packages/OsaurusCore/Services/Sync/SyncHostRunner.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Packages/OsaurusCore/Services/AgentChannel/AgentChannelTransportRuntime.swift:415 — `!config.readableChannelIds.isEmpty && !config.senderAllowlist.isEmpty` appears character-identically in 2 files — Packages/OsaurusCore/Services/AgentChannel/AgentChannelTransportRuntime.swift, Packages/OsaurusCore/Views/Settings/AgentChannelConnectionCenterView.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Packages/OsaurusCore/Views/Agent/AgentsView.swift:6978 — `!current.isEmpty && !builtIn.contains(current)` appears character-identically in 2 files — Packages/OsaurusCore/Views/Agent/AgentsView.swift, Packages/OsaurusCore/Views/Voice/TTSModeSettingsTab.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:1322 — `!diagnostics.failures.isEmpty || presentation.tone == .error` appears character-identically in 3 files — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift, Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift, Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:317 — `!helperVerified && helperDownloadAvailable` appears character-identically in 2 files — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift, Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift:216 — `!parseIds(readableChannelIdsText).isEmpty && !parseIds(senderAllowlistText).isEmpty` appears character-identically in 2 files — Packages/OsaurusCore/Views/Settings/DiscordSettingsView.swift, Packages/OsaurusCore/Views/Settings/SlackSettingsView.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift:230 — `!parseIds(readableChatIdsText).isEmpty && !parseIds(senderAllowlistText).isEmpty` appears character-identically in 3 files — Packages/OsaurusCore/Views/Settings/IMessageSettingsView.swift, Packages/OsaurusCore/Views/Settings/TelegramSettingsView.swift, Packages/OsaurusCore/Views/Settings/WhatsAppSettingsView.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:244 — `!regressions.isEmpty || !newFailures.isEmpty` appears character-identically in 2 files — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift, Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalDiff.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:2015 — `!rubric.isEmpty && verdicts.count != rubric.count` appears character-identically in 2 files — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift, Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerAgentLoop.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift:1205 — `!trimmed.isEmpty || !attachments.isEmpty` appears character-identically in 2 files — Packages/OsaurusCore/Services/IMessage/IMessageConnectionService.swift, Packages/OsaurusCore/Views/Chat/ChatSession+HostedRun.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Packages/OsaurusCore/Services/Context/CapabilitySearchHealth.swift:194 — `$0.enabled && !excluded.contains($0.name)` appears character-identically in 2 files — Packages/OsaurusCore/Services/Context/CapabilitySearchHealth.swift, Packages/OsaurusCore/Services/Tool/ToolSearchService.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Packages/OsaurusCore/Services/Sync/SyncNetworkDirectory.swift:76 — `$0.isASCII && ($0.isLetter || $0.isNumber || $0 == "-")` appears character-identically in 2 files — Packages/OsaurusCore/Services/Sync/SyncNetworkDirectory.swift, Packages/OsaurusRepository/OsaurusBundle.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Packages/OsaurusCore/Services/Inference/StructuredOutput.swift:370 — `$0.isDownloaded && $0.id.caseInsensitiveCompare(model) == .orderedSame` appears character-identically in 2 files — Packages/OsaurusCore/Services/Inference/StructuredOutput.swift, Packages/OsaurusCore/Services/Workflow/WorkflowEvalHarness.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Packages/OsaurusCore/Services/Sync/SyncKeyStores.swift:98 — `$0.isLetter || $0.isNumber || $0 == "-" || $0 == "_"` appears character-identically in 2 files — Packages/OsaurusCore/Services/Sync/SyncKeyStores.swift, Packages/OsaurusCore/Services/Workflow/PythonCodeNodeExecutor.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ContextOptimizer.swift:510 — `$0.outcome == .passed || $0.outcome == .failed` appears character-identically in 3 files — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/ContextOptimizer.swift, Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalDiff.swift, Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalMatrix.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Packages/OsaurusCore/Views/Settings/RemoteProviderReorderSheet.swift:108 — `$0.providerType != .osaurusRouter && manager.exposesModelsForInference($0)` appears character-identically in 2 files — Packages/OsaurusCore/Views/Settings/RemoteProviderReorderSheet.swift, Packages/OsaurusCore/Views/Settings/RemoteProvidersView.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Packages/OsaurusCore/Services/AgentChannel/ChannelAccountRemoval.swift:22 — `$0.reference != nil && $0.reference == account.reference` appears character-identically in 2 files — Packages/OsaurusCore/Services/AgentChannel/ChannelAccountRemoval.swift, Packages/OsaurusCore/Services/AgentChannel/ChannelAccounts.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Packages/OsaurusCore/Services/AgentChannel/AgentChannelInboundRelay.swift:977 — `$0.role == .assistant && !$0.contentIsBlank` appears character-identically in 2 files — Packages/OsaurusCore/Services/AgentChannel/AgentChannelInboundRelay.swift, Packages/OsaurusCore/Services/AgentChannel/AgentChannelWebhookIngress.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Packages/OsaurusCore/Services/Workflow/WorkflowRunService.swift:398 — `$0.status == .running || $0.status == .awaitingUser` appears character-identically in 2 files — Packages/OsaurusCore/Services/Workflow/WorkflowRunService.swift, Packages/OsaurusCore/Views/Workflow/FlowViewer/WorkflowFlowCanvas.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:572 — `(baseline == .failed || baseline == .errored) && current == .passed` appears character-identically in 2 files — Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift, Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalDiff.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • + 15 more in this group — see findings.md.
X7 · Silent fallback defaults · Silent fallback default in catch · ×39
  • Silent fallback default in catch Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Import/ImportCommand.swift:724 — `renderJSON` 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 Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunner.swift:2074 — `ungroundedSettingsPaths` 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 Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalRunnerSubagent.swift:502 — `crashReportSnapshot` 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 Packages/OsaurusRepository/ImportQueue.swift:329 — `pending` 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 Packages/OsaurusRepository/InstalledPluginsStore.swift:87 — `installedVersions` 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 Packages/OsaurusRepository/InstalledPluginsStore.swift:132 — `allInstalledPluginIds` 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 Packages/OsaurusCore/Networking/HTTPHandler.swift:9495 — `redactedPairInviteRequestBody` turns every thrown error into `"<redacted>"` — 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 Packages/OsaurusCore/Networking/HTTPHandler.swift:16431 — `ollamaGenerateJSON` turns every thrown error into `#"{"done":true}"#` — 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 Packages/OsaurusCore/Networking/HTTPHandler.swift:16472 — `ollamaChatJSON` turns every thrown error into `#"{"message":{"role":"assistant","content":""},"done":true}"#` — 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 Packages/OsaurusCore/Networking/HTTPHandler.swift:16493 — `ollamaGenerateErrorJSON` turns every thrown error into `#"{"error":{"message":"internal error","type":"internal_error"},"done":true}"#` — 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 Packages/OsaurusCore/Services/FavoriteModelsStore.swift:172 — `load` 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 Packages/OsaurusCore/Configuration/Declarative/OsaurusConfigTool.swift:1298 — `list` 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 Packages/OsaurusCore/Managers/Model/ModelManager.swift:1684 — `requestHFModels` 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 Packages/OsaurusCore/Managers/Plugin/PluginManager.swift:1641 — `quarantineEntries` 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 Packages/OsaurusCore/Managers/Plugin/SandboxPluginLibrary.swift:92 — `availableVersions` 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 Packages/OsaurusCore/Managers/Plugin/SandboxPluginLibrary.swift:220 — `highestVersion` 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 Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:2123 — `compactJSONString` turns every thrown error into `"null"` — 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 Packages/OsaurusCore/Models/Workflow/WorkflowDefinition.swift:2130 — `prettyJSONString` turns every thrown error into `"null"` — 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 Packages/OsaurusCore/Models/Agent/AgentStore.swift:207 — `reservedIdentities` 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 Packages/OsaurusCore/Models/Agent/AgentStore.swift:270 — `recoverableBackups` 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 Packages/OsaurusCore/Models/Agent/RemoteAgentStore.swift:20 — `loadAll` 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 Packages/OsaurusCore/Models/Agent/SkillStore.swift:366 — `loadFiles` 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 Packages/OsaurusCore/Models/Chat/AgentTodo.swift:75 — `parseItems` 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 Packages/OsaurusCore/Models/Configuration/ModelFormatDetection.swift:113 — `safetensorsFormatTags` 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 Packages/OsaurusCore/Models/Configuration/SearchProviderConfiguration.swift:494 — `loadCustom` 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.
  • + 14 more in this group — see findings.md.
X6 · Hand-rolled structured-format parsing · Hand-rolled JSON/XML parsing via regex · ×5
  • Hand-rolled JSON/XML parsing via regex Packages/OsaurusCore/Services/Workflow/WorkflowEvalHarness.swift:932 — 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.
  • Hand-rolled JSON/XML parsing via regex Packages/OsaurusCore/Services/Search/SearchHTMLHelpers.swift:432 — 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.
  • Hand-rolled JSON/XML parsing via regex Packages/OsaurusCore/Services/Provider/RemoteToolDetection.swift:48 — 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.
  • Hand-rolled JSON/XML parsing via regex Packages/OsaurusCore/Services/Provider/RemoteToolDetection.swift:49 — 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.
  • Hand-rolled JSON/XML parsing via regex Packages/OsaurusCore/Services/Provider/RemoteToolDetection.swift:50 — 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.
D16 · Bus Factor · Off-boarding risk · ×4
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 122 significant file(s) lose their only recent owner: Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsCreate.swift, Packages/OsaurusCore/Views/Settings/N8nSettingsView.swift, Packages/OsaurusCore/Tools/Database/DatabaseTools.swift, REDACTED, Packages/OsaurusCore/Services/AgentChannel/AgentChannelPublishService.swift, Packages/OsaurusCore/Views/Agent/Database/DatabaseTablesView.swift, Packages/OsaurusCore/Services/Router/OsaurusRouterTypes.swift, Packages/OsaurusCore/Services/Router/OsaurusRouterWorkspaceTypes.swift (+114 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 34 significant file(s) lose their only recent owner: Packages/OsaurusCore/AppleScript/Tool/AppleScriptToolDispatch.swift, Packages/OsaurusCore/Services/LocalGenerationDefaults.swift, Packages/OsaurusCore/Services/ChunkedFileDownloader.swift, Packages/OsaurusCore/Services/ModelRuntime/BatchDiagnosticsSnapshot.swift, Packages/OsaurusCore/Services/ModelRuntime/ImageGenerationTypes.swift, scripts/live-proof/run-local-family-multiturn-tool-cache-proof.py, Packages/OsaurusCore/Views/Settings/ServerSettings/MTPSection.swift, Packages/OsaurusCore/Services/ModelSSDResidency.swift (+26 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 27 significant file(s) lose their only recent owner: Packages/OsaurusCore/Views/Chat/ChatHistoryPane.swift, Packages/OsaurusCore/Views/Chat/NativeFileDiffView.swift, Packages/OsaurusCore/Managers/Chat/ChatSessionImporter.swift, Packages/OsaurusCore/PrivacyFilter/Core/CodeBlockMasker.swift, Packages/OsaurusCore/Views/Chat/ChatCrossSelection.swift, Packages/OsaurusCore/Services/Knowledge/KnowledgeDocumentParser.swift, Packages/OsaurusCore/Models/Knowledge/KnowledgeCollection.swift, Packages/OsaurusCore/Services/MobileConnect/DetachedPhoneRuns.swift (+19 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 23 significant file(s) lose their only recent owner: Packages/OsaurusCore/Services/Documents/PPTXAdapter.swift, Packages/OsaurusCore/Managers/SkillImportPolicy.swift, Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Bench.swift, Packages/OsaurusCore/Utils/StorageLocationStandards.swift, Packages/OsaurusCore/Services/SupportDiagnosticsBundle.swift, Packages/OsaurusCore/Services/Documents/ExternalOfficeRuntimeDetector.swift, Packages/OsaurusCore/Services/ModelRuntime/RuntimeProofValidation.swift, Packages/OsaurusCore/Services/ModelRuntime/RuntimeProofMatrixReporter.swift (+15 more). Pair on, review, or document these before any departure.
D21 · Naming Consistency · `partialJson` spells `Json` where 468 names in the project spell it `JSON` · ×2
  • `partialJson` spells `Json` where 468 names in the project spell it `JSON` Packages/OsaurusCore/Models/API/AnthropicAPI.swift:792 — 468 of 476 names in project repository spell the token `JSON` (468 of 476; unit: names in project repository containing `JSON`). Peers: MailSendApproval.sends(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:307); MailComposeTool.requiresApprovalEveryCall(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:316); MailReplyTool.requiresApprovalEveryCall(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:320); AppleToolBase.execute(argumentsJSON) (Packages/OsaurusCore/AppleApps/Support/AppleToolBase.swift:159); repository.AppleJSON (Packages/OsaurusCore/AppleApps/Support/AppleToolBase.swift:325). Rename to `partialJSON`. [rule N6]
  • `partialJson` spells `Json` where 468 names in the project spell it `JSON` Packages/OsaurusCore/Models/API/AnthropicAPI.swift:867 — 468 of 476 names in project repository spell the token `JSON` (468 of 476; unit: names in project repository containing `JSON`). Peers: MailSendApproval.sends(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:307); MailComposeTool.requiresApprovalEveryCall(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:316); MailReplyTool.requiresApprovalEveryCall(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:320); AppleToolBase.execute(argumentsJSON) (Packages/OsaurusCore/AppleApps/Support/AppleToolBase.swift:159); repository.AppleJSON (Packages/OsaurusCore/AppleApps/Support/AppleToolBase.swift:325). Rename to `partialJSON`. [rule N6]
D21 · Naming Consistency · `mcpJsonPath` spells `Json` where 468 names in the project spell it `JSON` · ×2
  • `mcpJsonPath` spells `Json` where 468 names in the project spell it `JSON` Packages/OsaurusCore/Services/GitHubSkillService.swift:412 — 468 of 476 names in project repository spell the token `JSON` (468 of 476; unit: names in project repository containing `JSON`). Peers: MailSendApproval.sends(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:307); MailComposeTool.requiresApprovalEveryCall(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:316); MailReplyTool.requiresApprovalEveryCall(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:320); AppleToolBase.execute(argumentsJSON) (Packages/OsaurusCore/AppleApps/Support/AppleToolBase.swift:159); repository.AppleJSON (Packages/OsaurusCore/AppleApps/Support/AppleToolBase.swift:325). Rename to `mcpJSONPath`. [rule N6]
  • `mcpJsonPath` spells `Json` where 468 names in the project spell it `JSON` Packages/OsaurusCore/Services/GitHubSkillService.swift:447 — 468 of 476 names in project repository spell the token `JSON` (468 of 476; unit: names in project repository containing `JSON`). Peers: MailSendApproval.sends(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:307); MailComposeTool.requiresApprovalEveryCall(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:316); MailReplyTool.requiresApprovalEveryCall(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:320); AppleToolBase.execute(argumentsJSON) (Packages/OsaurusCore/AppleApps/Support/AppleToolBase.swift:159); repository.AppleJSON (Packages/OsaurusCore/AppleApps/Support/AppleToolBase.swift:325). Rename to `mcpJSONPath`. [rule N6]
D34 · Knowledge Freshness · Orphaned file · ×2
  • Orphaned file Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Bundle/MCPBundleManager.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 Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Bundle/BundleLoad.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 · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 3 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 (210 single-owned of 1940 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; 1940 of the 2189 production source files in this repository met that bar). They are anonymized user #5 (1 file(s)), anonymized user #6 (1 file(s)), anonymized user #7 (1 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: scripts/i18n/lint-zh-style.py, Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Bundle/MCPBundleManager.swift, Packages/OsaurusCLI/Sources/OsaurusCLICore/Services/ServerSupervisor.swift.
D21 · Naming Consistency · `getProcessForPID` spells `PID` where 18 names in the project spell it `Pid` · ×1
  • `getProcessForPID` spells `PID` where 18 names in the project spell it `Pid` Packages/OsaurusCore/ComputerUse/Driver/Mac/SkyLightBridge.swift:249 — 18 of 20 names in project repository spell the token `Pid` (18 of 20; unit: names in project repository containing `Pid`). Peers: AccessibilityManager.selfPid (Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:224); AccessibilityManager.mostRecentPid (Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:506); Accessibility.swift.listWindowsForPid (Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:1651); Transports.postToPid (Packages/OsaurusCore/ComputerUse/Driver/Mac/BackgroundDriver.swift:170); ScreenshotController.ownerPid (Packages/OsaurusCore/ComputerUse/Driver/Mac/Screenshot.swift:358). Rename to `getProcessForPid`. [rule N6]
D21 · Naming Consistency · `InputJsonDelta` spells `Json` where 468 names in the project spell it `JSON` · ×1
  • `InputJsonDelta` spells `Json` where 468 names in the project spell it `JSON` Packages/OsaurusCore/Models/API/AnthropicAPI.swift:788 — 468 of 476 names in project repository spell the token `JSON` (468 of 476; unit: names in project repository containing `JSON`). Peers: MailSendApproval.sends(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:307); MailComposeTool.requiresApprovalEveryCall(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:316); MailReplyTool.requiresApprovalEveryCall(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:320); AppleToolBase.execute(argumentsJSON) (Packages/OsaurusCore/AppleApps/Support/AppleToolBase.swift:159); repository.AppleJSON (Packages/OsaurusCore/AppleApps/Support/AppleToolBase.swift:325). Rename to `InputJSONDelta`. [rule N6]
D21 · Naming Consistency · `responseJsonSchema` spells `Json` where 468 names in the project spell it `JSON` · ×1
  • `responseJsonSchema` spells `Json` where 468 names in the project spell it `JSON` Packages/OsaurusCore/Models/API/GeminiAPI.swift:255 — 468 of 476 names in project repository spell the token `JSON` (468 of 476; unit: names in project repository containing `JSON`). Peers: MailSendApproval.sends(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:307); MailComposeTool.requiresApprovalEveryCall(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:316); MailReplyTool.requiresApprovalEveryCall(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:320); AppleToolBase.execute(argumentsJSON) (Packages/OsaurusCore/AppleApps/Support/AppleToolBase.swift:159); repository.AppleJSON (Packages/OsaurusCore/AppleApps/Support/AppleToolBase.swift:325). Rename to `responseJSONSchema`. [rule N6]
D21 · Naming Consistency · `ImageUrlContent` spells `Url` where 647 names in the project spell it `URL` · ×1
  • `ImageUrlContent` spells `Url` where 647 names in the project spell it `URL` Packages/OsaurusCore/Models/API/OpenAIAPI.swift:240 — 647 of 654 names in project repository spell the token `URL` (647 of 654; unit: names in project repository containing `URL`). Peers: osaurusApp.openURL (App/osaurus/osaurusApp.swift:502); OsaurusLocalClient.resolveBaseURL (Packages/OsaurusCore/AppIntents/OsaurusLocalClient.swift:198); AppleAppsConfigurationStore.fileURL (Packages/OsaurusCore/AppleApps/AppleAppsPluginMigration.swift:89); CalendarEventInfo.openURL (Packages/OsaurusCore/AppleApps/Calendar/CalendarService.swift:73); ContactInfo.openURL (Packages/OsaurusCore/AppleApps/Contacts/ContactsService.swift:49). Rename to `ImageURLContent`. [rule N6]
D21 · Naming Consistency · `VideoUrlContent` spells `Url` where 647 names in the project spell it `URL` · ×1
  • `VideoUrlContent` spells `Url` where 647 names in the project spell it `URL` Packages/OsaurusCore/Models/API/OpenAIAPI.swift:250 — 647 of 654 names in project repository spell the token `URL` (647 of 654; unit: names in project repository containing `URL`). Peers: osaurusApp.openURL (App/osaurus/osaurusApp.swift:502); OsaurusLocalClient.resolveBaseURL (Packages/OsaurusCore/AppIntents/OsaurusLocalClient.swift:198); AppleAppsConfigurationStore.fileURL (Packages/OsaurusCore/AppleApps/AppleAppsPluginMigration.swift:89); CalendarEventInfo.openURL (Packages/OsaurusCore/AppleApps/Calendar/CalendarService.swift:73); ContactInfo.openURL (Packages/OsaurusCore/AppleApps/Contacts/ContactsService.swift:49). Rename to `VideoURLContent`. [rule N6]
D21 · Naming Consistency · `imageUrl` spells `Url` where 647 names in the project spell it `URL` · ×1
  • `imageUrl` spells `Url` where 647 names in the project spell it `URL` Packages/OsaurusCore/Models/API/OpenResponsesAPI.swift:450 — 647 of 654 names in project repository spell the token `URL` (647 of 654; unit: names in project repository containing `URL`). Peers: osaurusApp.openURL (App/osaurus/osaurusApp.swift:502); OsaurusLocalClient.resolveBaseURL (Packages/OsaurusCore/AppIntents/OsaurusLocalClient.swift:198); AppleAppsConfigurationStore.fileURL (Packages/OsaurusCore/AppleApps/AppleAppsPluginMigration.swift:89); CalendarEventInfo.openURL (Packages/OsaurusCore/AppleApps/Calendar/CalendarService.swift:73); ContactInfo.openURL (Packages/OsaurusCore/AppleApps/Contacts/ContactsService.swift:49). Rename to `imageURL`. [rule N6]
D21 · Naming Consistency · `chatJsonNeedsLegacyMigration` spells `Json` where 468 names in the project spell it `JSON` · ×1
  • `chatJsonNeedsLegacyMigration` spells `Json` where 468 names in the project spell it `JSON` Packages/OsaurusCore/Models/Configuration/AppConfiguration.swift:221 — 468 of 476 names in project repository spell the token `JSON` (468 of 476; unit: names in project repository containing `JSON`). Peers: MailSendApproval.sends(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:307); MailComposeTool.requiresApprovalEveryCall(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:316); MailReplyTool.requiresApprovalEveryCall(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:320); AppleToolBase.execute(argumentsJSON) (Packages/OsaurusCore/AppleApps/Support/AppleToolBase.swift:159); repository.AppleJSON (Packages/OsaurusCore/AppleApps/Support/AppleToolBase.swift:325). Rename to `chatJSONNeedsLegacyMigration`. [rule N6]
D21 · Naming Consistency · `kgPIN` spells `PIN` where 13 names in the project spell it `Pin` · ×1
  • `kgPIN` spells `PIN` where 13 names in the project spell it `Pin` Packages/OsaurusCore/PrivacyFilter/Core/PrivacyRulePresets+AsiaPacific.swift:691 — 13 of 14 names in project repository spell the token `Pin` (13 of 14; unit: names in project repository containing `Pin`). Peers: IMessageRuntimeAssets.verifyExecutableCandidates(executablePin) (Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift:266); IMessageRuntimeAssets.verifyBridgeDylib(dylibPin) (Packages/OsaurusCore/Services/IMessage/IMessageRuntimeAssets.swift:319); WhatsAppRuntimeAssets.verifyExecutableCandidates(executablePin) (Packages/OsaurusCore/Services/WhatsApp/WhatsAppRuntimeAssets.swift:161); InlineTodoBlock.togglePin (Packages/OsaurusCore/Views/Chat/AgentInlineBlocks.swift:246); SessionRow.onTogglePin (Packages/OsaurusCore/Views/Chat/ChatSessionSidebar.swift:2950). Rename to `kgPin`. [rule N6]
D21 · Naming Consistency · `mtimeNs` spells `Ns` where 142 names in the project spell it `NS` · ×1
  • `mtimeNs` spells `Ns` where 142 names in the project spell it `NS` Packages/OsaurusCore/Services/FileHistory/FileChangeJournal.swift:40 — 142 of 143 names in project repository spell the token `NS` (142 of 143; unit: names in project repository containing `NS`). Peers: CatalogBaseMaterial.makeNSView (Packages/OsaurusCore/DevelopmentDesign/CatalogInspector.swift:257); CatalogBaseMaterial.updateNSView (Packages/OsaurusCore/DevelopmentDesign/CatalogInspector.swift:258); CatalogNativeArtifactPreview.makeNSView (Packages/OsaurusCore/DevelopmentDesign/CatalogNativePreview.swift:96); CatalogNativeArtifactPreview.updateNSView (Packages/OsaurusCore/DevelopmentDesign/CatalogNativePreview.swift:97); InspectorNativeActivity.makeNSView (Packages/OsaurusCore/DevelopmentDesign/InspectorActivityVerification.swift:61). Rename to `mtimeNS`. [rule N6]
D21 · Naming Consistency · `materializeMediaDataUrl` spells `Url` where 647 names in the project spell it `URL` · ×1
  • `materializeMediaDataUrl` spells `Url` where 647 names in the project spell it `URL` Packages/OsaurusCore/Services/ModelRuntime.swift:7941 — 647 of 654 names in project repository spell the token `URL` (647 of 654; unit: names in project repository containing `URL`). Peers: osaurusApp.openURL (App/osaurus/osaurusApp.swift:502); OsaurusLocalClient.resolveBaseURL (Packages/OsaurusCore/AppIntents/OsaurusLocalClient.swift:198); AppleAppsConfigurationStore.fileURL (Packages/OsaurusCore/AppleApps/AppleAppsPluginMigration.swift:89); CalendarEventInfo.openURL (Packages/OsaurusCore/AppleApps/Calendar/CalendarService.swift:73); ContactInfo.openURL (Packages/OsaurusCore/AppleApps/Contacts/ContactsService.swift:49). Rename to `materializeMediaDataURL`. [rule N6]
D21 · Naming Consistency · `materializeMediaDataUrlResult` spells `Url` where 647 names in the project spell it `URL` · ×1
  • `materializeMediaDataUrlResult` spells `Url` where 647 names in the project spell it `URL` Packages/OsaurusCore/Services/ModelRuntime.swift:7953 — 647 of 654 names in project repository spell the token `URL` (647 of 654; unit: names in project repository containing `URL`). Peers: osaurusApp.openURL (App/osaurus/osaurusApp.swift:502); OsaurusLocalClient.resolveBaseURL (Packages/OsaurusCore/AppIntents/OsaurusLocalClient.swift:198); AppleAppsConfigurationStore.fileURL (Packages/OsaurusCore/AppleApps/AppleAppsPluginMigration.swift:89); CalendarEventInfo.openURL (Packages/OsaurusCore/AppleApps/Calendar/CalendarService.swift:73); ContactInfo.openURL (Packages/OsaurusCore/AppleApps/Contacts/ContactsService.swift:49). Rename to `materializeMediaDataURLResult`. [rule N6]
D21 · Naming Consistency · `fromImageUrl` spells `Url` where 647 names in the project spell it `URL` · ×1
  • `fromImageUrl` spells `Url` where 647 names in the project spell it `URL` Packages/OsaurusCore/Services/Provider/RemoteProviderService.swift:4494 — 647 of 654 names in project repository spell the token `URL` (647 of 654; unit: names in project repository containing `URL`). Peers: osaurusApp.openURL (App/osaurus/osaurusApp.swift:502); OsaurusLocalClient.resolveBaseURL (Packages/OsaurusCore/AppIntents/OsaurusLocalClient.swift:198); AppleAppsConfigurationStore.fileURL (Packages/OsaurusCore/AppleApps/AppleAppsPluginMigration.swift:89); CalendarEventInfo.openURL (Packages/OsaurusCore/AppleApps/Calendar/CalendarService.swift:73); ContactInfo.openURL (Packages/OsaurusCore/AppleApps/Contacts/ContactsService.swift:49). Rename to `fromImageURL`. [rule N6]
D21 · Naming Consistency · `currentPID` spells `PID` where 18 names in the project spell it `Pid` · ×1
  • `currentPID` spells `PID` where 18 names in the project spell it `Pid` Packages/OsaurusCore/Services/Sandbox/SandboxManager.swift:4769 — 18 of 20 names in project repository spell the token `Pid` (18 of 20; unit: names in project repository containing `Pid`). Peers: AccessibilityManager.selfPid (Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:224); AccessibilityManager.mostRecentPid (Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:506); Accessibility.swift.listWindowsForPid (Packages/OsaurusCore/ComputerUse/Driver/Mac/Accessibility.swift:1651); Transports.postToPid (Packages/OsaurusCore/ComputerUse/Driver/Mac/BackgroundDriver.swift:170); ScreenshotController.ownerPid (Packages/OsaurusCore/ComputerUse/Driver/Mac/Screenshot.swift:358). Rename to `currentPid`. [rule N6]
D21 · Naming Consistency · `mcpJson` spells `Json` where 468 names in the project spell it `JSON` · ×1
  • `mcpJson` spells `Json` where 468 names in the project spell it `JSON` Packages/OsaurusCore/Services/Skill/ClaudePluginInstaller.swift:857 — 468 of 476 names in project repository spell the token `JSON` (468 of 476; unit: names in project repository containing `JSON`). Peers: MailSendApproval.sends(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:307); MailComposeTool.requiresApprovalEveryCall(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:316); MailReplyTool.requiresApprovalEveryCall(argumentsJSON) (Packages/OsaurusCore/AppleApps/Mail/MailTools.swift:320); AppleToolBase.execute(argumentsJSON) (Packages/OsaurusCore/AppleApps/Support/AppleToolBase.swift:159); repository.AppleJSON (Packages/OsaurusCore/AppleApps/Support/AppleToolBase.swift:325). Rename to `mcpJSON`. [rule N6]
D21 · Naming Consistency · `licenseUrl` spells `Url` where 647 names in the project spell it `URL` · ×1
  • `licenseUrl` spells `Url` where 647 names in the project spell it `URL` Packages/OsaurusCore/Views/Management/AcknowledgementsView.swift:25 — 647 of 654 names in project repository spell the token `URL` (647 of 654; unit: names in project repository containing `URL`). Peers: osaurusApp.openURL (App/osaurus/osaurusApp.swift:502); OsaurusLocalClient.resolveBaseURL (Packages/OsaurusCore/AppIntents/OsaurusLocalClient.swift:198); AppleAppsConfigurationStore.fileURL (Packages/OsaurusCore/AppleApps/AppleAppsPluginMigration.swift:89); CalendarEventInfo.openURL (Packages/OsaurusCore/AppleApps/Calendar/CalendarService.swift:73); ContactInfo.openURL (Packages/OsaurusCore/AppleApps/Contacts/ContactsService.swift:49). Rename to `licenseURL`. [rule N6]
D21 · Naming Consistency · `isDirInPATH` spells `PATH` where 622 names in the project spell it `Path` · ×1
  • `isDirInPATH` spells `PATH` where 622 names in the project spell it `Path` Packages/OsaurusCore/Views/Settings/CommandLineToolSection.swift:176 — 622 of 623 names in project repository spell the token `Path` (622 of 623; unit: names in project repository containing `Path`). Peers: MailMessageSummary.mailboxPath (Packages/OsaurusCore/AppleApps/Mail/MailService.swift:50); MailMessageContent.mailboxPath (Packages/OsaurusCore/AppleApps/Mail/MailService.swift:71); MailQuery.mailboxPath (Packages/OsaurusCore/AppleApps/Mail/MailService.swift:77); MailSearchQuery.mailboxPath (Packages/OsaurusCore/AppleApps/Mail/MailService.swift:89); MailServicing.read(mailboxPath) (Packages/OsaurusCore/AppleApps/Mail/MailService.swift:112). Rename to `isDirInPath`. [rule N6]
D21 · Naming Consistency · `caseID` spells `ID` where 134 names in the project spell it `Id` · ×1
  • `caseID` spells `ID` where 134 names in the project spell it `Id` Packages/OsaurusEvals/Sources/OsaurusEvalsKit/EvalSuite.swift:19 — 134 of 135 names in project Packages~OsaurusEvals~OsaurusEvalsCLI spell the token `Id` (134 of 135; unit: names in project Packages~OsaurusEvals~OsaurusEvalsCLI containing `Id`). Peers: OsaurusEvalsCLI.runFinalistLane(censusModelId) (Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/ContextOptimizeCLI.swift:279); OsaurusEvalsCLI.runMergedReport(censusModelId) (Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/ContextOptimizeCLI.swift:338); OsaurusEvalsCLI.runArguments(modelId) (Packages/OsaurusEvals/Sources/OsaurusEvalsCLI/EvalReviewReportCLI.swift:633); AgentLoopRegressionCaseSnapshot.modelId (Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:145); AgentLoopRegressionLabSummary.baselineModelId (Packages/OsaurusEvals/Sources/OsaurusEvalsKit/AgentLoopRegressionLab.swift:228). Rename to `caseId`. [rule N6]
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 3 of 9 project(s) overshoot their size bounds, lowering Project Cohesion to 4.3/10. The most over is `Packages/OsaurusCore` (776133 LoC, 7479 module-visible types across 212 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 · Orphaned files with no living knowledge · ×1
  • Orphaned files with no living knowledge — 2 of 1940 analysed file(s) have no living knowledge left — their last meaningful change has decayed away, so if one breaks, no one currently understands it (counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 1940 of the 2189 production source files in this repository met that bar). None is large enough to earn a read-through of its own, so this row stands in for the per-file rows rather than raising one each — most significant first: Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Bundle/MCPBundleManager.swift, Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Bundle/BundleLoad.swift. Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D37 · Vulnerability-disclosure Policy · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · ADRs not easily discoverable · ×1
  • ADRs not easily discoverable — 1 ADR-shaped document(s) detected by content — `Packages/OsaurusEvals/Config/capability-search-sweep.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 4/7 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `Packages/OsaurusCLI`, `helpers/osaurus-wa`.
P3 · Security & performance tooling · No SAST · ×1
  • No SAST REDACTED:4 — 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 6 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
P3 · Security & performance tooling · No dependency-update automation · ×1
  • No dependency-update automation docs/examples/login-with-osaurus/package.json:13 — `docs/examples/login-with-osaurus/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
X5 · Nullable reference types · Strict null checking is not enabled everywhere the repository type-checks · ×1
  • Strict null checking is not enabled everywhere the repository type-checks — This repository commits no tsconfig, so whatever type-checks it uses tsc's own defaults, in which `strict` and `strictNullChecks` are OFF: `string` admits `null` and `undefined`, and a value that is null is compiled through to the property access that throws. If the build passes `--strict` on a command line instead, put it in a committed tsconfig — this check reads configuration, and configuration is all it can read.
X7 · Silent fallback defaults · Silent fallback default on parse failure · ×1
  • Silent fallback default on parse failure scripts/evals/plan-installed-vision.py:19 — `object_at` returns `{}` when `(OSError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
X9 · Subsumed condition operand · Subsumed condition operand · ×1
  • Subsumed condition operand Packages/OsaurusCore/Services/ChatImport/ChatImportSourceResolver.swift:101 — `path.hasSuffix("/.well-known/agent-card.json")` can never decide this `||` — every value satisfying `path.hasSuffix("/.well-known/agent-card.json")` also satisfies `path.hasSuffix("/agent-card.json")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Minor — 68 finding(s)
D10 · Test Quality · Skipped (documented) · ×37
  • Skipped (documented): everyMascotRenders Packages/OsaurusCore/Tests/Agent/AvatarBitmapRendererTests.swift:120 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): repeatedMascotRequestsHitTheCache Packages/OsaurusCore/Tests/Agent/AvatarBitmapRendererTests.swift:130 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): disabledKeychainFailsLoudly Packages/OsaurusCore/Tests/Identity/IdentityRestoreTests.swift:65 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): inspectInstalledBundles Packages/OsaurusCore/Tests/Model/InstalledVisionEvidenceProbeTests.swift:7 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): installedBundlesReportTheirLanes Packages/OsaurusCore/Tests/Model/LFM3MediaCapabilityTests.swift:30 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): mapping_prefersFreshPreencodedLiveAudio Packages/OsaurusCore/Tests/Model/MultimodalContentPartTests.swift:258 — Skipped with a documented reason — a deferral, not lazy debt: Requires an MLXArray fixture; local SwiftPM tests cannot load default.metallib.
  • Skipped (documented): mapping_ignoresStalePreencodedLiveAudio Packages/OsaurusCore/Tests/Model/MultimodalContentPartTests.swift:302 — Skipped with a documented reason — a deferral, not lazy debt: Requires an MLXArray fixture; local SwiftPM tests cannot load default.metallib.
  • Skipped (documented): temporalSlotsAreFilled Packages/OsaurusCore/Tests/Model/MuseGlimmerImageGeometryTests.swift:40 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): geometryIsConsistent Packages/OsaurusCore/Tests/Model/MuseGlimmerImageGeometryTests.swift:72 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): specialsAreAtomic Packages/OsaurusCore/Tests/Model/MuseGlimmerTokenizerProbeTests.swift:29 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): templateRendersStrength Packages/OsaurusCore/Tests/Model/MuseGlimmerTokenizerProbeTests.swift:45 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): roundTrip Packages/OsaurusCore/Tests/Model/MuseGlimmerTokenizerProbeTests.swift:67 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): allFourStrengthsRenderDistinctPrefixes Packages/OsaurusCore/Tests/Model/MuseGlimmerTokenizerProbeTests.swift:77 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): strengthLineIsInThePrefix Packages/OsaurusCore/Tests/Model/MuseGlimmerTokenizerProbeTests.swift:116 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): imagePartRendersPatch Packages/OsaurusCore/Tests/Model/MuseGlimmerTokenizerProbeTests.swift:139 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): mediaPlaceholdersAtomic Packages/OsaurusCore/Tests/Model/MuseGlimmerTokenizerProbeTests.swift:157 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): imagePartRendersPatchWithNilContext Packages/OsaurusCore/Tests/Model/MuseGlimmerTokenizerProbeTests.swift:170 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): modelSeesTheBands Packages/OsaurusCore/Tests/Model/MuseGlimmerVisionLiveTests.swift:43 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): forcedChoiceHue Packages/OsaurusCore/Tests/Model/MuseGlimmerVisionLiveTests.swift:101 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): solidColourFields Packages/OsaurusCore/Tests/Model/MuseGlimmerVisionLiveTests.swift:167 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): realPhotographs Packages/OsaurusCore/Tests/Model/MuseGlimmerVisionLiveTests.swift:223 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): verticalPosition Packages/OsaurusCore/Tests/Model/MuseGlimmerVisionLiveTests.swift:275 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): perceptionDump Packages/OsaurusCore/Tests/Model/MuseGlimmerVisionLiveTests.swift:348 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): shapeBattery Packages/OsaurusCore/Tests/Model/MuseGlimmerVisionLiveTests.swift:381 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): shapeDiscrimination Packages/OsaurusCore/Tests/Model/MuseGlimmerVisionLiveTests.swift:445 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • + 12 more in this group — see findings.md.
D12 · Dependency Hygiene · Outdated · ×31
  • Outdated: async-http-client — `async-http-client` is resolved at 1.33.1, but 1.37.0 is the newest release tagged on https://github.com/swift-server/async-http-client.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update async-http-client` reaches this one with no change to Package.swift.
  • Outdated: eventsource — `eventsource` is resolved at 1.4.1, but 1.6.0 is the newest release tagged on https://github.com/mattt/eventsource.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update eventsource` reaches this one with no change to Package.swift.
  • Outdated: fluidaudio — `fluidaudio` is resolved at 0.14.1, but 0.18.3 is the newest release tagged on https://github.com/FluidInference/FluidAudio.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update fluidaudio` reaches this one with no change to Package.swift.
  • Outdated: grpc-swift-2 — `grpc-swift-2` is resolved at 2.4.0, but 2.4.4 is the newest release tagged on https://github.com/grpc/grpc-swift-2.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update grpc-swift-2` reaches this one with no change to Package.swift.
  • Outdated: grpc-swift-nio-transport — `grpc-swift-nio-transport` is resolved at 2.9.2, but 2.12.0 is the newest release tagged on https://github.com/grpc/grpc-swift-nio-transport.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update grpc-swift-nio-transport` reaches this one with no change to Package.swift.
  • Outdated: grpc-swift-protobuf — `grpc-swift-protobuf` is resolved at 2.3.0, but 2.5.0 is the newest release tagged on https://github.com/grpc/grpc-swift-protobuf.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update grpc-swift-protobuf` reaches this one with no change to Package.swift.
  • Outdated: ikigajson — `ikigajson` is resolved at 2.5.0, but 2.5.4 is the newest release tagged on https://github.com/orlandos-nl/IkigaJSON within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update ikigajson` reaches this one with no change to Package.swift.
  • Outdated: ikigajson — `ikigajson` is resolved at 2.4.3, but 2.5.4 is the newest release tagged on https://github.com/orlandos-nl/IkigaJSON within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update ikigajson` reaches this one with no change to Package.swift.
  • Outdated: rive-ios — `rive-ios` is resolved at 6.29.0, but 6.30.1 is the newest release tagged on https://github.com/rive-app/rive-ios within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update rive-ios` reaches this one with no change to Package.swift.
  • Outdated: sentry-cocoa — `sentry-cocoa` is resolved at 9.15.0, but 9.34.0 is the newest release tagged on https://github.com/getsentry/sentry-cocoa.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update sentry-cocoa` reaches this one with no change to Package.swift.
  • Outdated: sparkle — `sparkle` is resolved at 2.9.2, 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: sparkle — `sparkle` is resolved at 2.9.1, 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: swift-argument-parser — `swift-argument-parser` is resolved at 1.7.1, but 1.8.2 is the newest release tagged on https://github.com/apple/swift-argument-parser.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-argument-parser` reaches this one with no change to Package.swift.
  • Outdated: swift-asn1 — `swift-asn1` is resolved at 1.7.0, but 1.7.4 is the newest release tagged on https://github.com/apple/swift-asn1.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-asn1` reaches this one with no change to Package.swift.
  • Outdated: swift-async-algorithms — `swift-async-algorithms` is resolved at 1.1.4, but 1.1.7 is the newest release tagged on https://github.com/apple/swift-async-algorithms.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-async-algorithms` reaches this one with no change to Package.swift.
  • Outdated: swift-atomics — `swift-atomics` is resolved at 1.3.0, but 1.3.1 is the newest release tagged on https://github.com/apple/swift-atomics.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-atomics` reaches this one with no change to Package.swift.
  • Outdated: swift-certificates — `swift-certificates` is resolved at 1.19.0, but 1.21.1 is the newest release tagged on https://github.com/apple/swift-certificates.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-certificates` reaches this one with no change to Package.swift.
  • Outdated: swift-collections — `swift-collections` is resolved at 1.5.1, but 1.7.6 is the newest release tagged on https://github.com/apple/swift-collections.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-collections` reaches this one with no change to Package.swift.
  • Outdated: swift-configuration — `swift-configuration` is resolved at 1.2.0, but 1.5.0 is the newest release tagged on https://github.com/apple/swift-configuration.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-configuration` reaches this one with no change to Package.swift.
  • Outdated: swift-distributed-tracing — `swift-distributed-tracing` is resolved at 1.4.1, but 1.7.4 is the newest release tagged on https://github.com/apple/swift-distributed-tracing.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-distributed-tracing` reaches this one with no change to Package.swift.
  • Outdated: swift-http-types — `swift-http-types` is resolved at 1.6.0, but 1.8.0 is the newest release tagged on https://github.com/apple/swift-http-types.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-http-types` reaches this one with no change to Package.swift.
  • Outdated: swift-log — `swift-log` is resolved at 1.12.0, but 1.17.0 is the newest release tagged on https://github.com/apple/swift-log.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-log` reaches this one with no change to Package.swift.
  • Outdated: swift-nio — `swift-nio` is resolved at 2.99.0, but 2.105.0 is the newest release tagged on https://github.com/apple/swift-nio.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-nio` reaches this one with no change to Package.swift.
  • Outdated: swift-nio-extras — `swift-nio-extras` is resolved at 1.34.0, but 1.35.2 is the newest release tagged on https://github.com/apple/swift-nio-extras.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-nio-extras` reaches this one with no change to Package.swift.
  • Outdated: swift-nio-http2 — `swift-nio-http2` is resolved at 1.43.0, but 1.46.0 is the newest release tagged on https://github.com/apple/swift-nio-http2.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-nio-http2` reaches this one with no change to Package.swift.
  • + 6 more in this group — see findings.md.

Appendix B — Reproduction & audit trail

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

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-a06045db6c2442649705d29b76a1cff6/history.json --exit-code 0 --source .711artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-a06045db6c2442649705d29b76a1cff6/tree.json --exit-code 0 --source .355artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/canine-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt --exclude Packages/Vendor/OsaurusSync/Sources/OsaurusSync/Generated .50artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .11artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy config --format json --quiet .0artifacts/raw/trivy-config.json
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 282 file(s) — `Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Bench.swift`, `Packages/OsaurusCLI/Sources/OsaurusCLICore/Commands/Tools/ToolsDev.swift`, `Packages/OsaurusCLI/Sources/OsaurusCLICore/Services/InstallationDiagnostics.swift`, `Packages/OsaurusCore/AppDelegate.swift`, `Packages/OsaurusCore/AppleApps/Calendar/CalendarService.swift`, … (+277 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .0artifacts/raw/trivy-fs.json

Run 01a1d96c-f8b7-7fb5-a6bb-a0cda20cbf96 · 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