Public report of xg-gh-25/SwarmAI, published 9 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.2). 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, 9 November 2026, 05:10 UTC · Survey ID cd_e1eb7a98806546d7b2a57412a0646dfb

xg-gh-25/SwarmAI

Measured 9 November 2026, 05:08 UTC, at code version 130052e

Code coverage is not measured: JavaScript/TypeScript suite (CouldNotMeasureNoCollector).

CAI score 48out of 100 At risk Down 1 since the last survey

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

A large codebase: 362,883 lines of product code in 5 projects, tests not counted · Estimated rebuild effort: about 4.2 person-years · Weakest lens: Production Readiness, 41

Findings by how serious they are

217 critical 3192 serious 277 minor

10 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
9 November 2026, 05:08 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.

A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.

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 ▸

91of 91 dimensions measured by tools.
3661of 3686 findings point to an exact file and line, so you can open each one in the code. The other 25 concern the repository as a whole, such as missing documentation.
91dimensions across 7 lenses, read from 362,883 lines of product code in 5 projects.
Chapters

Executive summary

xg-gh-25/SwarmAI is rated At risk because critical security findings are open, most of them in the build pipeline. Its score is held back because two passwords or keys sit in the current code and we found no automated security scanning of the code, its secrets or its dependencies. It scores 48 out of 100, which the At risk rating leaves unchanged.

Production Readiness, at 41, is the weakest lens and counts most in the score. The best first step is replacing the two exposed passwords or keys and switching the old ones off, worth about 7 points. Adding automated security scanning comes next, worth about 5 points. Raising Production Readiness to 70 would lift the score to about 55.

Sixty-seven pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Thirty-five known security holes in the packages the code depends on can be used by attackers, and thirty-seven controls can't be used without a mouse. Pinning each tool to an exact version, updating the vulnerable packages and making the controls work with a keyboard would close these risks. Fixing the weaknesses the scanner points to would fix the five security weaknesses in the code, and the 12 pipeline steps that install packages without pinning their versions need the packages they install pinned to exact versions. The 20 form fields without a label need a label.

The product code is 362,883 lines, about €610,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.
Production Readiness 41 · counts for 46%Accessibility 46 · counts for 25%Code Health 59 · counts for 14%Performance 60 · counts for 8%Architecture 68 · counts for 4%Security and Compliance 75 · counts for 2%Maturity 80 · counts for 1%

If Production Readiness rose from 41 to 70, the lowest score rated Strong, the score would rise from 48 to about 55.

Code composition: what the lines of code are
Product code 55%Tests 45%
New since the last survey: 1897 findings

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

  • Cyclomatic Complexity · useChatStreamingLifecycle.useChatStreamingLifecycle.createStreamHandler::inner (cyclomatic 282) desktop/src/hooks/useChatStreamingLifecycle.ts
  • Cyclomatic Complexity · StreamingOrchestrator._read_formatted_response_body (cyclomatic 280) backend/core/streaming_orchestrator.py
  • Cyclomatic Complexity · ConnectAccount.ConnectAccount (cyclomatic 173) desktop/src/components/awsAccount/ConnectAccount.tsx
  • Cyclomatic Complexity · SessionRouter._run_conversation_impl (cyclomatic 140) backend/core/session_router.py
  • Cyclomatic Complexity · swarm_out_results.summarize (cyclomatic 139) backend/core/swarm_out_results.py
  • Cyclomatic Complexity · AwsAccountTab.AwsAccountTab (cyclomatic 88) desktop/src/components/settings/AwsAccountTab.tsx
  • Cyclomatic Complexity · audit.render (cyclomatic 85) backend/core/run_protocol/audit.py
  • Cyclomatic Complexity · RunOverlay.RunOverlay (cyclomatic 85) desktop/src/components/swarm-out/RunOverlay.tsx
  • Cyclomatic Complexity · audit.build (cyclomatic 80) backend/core/run_protocol/audit.py
  • Cyclomatic Complexity · project_agent_draft.build (cyclomatic 79) backend/core/project_agent_draft.py
  • Cyclomatic Complexity · swarm_out_settle.derive (cyclomatic 78) backend/core/swarm_out_settle.py
  • Cyclomatic Complexity · checks._evaluate_check (cyclomatic 77) backend/core/run_protocol/checks.py
  • Cyclomatic Complexity · receivers.scope_of (cyclomatic 73) backend/core/code_intel/receivers.py
  • Cyclomatic Complexity · lifecycle._apply (cyclomatic 73) backend/core/run_protocol/lifecycle.py
  • Cyclomatic Complexity · changed._report (cyclomatic 72) backend/core/code_intel/changed.py
  • Cyclomatic Complexity · pipeline_v2.run_unit_v2 (cyclomatic 69) backend/core/ingestion/pipeline_v2.py
  • Cyclomatic Complexity · security_hooks._audit_tool_hit (cyclomatic 66) backend/core/security_hooks.py
  • Cyclomatic Complexity · FileTypes.value_type (cyclomatic 62) backend/core/code_intel/receivers.py
  • Cyclomatic Complexity · CredentialBanner.CredentialBanner (cyclomatic 61) desktop/src/components/common/CredentialBanner.tsx
  • Cyclomatic Complexity · DispatchCard.DispatchCard (cyclomatic 59) desktop/src/pages/chat/components/DispatchCard.tsx
  • Cyclomatic Complexity · useChatStreamingLifecycle.useChatStreamingLifecycle.createErrorHandlerInner.<returned closure> (cyclomatic 58) desktop/src/hooks/useChatStreamingLifecycle.ts
  • Cyclomatic Complexity · TurnZones.AgentRow (cyclomatic 58) desktop/src/pages/chat/components/TurnZones.tsx
  • Cyclomatic Complexity · PipelineRunCard.PipelineRunCard (cyclomatic 56) desktop/src/components/layout/PipelineRunCard.tsx
  • Cyclomatic Complexity · LibraryPanel.LibraryPanel (cyclomatic 54) backend/apps/pptx-maker/package/upstream/kirocrew/website/src/apps/pptx-maker/LibraryPanel.tsx
  • Cyclomatic Complexity · turnView.labelBash (cyclomatic 54) REDACTED
  • Cyclomatic Complexity · turnView.deriveTurnView (cyclomatic 53) REDACTED
  • Cyclomatic Complexity · RepoPane.RepoPane (cyclomatic 52) desktop/src/components/workspace-explorer/RepoPane.tsx
  • Cyclomatic Complexity · FileTypes.ann_type (cyclomatic 51) backend/core/code_intel/receivers.py
  • Cyclomatic Complexity · SwarmOutWaitCard.SwarmOutWaitCard (cyclomatic 51) desktop/src/components/swarm-out/SwarmOutWaitCard.tsx
  • Cyclomatic Complexity · RunOverlay.DeliverableTab (cyclomatic 51) desktop/src/components/swarm-out/RunOverlay.tsx
  • Cyclomatic Complexity · CasesTab.CaseDetailView (cyclomatic 51) desktop/src/pages/eval/CasesTab.tsx
  • Cyclomatic Complexity · desktop_main.run_ingest (cyclomatic 50) REDACTED
  • Cyclomatic Complexity · turnZones.turnZones (cyclomatic 48) desktop/src/pages/chat/turnZones.ts
  • Cyclomatic Complexity · RunOverlay.CommandPanel (cyclomatic 47) desktop/src/components/swarm-out/RunOverlay.tsx
  • Cyclomatic Complexity · provenance.enqueue_unit (cyclomatic 45) backend/core/ingestion/provenance.py
  • Cyclomatic Complexity · writer._render_block (cyclomatic 45) backend/core/ingestion/writer.py
  • Cyclomatic Complexity · project_agent_draft._merge (cyclomatic 45) backend/core/project_agent_draft.py
  • Cyclomatic Complexity · ReviewOrchestrator.plan_fix_handoff (cyclomatic 45) backend/core/run_protocol/review.py
  • Cyclomatic Complexity · landing.commit_repos (cyclomatic 44) backend/core/run_protocol/landing.py
  • Cyclomatic Complexity · turnControls.sendMessage (cyclomatic 44) desktop/src/pages/chat/turnControls.ts
  • Cyclomatic Complexity · changed.render (cyclomatic 43) backend/core/code_intel/changed.py
  • Cyclomatic Complexity · security_hooks._normalize_newlines_quote_aware (cyclomatic 43) backend/core/security_hooks.py
  • Cyclomatic Complexity · cli_commands._execute_loaded (cyclomatic 42) backend/core/run_protocol/cli_commands.py
  • Cyclomatic Complexity · RunEngine.stage_complete (cyclomatic 42) backend/core/run_protocol/engine.py
  • Cyclomatic Complexity · security_hooks._segment_session_link (cyclomatic 42) backend/core/security_hooks.py
  • Cyclomatic Complexity · prompt_builder._render_canvas_lines (cyclomatic 41) REDACTED
  • Cyclomatic Complexity · findings.fold (cyclomatic 41) backend/core/run_protocol/findings.py
  • Cyclomatic Complexity · next_step.next_step (cyclomatic 41) backend/core/run_protocol/next_step.py
  • Cyclomatic Complexity · swarm_out._dispatch_spec (cyclomatic 41) backend/core/swarm_out.py
  • Cyclomatic Complexity · swarm_out_record.funnel (cyclomatic 41) backend/core/swarm_out_record.py
  • Cyclomatic Complexity · PipelineRunCard.Commands (cyclomatic 41) desktop/src/components/layout/PipelineRunCard.tsx
  • Cyclomatic Complexity · GraphStore.resolve_bare_targets (cyclomatic 40) backend/core/code_intel/graph_store.py
  • Cyclomatic Complexity · hive_records.pull (cyclomatic 40) backend/core/hive_records.py
  • Cyclomatic Complexity · runtime_hooks._prompt_reads (cyclomatic 40) backend/core/runtime_hooks.py
  • Cyclomatic Complexity · transcriptFeed.planTranscriptChange (cyclomatic 40) desktop/src/hooks/transcriptFeed.ts
  • Cyclomatic Complexity · SessionTab.SessionTab (cyclomatic 40) desktop/src/pages/chat/components/SessionTab.tsx
  • Cyclomatic Complexity · addressing._map (cyclomatic 39) backend/core/addressing.py
  • Cyclomatic Complexity · RunEngine.create (cyclomatic 39) backend/core/run_protocol/engine.py
  • Cyclomatic Complexity · lifecycle._land (cyclomatic 39) backend/core/run_protocol/lifecycle.py
  • Cyclomatic Complexity · schemas.validate_contract (cyclomatic 39) backend/core/run_protocol/schemas.py
  • Cyclomatic Complexity · survey._conventions (cyclomatic 38) backend/core/brain_bootstrap/survey.py
  • Cyclomatic Complexity · child_cli.dispatch (cyclomatic 38) backend/core/run_protocol/child_cli.py
  • Cyclomatic Complexity · usage_report.report (cyclomatic 38) backend/core/usage_report.py
  • Cyclomatic Complexity · daily_activity_hook._get_session_git_commits (cyclomatic 38) backend/hooks/daily_activity_hook.py
  • Cyclomatic Complexity · TurnZones.TurnZoneList (cyclomatic 38) desktop/src/pages/chat/components/TurnZones.tsx
  • Cyclomatic Complexity · HiveFleet.HiveSetupStep (cyclomatic 38) desktop/src/components/awsAccount/HiveFleet.tsx
  • Cyclomatic Complexity · aws_detect.stage1 (cyclomatic 37) backend/core/aws_detect.py
  • Cyclomatic Complexity · security_hooks._builtin_session_link (cyclomatic 37) backend/core/security_hooks.py
  • Cyclomatic Complexity · useChatStreamingLifecycle.useChatStreamingLifecycle.syncQueuedBadges (cyclomatic 37) desktop/src/hooks/useChatStreamingLifecycle.ts
  • Cyclomatic Complexity · aws_account._check_candidate (cyclomatic 36) backend/core/aws_account.py
  • Cyclomatic Complexity · interface.delta (cyclomatic 36) backend/core/code_intel/interface.py
  • Cyclomatic Complexity · ddd_format.normalize (cyclomatic 36) backend/core/ddd_format.py
  • Cyclomatic Complexity · overrides.check (cyclomatic 36) backend/core/ingestion/overrides.py
  • Cyclomatic Complexity · security_hooks._store_segment_destroys (cyclomatic 36) backend/core/security_hooks.py
  • Cyclomatic Complexity · chat.chat_stream (cyclomatic 36) backend/routers/chat.py
  • Cyclomatic Complexity · StarterMaterial.MaterialPicker (cyclomatic 36) desktop/src/components/layout/StarterMaterial.tsx
  • Cyclomatic Complexity · provenance._lookup_anchor (cyclomatic 35) backend/core/ingestion/provenance.py
  • Cyclomatic Complexity · answers.parse_answer (cyclomatic 35) backend/core/run_protocol/answers.py
  • Cyclomatic Complexity · RunEngine._incremental_review (cyclomatic 35) backend/core/run_protocol/engine.py
  • Cyclomatic Complexity · worktree_write_gate._git_verdict (cyclomatic 35) backend/core/worktree_write_gate.py
  • Cyclomatic Complexity · interface._py_scan (cyclomatic 34) backend/core/code_intel/interface.py
  • Cyclomatic Complexity · FileTypes._scan_class (cyclomatic 34) backend/core/code_intel/receivers.py
  • Cyclomatic Complexity · RunEngine.review_start (cyclomatic 34) backend/core/run_protocol/engine.py
  • Cyclomatic Complexity · RunEngine._normal_land (cyclomatic 34) backend/core/run_protocol/engine.py
  • Cyclomatic Complexity · swarm_out.answer (cyclomatic 34) backend/core/swarm_out.py
  • Cyclomatic Complexity · generate_app_execution_releases.verify_attestation (cyclomatic 34) backend/scripts/generate_app_execution_releases.py
  • Cyclomatic Complexity · TurnZones.ToolStripV6 (cyclomatic 34) desktop/src/pages/chat/components/TurnZones.tsx
  • Cyclomatic Complexity · PipelineMetrics.PipelineMetrics (cyclomatic 34) desktop/src/components/layout/PipelineMetrics.tsx
  • Cyclomatic Complexity · brain-demo.html.act (cyclomatic 34) docs/design/brain-demo.html
  • Cyclomatic Complexity · CliStreamReader._route (cyclomatic 33) backend/core/cli_stream_reader.py
  • Cyclomatic Complexity · interface.bound_names (cyclomatic 33) backend/core/code_intel/interface.py
  • Cyclomatic Complexity · interface._ts_scan (cyclomatic 33) backend/core/code_intel/interface.py
  • Cyclomatic Complexity · interface.call_sites (cyclomatic 33) backend/core/code_intel/interface.py
  • Cyclomatic Complexity · swarm_out_card._text_of (cyclomatic 33) backend/core/swarm_out_card.py
  • Cyclomatic Complexity · migrate_followups_to_todos.da_items (cyclomatic 33) backend/scripts/migrate_followups_to_todos.py
  • Cyclomatic Complexity · turnZones.pipelineZones (cyclomatic 33) desktop/src/pages/chat/turnZones.ts
  • Cyclomatic Complexity · events._event_contract (cyclomatic 32) backend/core/run_protocol/events.py
  • Cyclomatic Complexity · run_worktree.land (cyclomatic 32) backend/core/run_worktree.py
  • Cyclomatic Complexity · swarm_out_results._checks (cyclomatic 32) backend/core/swarm_out_results.py
  • Cyclomatic Complexity · cdf_move_misrouted.run (cyclomatic 32) backend/scripts/cdf_move_misrouted.py

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: 1542 findings

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

  • Cyclomatic Complexity · useChatStreamingLifecycle.useChatStreamingLifecycle.createStreamHandler (cyclomatic 309) desktop/src/hooks/useChatStreamingLifecycle.ts
  • Cyclomatic Complexity · pipeline_validator.validate (cyclomatic 215) backend/scripts/pipeline_validator.py
  • Cyclomatic Complexity · StreamingOrchestrator._read_formatted_response (cyclomatic 204) backend/core/streaming_orchestrator.py
  • Cyclomatic Complexity · artifact_cli.cmd_run_update (cyclomatic 159) backend/scripts/artifact_cli.py
  • Cyclomatic Complexity · artifact_cli.cmd_run_report (cyclomatic 159) backend/scripts/artifact_cli.py
  • Cyclomatic Complexity · SessionRouter.run_conversation (cyclomatic 109) backend/core/session_router.py
  • Cyclomatic Complexity · evolution_optimizer._run_evolution_cycle_locked (cyclomatic 96) backend/core/evolution_optimizer.py
  • Cyclomatic Complexity · proactive_intelligence.build_session_briefing_data (cyclomatic 69) backend/core/proactive_intelligence.py
  • Cyclomatic Complexity · DistillationTriggerHook._distill_files (cyclomatic 69) backend/hooks/distillation_hook.py
  • Cyclomatic Complexity · confidence_score.calculate_score (cyclomatic 66) backend/skills/s_autonomous-pipeline/scripts/confidence_score.py
  • Cyclomatic Complexity · proactive_intelligence._advance_pipeline_recovery_state (cyclomatic 63) backend/core/proactive_intelligence.py
  • Cyclomatic Complexity · useChatStreamingLifecycle.useChatStreamingLifecycle.createErrorHandler (cyclomatic 60) desktop/src/hooks/useChatStreamingLifecycle.ts
  • Cyclomatic Complexity · pipeline_validator._check_depth (cyclomatic 59) backend/scripts/pipeline_validator.py
  • Cyclomatic Complexity · swarmai_monthly_report._generate_monthly_report (cyclomatic 56) backend/jobs/handlers/swarmai_monthly_report.py
  • Cyclomatic Complexity · artifact_cli._extract_run_metrics (cyclomatic 51) backend/scripts/artifact_cli.py
  • Cyclomatic Complexity · artifact_cli.cmd_run_commit (cyclomatic 47) backend/scripts/artifact_cli.py
  • Cyclomatic Complexity · artifact_cli.cmd_publish (cyclomatic 45) backend/scripts/artifact_cli.py
  • Cyclomatic Complexity · pipeline_validator.validate_artifact_data (cyclomatic 45) backend/scripts/pipeline_validator.py
  • Cyclomatic Complexity · ai_ready_helpers.extract_import_graph (cyclomatic 40) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py
  • Cyclomatic Complexity · json_exporter.export_code_intel_json (cyclomatic 39) backend/core/code_intel/json_exporter.py
  • Cyclomatic Complexity · artifact_cli.cmd_run_observe (cyclomatic 38) backend/scripts/artifact_cli.py
  • Cyclomatic Complexity · ai_ready_helpers.select_verification_tasks (cyclomatic 37) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py
  • Cyclomatic Complexity · ContextHealthHook._auto_cultivate_session_signals (cyclomatic 35) backend/hooks/context_health_hook.py
  • Cyclomatic Complexity · pipelines.pipeline_analytics (cyclomatic 35) backend/routers/pipelines.py
  • Cyclomatic Complexity · MergedToolBlock.MergedToolBlock (cyclomatic 35) desktop/src/pages/chat/components/MergedToolBlock.tsx
  • Cyclomatic Complexity · ui_actions.build_surface_events (cyclomatic 34) backend/core/ui_actions.py
  • Cyclomatic Complexity · pipeline_validator._check_semantic_depth (cyclomatic 34) backend/scripts/pipeline_validator.py
  • Cyclomatic Complexity · ai_ready_helpers.validate_code_intel_json (cyclomatic 34) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py
  • Cyclomatic Complexity · ai_ready_helpers.validate_code_intel_json (cyclomatic 34) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py
  • Cyclomatic Complexity · EngineMetricsTab.EngineMetricsTab (cyclomatic 34) desktop/src/components/settings/EngineMetricsTab.tsx
  • Cyclomatic Complexity · EvalDashboard.GoldenSetTab (cyclomatic 34) desktop/src/pages/EvalDashboard.tsx
  • Cyclomatic Complexity · executor._format_briefing_slack_message (cyclomatic 32) REDACTED
  • Cyclomatic Complexity · ai_ready_helpers.compute_subsystem_coverage (cyclomatic 32) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py
  • Cyclomatic Complexity · security_hooks._targets_irreplaceable_store (cyclomatic 31) backend/core/security_hooks.py
  • Cyclomatic Complexity · daily_activity_writer._format_session_entry (cyclomatic 30) backend/core/daily_activity_writer.py
  • Cyclomatic Complexity · ContextHealthHook._track_memory_usage_locked (cyclomatic 30) backend/hooks/context_health_hook.py
  • Cyclomatic Complexity · Video.SectionComponent (cyclomatic 30) backend/skills/s_pollinate/templates/remotion/Video.tsx
  • Cyclomatic Complexity · DddCultivationOrchestrator._auto_apply_ddd_proposals (cyclomatic 29) backend/core/ddd_orchestrator.py
  • Cyclomatic Complexity · ingestion_gate.ingestion_gate (cyclomatic 29) backend/core/ingestion_gate.py
  • Cyclomatic Complexity · memory_extractor.extract_and_save (cyclomatic 29) backend/core/memory_extractor.py
  • Cyclomatic Complexity · persist_routing.classify_content (cyclomatic 29) backend/core/persist_routing.py
  • Cyclomatic Complexity · memory_health._apply_report (cyclomatic 29) backend/jobs/handlers/memory_health.py
  • Cyclomatic Complexity · pipeline_validator._check_clarifications (cyclomatic 29) backend/scripts/pipeline_validator.py
  • Cyclomatic Complexity · pipeline_validator.render_audit_trail_md (cyclomatic 29) backend/scripts/pipeline_validator.py
  • Cyclomatic Complexity · EvalDashboard.OverviewTab (cyclomatic 29) desktop/src/pages/EvalDashboard.tsx
  • Cyclomatic Complexity · ddd_cultivation.apply_to_ddd (cyclomatic 28) backend/core/ddd_cultivation.py
  • Cyclomatic Complexity · ContextHealthHook._auto_cultivate_pipeline_lessons (cyclomatic 28) backend/hooks/context_health_hook.py
  • Cyclomatic Complexity · DistillationTriggerHook._enforce_size_valve (cyclomatic 28) backend/hooks/distillation_hook.py
  • Cyclomatic Complexity · ddd_entry_lifecycle.inject_entry_metadata (cyclomatic 27) backend/core/ddd_entry_lifecycle.py
  • Cyclomatic Complexity · engine_metrics.collect_ddd_change_suggestions (cyclomatic 27) backend/core/engine_metrics.py
  • Cyclomatic Complexity · SessionMiner._extract_skill_invocations (cyclomatic 27) backend/core/session_miner.py
  • Cyclomatic Complexity · artifact_cli.cmd_run_analytics (cyclomatic 27) backend/scripts/artifact_cli.py
  • Cyclomatic Complexity · SelfLoopsHealthEngine._check_memory (cyclomatic 27) backend/skills/s_loops-health/scripts/loops_health_check.py
  • Cyclomatic Complexity · EvalDashboard.CaseDetailDrawer (cyclomatic 27) desktop/src/pages/EvalDashboard.tsx
  • Cyclomatic Complexity · NewBrainOverlay.NewBrainContent (cyclomatic 26) desktop/src/components/layout/NewBrainOverlay.tsx
  • Cyclomatic Complexity · ActivityFeed.extractActivities (cyclomatic 26) desktop/src/pages/chat/components/ActivityFeed.tsx
  • Cyclomatic Complexity · EvalDashboard.GuideTab (cyclomatic 26) desktop/src/pages/EvalDashboard.tsx
  • Cyclomatic Complexity · blast_radius.analyze_diff (cyclomatic 25) backend/core/code_intel/blast_radius.py
  • Cyclomatic Complexity · ddd_cultivation.detect_contradiction (cyclomatic 25) backend/core/ddd_cultivation.py
  • Cyclomatic Complexity · RetryManager._retry_with_resume (cyclomatic 25) backend/core/retry_manager.py
  • Cyclomatic Complexity · EvolutionMaintenanceHook.execute (cyclomatic 25) backend/hooks/evolution_maintenance_hook.py
  • Cyclomatic Complexity · locked_write.locked_read_modify_write (cyclomatic 25) backend/scripts/locked_write.py
  • Cyclomatic Complexity · pipeline_validator.check_ddd_consistency (cyclomatic 25) backend/scripts/pipeline_validator.py
  • Cyclomatic Complexity · locked_write.locked_read_modify_write (cyclomatic 25) backend/skills/s_persist/scripts/locked_write.py
  • Cyclomatic Complexity · ai_ready_helpers._render_domain_skeleton_body (cyclomatic 25) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py
  • Cyclomatic Complexity · ai_ready_helpers.project_domain_skeleton (cyclomatic 25) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py
  • Cyclomatic Complexity · codebase_map._format_briefing (cyclomatic 24) backend/core/code_intel/codebase_map.py
  • Cyclomatic Complexity · DddCultivationOrchestrator._ch_entry_lifecycle (cyclomatic 24) backend/core/ddd_orchestrator.py
  • Cyclomatic Complexity · SummarizationPipeline._parse_enrichment (cyclomatic 24) backend/core/summarization.py
  • Cyclomatic Complexity · pipeline_validator._verify_findings_on_disk (cyclomatic 24) backend/scripts/pipeline_validator.py
  • Cyclomatic Complexity · BrainHub.ReviewView (cyclomatic 24) desktop/src/components/layout/BrainHub.tsx
  • Cyclomatic Complexity · code_intel_feed.detect_tech_drift (cyclomatic 23) backend/core/code_intel_feed.py
  • Cyclomatic Complexity · ContextHealthHook._extract_lessons_to_memory (cyclomatic 23) backend/hooks/context_health_hook.py
  • Cyclomatic Complexity · memory_health._resolve_open_thread (cyclomatic 23) backend/jobs/handlers/memory_health.py
  • Cyclomatic Complexity · SelfLoopsHealthEngine._auto_remediate (cyclomatic 23) backend/skills/s_loops-health/scripts/loops_health_check.py
  • Cyclomatic Complexity · code_intel_hook._build_context (cyclomatic 22) backend/core/code_intel/code_intel_hook.py
  • Cyclomatic Complexity · correction_tracker._merge_drift (cyclomatic 22) backend/core/evolution/correction_tracker.py
  • Cyclomatic Complexity · proactive_learning.update_learning_from_activity (cyclomatic 22) backend/core/proactive_learning.py
  • Cyclomatic Complexity · ContextHealthHook._set_verified_from_pipeline_runs (cyclomatic 22) backend/hooks/context_health_hook.py
  • Cyclomatic Complexity · DistillationTriggerHook._enforce_section_caps (cyclomatic 22) backend/hooks/distillation_hook.py
  • Cyclomatic Complexity · ddd_self_audit.run_ddd_self_audit (cyclomatic 22) backend/jobs/handlers/ddd_self_audit.py
  • Cyclomatic Complexity · evolution_escalation_probe.main (cyclomatic 22) backend/scripts/evolution_escalation_probe.py
  • Cyclomatic Complexity · pipeline_analytics._load_all_metrics (cyclomatic 22) backend/scripts/pipeline_analytics.py
  • Cyclomatic Complexity · pipeline_analytics.analyze_stage_efficiency (cyclomatic 22) backend/scripts/pipeline_analytics.py
  • Cyclomatic Complexity · pipeline_validator._check_security_boundaries (cyclomatic 22) backend/scripts/pipeline_validator.py
  • Cyclomatic Complexity · DiagramReveal.autoLayout (cyclomatic 22) backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx
  • Cyclomatic Complexity · community_data.parse_hot_topics (cyclomatic 21) backend/core/community_data.py
  • Cyclomatic Complexity · DistillationTriggerHook._apply_open_thread_updates (cyclomatic 21) backend/hooks/distillation_hook.py
  • Cyclomatic Complexity · DeckStage._onKey (cyclomatic 21) REDACTED
  • Cyclomatic Complexity · proactive_intelligence._parse_continue_hints (cyclomatic 20) backend/core/proactive_intelligence.py
  • Cyclomatic Complexity · proactive_intelligence._get_job_result_highlights (cyclomatic 20) backend/core/proactive_intelligence.py
  • Cyclomatic Complexity · ContextHealthHook._light_refresh (cyclomatic 20) backend/hooks/context_health_hook.py
  • Cyclomatic Complexity · ContextHealthHook._run_eval_canary (cyclomatic 20) backend/hooks/context_health_hook.py
  • Cyclomatic Complexity · ImprovementWritebackHook._detect_project (cyclomatic 20) backend/hooks/improvement_writeback_hook.py
  • Cyclomatic Complexity · artifact_cli._auto_validate_before_advance (cyclomatic 20) backend/scripts/artifact_cli.py
  • Cyclomatic Complexity · artifact_cli._stage_publish_times (cyclomatic 20) backend/scripts/artifact_cli.py
  • Cyclomatic Complexity · pipeline_analytics.generate_report (cyclomatic 20) backend/scripts/pipeline_analytics.py
  • Cyclomatic Complexity · ai_ready_helpers.check_domain_referential_integrity (cyclomatic 20) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py
  • Cyclomatic Complexity · locked_write.locked_read_modify_write (cyclomatic 20) backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py
  • Cyclomatic Complexity · ai_ready_helpers.check_domain_referential_integrity (cyclomatic 20) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py
Rebuild cost: about €610,000 · Estimate
Cost to rebuild€200,000 to €1,000,000, for 3,364 to 10,670 hours of work, about 4.2 person-years for 2 to 8 engineers
Difficulty of the problemStandard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor×0.7 at a score of 48. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
SizeLarge: 362,883 lines of product code
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

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

Top priorities

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

1
Resolve the 2 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED, REDACTED.
Raises the score by about 7 points · Low effort · REDACTED Scanning
2
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
Raises the score by about 5 points · Medium effort · Security & performance tooling
3
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
Raises the score by about 3 points · Medium effort · Keyboard semantics

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 €610,000 to build again, about 4.2 person-years of work. Its weakest lens is Production Readiness, at 41 (Weak). Production Readiness is about whether the product is ready to run in production and to change without breaking. Because the weakest lens counts most in the score, work on Production Readiness also moves the score most.
Based on: the rebuild estimate · the Production Readiness grade · how much each lens counts
What to do: Start with the Production Readiness actions in Top priorities.
If you do one thing first · First action
Resolve the 2 Leaked secret finding(s) in REDACTED Scanning. Of all the actions in this report, it raises the score most for the work it takes: about 7 points for low effort, because it clears the 2 REDACTED Scanning findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 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 843,522 lines over the last 90 days, which is about 3,420,950 lines a year. At that pace, the extra work comes to an estimated 447.1 to 2682.6 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of 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: 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.

699 modules, with 505 dependencies between them. Every module uses only modules listed above it, so there are no loops.

The table shows the 40 modules with the most connections; 659 more are left out to keep it readable.

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 backend.apps.pptx-maker.package.upstream.kirocrew.website.src.apps.pptx-maker2 backend.core.code_intel3 backend.core.ingestion4 backend.core.run_protocol.events5 backend.core.session_hooks6 backend.core.skill_manager7 backend.core.summarization8 backend.database.sqlite9 backend.scripts10 desktop.src.components.chat11 desktop.src.components.file-viewer12 desktop.src.components.modals13 desktop.src.components.settings14 desktop.src.services.ddd15 desktop.src.services.swarmOut16 desktop.src.types17 desktop.src.types.todo18 backend.core19 backend.core.run_protocol.engine20 backend.core.run_protocol.store21 backend.hooks22 backend.routers23 desktop.src.components.layout24 desktop.src.components.swarm-out25 desktop.src.components.workspace26 desktop.src.components.workspace-explorer.FileTreeNode27 desktop.src.contexts28 desktop.src.pages29 desktop.src.pages.chat.components30 desktop.src.services.system31 desktop.src.utils32 backend.core.run_protocol33 desktop.src.components.common34 desktop.src.components.workspace-explorer35 desktop.src.hooks.useUnifiedTabState36 desktop.src.services37 desktop.src.hooks.useChatStreamingLifecycle38 desktop.src.pages.chat.turnControls39 desktop.src.hooks40 desktop.src.pages.chat
1 backend.apps.pptx-maker.package.upstream.kirocrew.website.src.apps.pptx-maker
2 backend.core.code_intel
3 backend.core.ingestion
4 backend.core.run_protocol.events
5 backend.core.session_hooks
6 backend.core.skill_manager
7 backend.core.summarization
8 backend.database.sqlite
9 backend.scripts
10 desktop.src.components.chat
11 desktop.src.components.file-viewer
12 desktop.src.components.modals
13 desktop.src.components.settings
14 desktop.src.services.ddd
15 desktop.src.services.swarmOut
16 desktop.src.types
17 desktop.src.types.todo
18 backend.core311
19 backend.core.run_protocol.engine1
20 backend.core.run_protocol.store2
21 backend.hooks11
22 backend.routers1
23 desktop.src.components.layout8112
24 desktop.src.components.swarm-out15
25 desktop.src.components.workspace1
26 desktop.src.components.workspace-explorer.FileTreeNode1
27 desktop.src.contexts1
28 desktop.src.pages11
29 desktop.src.pages.chat.components14
30 desktop.src.services.system1
31 desktop.src.utils14
32 backend.core.run_protocol625
33 desktop.src.components.common1
34 desktop.src.components.workspace-explorer11
35 desktop.src.hooks.useUnifiedTabState11
36 desktop.src.services83013
37 desktop.src.hooks.useChatStreamingLifecycle11
38 desktop.src.pages.chat.turnControls22
39 desktop.src.hooks15154
40 desktop.src.pages.chat1211
Uses a module listed above itPart of a loopThe module itself
1 backend.apps.pptx-maker.package.upstream.kirocrew.website.src.apps.pptx-maker2 backend.core.code_intel3 backend.core.ingestion4 backend.core.run_protocol.events5 backend.core.session_hooks6 backend.core.skill_manager7 backend.core.summarization8 backend.database.sqlite9 backend.scripts10 desktop.src.components.chat11 desktop.src.components.file-viewer12 desktop.src.components.modals13 desktop.src.components.settings14 desktop.src.services.ddd15 desktop.src.services.swarmOut16 desktop.src.types17 desktop.src.types.todo18 backend.core19 backend.core.run_protocol.engine20 backend.core.run_protocol.store21 backend.hooks22 backend.routers23 desktop.src.components.layout24 desktop.src.components.swarm-out25 desktop.src.components.workspace26 desktop.src.components.workspace-explorer.FileTreeNode27 desktop.src.contexts28 desktop.src.pages29 desktop.src.pages.chat.components30 desktop.src.services.system31 desktop.src.utils32 backend.core.run_protocol33 desktop.src.components.common34 desktop.src.components.workspace-explorer35 desktop.src.hooks.useUnifiedTabState36 desktop.src.services37 desktop.src.hooks.useChatStreamingLifecycle38 desktop.src.pages.chat.turnControls39 desktop.src.hooks40 desktop.src.pages.chatbackend.apps.pptx-maker.package.upstream.kirocrew.website.src.apps.pptx-maker1backend.core.code_intel2backend.core.ingestion3backend.core.run_protocol.events4backend.core.session_hooks5backend.core.skill_manager6backend.core.summarization7backend.database.sqlite8backend.scripts9desktop.src.components.chat10desktop.src.components.file-viewer11desktop.src.components.modals12desktop.src.components.settings13desktop.src.services.ddd14desktop.src.services.swarmOut15desktop.src.types16desktop.src.types.todo17backend.core18backend.core.run_protocol.engine19backend.core.run_protocol.store20backend.hooks21backend.routers22desktop.src.components.layout23desktop.src.components.swarm-out24desktop.src.components.workspace25desktop.src.components.workspace-explorer.FileTreeNode26desktop.src.contexts27desktop.src.pages28desktop.src.pages.chat.components29desktop.src.services.system30desktop.src.utils31backend.core.run_protocol32desktop.src.components.common33desktop.src.components.workspace-explorer34desktop.src.hooks.useUnifiedTabState35desktop.src.services36desktop.src.hooks.useChatStreamingLifecycle37desktop.src.pages.chat.turnControls38desktop.src.hooks39desktop.src.pages.chat4031112111811215111111411462511111830131122151541211+659 more modules (most-connected shown)

At a glance — Code Health · 59% · Adequate · gated by D1, D2 ·

At a glance — Architecture · 68% · Adequate · gated by D26, R9 ·

At a glance — Maturity · 80% · Strong ·

At a glance — Readiness · 41% · Weak · gated by D13, P3, P7 ·

At a glance — Security · 75% · Adequate · gated by D29, D36 ·

At a glance — Accessibility · 46% · Weak · gated by AC4 ·

At a glance — Performance · 60% · Adequate ·

Security & Compliance — OWASP Top-10 mapping

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

OWASP categoryFindingsSeverity
A05:2025 — Injection115High / Critical
A03:2025 — Software Supply Chain Failures78High / Critical
A07:2025 — Authentication Failures7High / Critical

Roadmap

Top priorities: Resolve the 2 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED, REDACTED; Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing; Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.

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

Do thisHelpsEffortDimension
Resolve the 2 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED, REDACTED.+7.0 ptsLowREDACTED Scanning
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.+4.6 ptsMediumSecurity & performance tooling
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.+3.0 ptsMediumKeyboard semantics
Pass `timeout=` on every `requests`/`httpx` call (requests has no default and will wait forever), mount an `HTTPAdapter(max_retries=Retry(...))` on shared sessions, and wrap calls to flaky dependencies in `tenacity` retries or a `pybreaker` circuit breaker.+2.7 ptsMediumOutbound HTTP resilience
Document RTO/RPO and a tested restore procedure (a backup config alone isn't disaster recovery).+2.1 ptsMediumDR & Backup
Enforce accessibility in the toolchain: add eslint-plugin-jsx-a11y, then assert with vitest-axe in tests, then gate axe/pa11y/Lighthouse in CI.+1.7 ptsMediumA11y enforcement
Python: await the async equivalent (asyncio.sleep, an async HTTP client such as httpx.AsyncClient or aiohttp, asyncio.create_subprocess_exec), or move the blocking call off the loop with `await asyncio.to_thread(...)`; never call asyncio.run inside a coroutine — await the coroutine.+1.3 ptsMediumAsync & latency hygiene
Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.+1.2 ptsMediumDependency Hygiene

File quality

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

FileScoreBandWorst signal
REDACTED0.0SlopDependency Vulnerabilities: High CVE: REDACTED
REDACTED0.3SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED1.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED1.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.2SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopDependency Vulnerabilities: High CVE: REDACTED
REDACTED3.0SlopStatic Analysis (SAST): High: REDACTED
REDACTED3.0SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED3.2SlopStatic Analysis (SAST): High: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.6MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.9MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.9MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.9MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): Medium: REDACTED
backend/core/community_data.py5.1MixedCyclomatic Complexity: community_data.build_feed (cyclomatic 16)
backend/routers/chat.py5.5MixedCyclomatic Complexity: chat.chat_stream (cyclomatic 36)

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

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

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

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

Could not be resolved — 10

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 91 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 — 91 dimensions across the health lenses
D1D2D3D4D5D6D7D9D10D12D13D14D15D17D19D20D24D26D27D28D29D30D34D35D36D37D43D44AC1AC2AC3AC4AC5AC6AC7AX10AX2AX3AX4AX6AX8AX9C2M1M2M3M4P1P10P2P3P4P5P6P7PF3R1R10R11R2R3R4R5R6R7R8R9S1X1X12X13X14X15X16X17X18X19X2X21X22X23X24X25X26X27X28X29X3X30X4X5

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

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

Tools & methods

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

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

Every finding is locatable in findings.md. Run 01a1beb5-9590-7dc5-a192-e59ca8b84afd.

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.

  • D10 Test Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 4,276 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 1,044 test source file(s) (.py) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
  • D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability not included — the JavaScript/TypeScript suite (vitest via `npm ci --ignore-scripts` in desktop/ (5107 tests)) did not finish re-running within its budget: too large to re-run within its budget.
  • D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares package.json, but the licence verdict published here was taken over its crate dependencies. Nothing was read about its npm dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares a Python pyproject.toml/requirements.txt (pip/uv/Poetry), but the licence verdict published here was taken over its crate dependencies. Nothing was read about its Python dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D16 Bus Factor — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Single-maintainer repository — bus factor is not applicable (4 contributor(s) across 6101 commit(s) sampled, automation and bot accounts excluded). One of them holds 99% of the history; the other 3 hold 0.3% each on average, below the 5% at which there is somebody to hand the work to. That is a single maintainer with drive-by contributors, not a team whose knowledge has concentrated — so the bus factor is not applicable and there is nothing here for the owner to act on.
  • D19 Documentation Quality — measured, with a gap in what it reached — 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 — 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. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
  • D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
  • D24 Comment Value — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
  • 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 668 sampled here came from .py files. This repository's .tsx 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. `desktop/src/components/layout/overlayChunks.ts`, `desktop/src/hooks/useUnifiedTabState.ts`, `desktop/src/services/canvasSession.ts`, `desktop/src/services/ingestion.ts`, `desktop/src/types/index.ts`, … (+1 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.
  • AC2 Forms & labels — 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. 106 further occurrence(s) are not listed individually; the score already reflects all 146.
  • AC4 Keyboard semantics — 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. 30 further occurrence(s) are not listed individually; the score already reflects all 70.
  • AC6 Visual & motion safety — 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. 57 further occurrence(s) are not listed individually; the score already reflects all 97.
  • 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 backend/core/app_manifest.py, 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.
  • 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 (dev). the dev server (`npm run dev`) exited before it served a page. Likely cause (the repository): package.json has no "dev" script, so `npm run dev` could not start the app. Last output: "npm error Missing script: "dev" / npm error / npm error To see a list of scripts, run: / npm error npm run / 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.
  • 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. 'sqlite3' is imported (REDACTED:246), 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.
  • 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 (REDACTED:246), 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 (REDACTED:246), 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 Python, Rust 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 Python, Rust 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 reads a prose claim (a path, a setting, a variable, a route, a version, a project, an install, a bare project name in a command) only in text identified as English: the cues that tell a claim from an absence, the past, a plan or an example are an English lexicon, and on other text they would let a false claim through. Links, image targets, fenced commands with an explicit path or a package-manager script, and env-fence variables are checked in every language. 'und' is text the identifier could not name (too short, mixed script, no function words).
  • 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.
  • R10 Code Duplication — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 136 further occurrence(s) are not listed individually; the score already reflects all 176.
  • R3 Large Files — 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. 20 further occurrence(s) are not listed individually; the score already reflects all 60.
  • R4 Test Coverage — 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. 7 further occurrence(s) are not listed individually; the score already reflects all 47.
  • R7 Dead Code — 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. 39 further occurrence(s) are not listed individually; the score already reflects all 79.
  • 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. 202 further occurrence(s) are not listed individually; the score already reflects all 242.
  • X4 Structured logging — 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. 285 further occurrence(s) are not listed individually; the score already reflects all 325.
  • 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. 42 further occurrence(s) are not listed individually; the score already reflects all 82.

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.
  • D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
  • D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • 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.
  • D24 Comment Value: Comment value is measured as redundancy only: a comment that repeats its code's words is found, but a paraphrase in other words, a vague comment, or one the code contradicts is not, and whether a comment is valuable is not claimed. Comments in other scripts or languages, and outside C#, are not judged.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • 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 (go.mod, 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.
  • AC1 Text alternatives: Alt-text is detected structurally — the scan sees that an alternative EXISTS, not whether it meaningfully describes the image, and decorative-vs-missing is judged by attribute shape; runtime-injected images and a non-role=img decorative svg are out of scope. This is accessibility readiness, never a WCAG conformance claim.
  • AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled control found", not a labelling proof.
  • AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
  • AC4 Keyboard semantics: Keyboard semantics are inferred from markup attributes — interactivity wired purely in script, focus managed at runtime, and component-level handlers are invisible. A clean result means "no static keyboard-trap shape", not a keyboard-operability proof.
  • AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
  • AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
  • AC7 A11y enforcement: Enforcement is scored from in-repo config/CI evidence only — an a11y gate enforced in external tooling with no in-repo trace can't be credited, and a configured linter is presence, not proof the rules actually run or block a merge.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
  • M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
  • 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".
  • P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.
  • 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 Complexity2.0 / 10Critical✓ 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 2.0 / 10 · rule-coverage 100% · ceiling Prevented

806 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was ChatPage.ChatPage at 431. A further 4 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 ThreeColumnLayout.NavSvgIcon at 26 — they are counted neither in the figure above nor in this dimension's score. 1 file carries no cyclomatic complexity row at all for this reason — every one of its over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: desktop/src/components/layout/ThreeColumnLayout.tsx (ThreeColumnLayout.NavSvgIcon at 26). 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.

swarmai::spawn_daemon_health_watchdog (cyclomatic 40) · ×3desktop/src-tauri/src/lib.rs:2159
BaseSchemaValidator.validate_content_types (cyclomatic 25) · ×2backend/skills/s_docx/ooxml/scripts/validation/base.py:522
BaseSchemaValidator.validate_file_references (cyclomatic 23) · ×2backend/skills/s_docx/ooxml/scripts/validation/base.py:277
DeckStage._onKey (cyclomatic 21) · ×2docs/AI-Native-Transformation-Deck-CN.html:2742
BaseSchemaValidator.validate_all_relationship_ids (cyclomatic 20) · ×2backend/skills/s_docx/ooxml/scripts/validation/base.py:388

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

What to do

  1. Bring the 37 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with ChatPage.ChatPage (cyclomatic 431), useChatStreamingLifecycle.useChatStreamingLifecycle.createStreamHandler::inner (cyclomatic 282), StreamingOrchestrator._read_formatted_response_body (cyclomatic 280). — 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 37 together lifts Cyclomatic Complexity from 2.0 to about 3.8/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
  2. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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

1245 method(s) exceeded the cognitive complexity threshold of 15; the worst was StreamingOrchestrator._read_formatted_response_body at 886.

swarmai::spawn_daemon_health_watchdog (cognitive 99) · ×6desktop/src-tauri/src/lib.rs:2159
BaseSchemaValidator.validate_all_relationship_ids (cognitive 55) · ×2backend/skills/s_docx/ooxml/scripts/validation/base.py:388
compressDOM::(anonymous)::compress (cognitive 54) · ×2backend/skills/s_browser-agent/browser-agent.mjs:241
BaseSchemaValidator.validate_file_references (cognitive 46) · ×2backend/skills/s_docx/ooxml/scripts/validation/base.py:277
BaseSchemaValidator.validate_content_types (cognitive 39) · ×2backend/skills/s_docx/ooxml/scripts/validation/base.py:522

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

What to do

  1. Bring the 93 bodies over 60 down to 60 or less in Cognitive Complexity — start with StreamingOrchestrator._read_formatted_response_body (cognitive 886), ChatPage.ChatPage (cognitive 636), useChatStreamingLifecycle.useChatStreamingLifecycle.createStreamHandler::inner (cognitive 493). — 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 93 together lifts Cognitive Complexity from 2.0 to about 3.2/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
  2. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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

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

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

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

203 god class(es) detected.

FileTooLong: core/security_hooks.py · ×97backend/core/security_hooks.py
FunctionTooLong: ChatInput.ChatInput · ×89desktop/src/pages/chat/components/ChatInput.tsx:173
TooManyMethods: RunEngine · ×15backend/core/run_protocol/engine.py:447
ClassTooLong: ChatInput · ×2desktop/src/pages/chat/components/ChatInput.tsx:1

What to do

  1. Resolve the 97 FileTooLong finding(s) in God Classes — start with base.py (2), security_hooks.py, engine.py. — One of this dimension's main actionable groups (97 warning-level).
  2. Resolve the 89 FunctionTooLong finding(s) in God Classes — start with useChatStreamingLifecycle.ts (3), RunOverlay.tsx (3), SkillsPage.tsx (2). — One of this dimension's main actionable groups (89 warning-level).
  3. Resolve the 15 TooManyMethods finding(s) in God Classes — start with engine.py, session_unit.py, session_router.py. — One of this dimension's main actionable groups (15 warning-level).
  4. Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D4 · Code Duplication9.6 / 10Stronggated by 273 serious findings✓ Tool-verified

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

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

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

266 duplicated block group(s) detected. A further 7 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 6 of the 273 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: .tsx (18% of production source) was not exposed to THIS dimension's token comparison and is not in this count; duplication there is measured by R10 Code Duplication, the frontend lens's card running the same clone algorithm over the JS/TS token stream.

Duplicated block (5 lines × 2) · ×20backend/core/aws_account.py:628
Duplicated block (7 lines × 2) · ×19backend/core/eval_service.py:805
Duplicated block (6 lines × 2) · ×17backend/core/code_intel/receivers.py:491
Duplicated block (9 lines × 2) · ×12backend/channels/gateway.py:521
Duplicated block (11 lines × 2) · ×9backend/core/ingestion/units.py:140

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

What to do

  1. Resolve the 20 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with engine.py (2), aws_account.py, daily_activity_writer.py. — One of this dimension's main actionable groups (20 warning-level).
  2. Resolve the 19 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with eval_service.py, governed_edit.py, materializer.py. — One of this dimension's main actionable groups (19 warning-level).
  3. Resolve the 17 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with audit.py (2), security_hooks.py (2), receivers.py. — One of this dimension's main actionable groups (17 warning-level).
  4. Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d5_recommendation.md.

D6 · Cohesion (LCOM4)10.0 / 10Exemplary✓ 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 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 of 138 classes have LCOM4 above 3.

✓ On the Gold path — maintain.

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

Classify ADR enforcement: 1. Serialize transfers per account with Postgres advisory locks · ×3backend/templates/eval/fixtures/workspace/repos/ledgerd/docs/adr/0001-postgres-advisory-locks.md

What to do

  1. Resolve the 3 Classify ADR enforcement finding(s) in Architectural Integrity — start with 0001-postgres-advisory-locks.md, 0002-idempotency-keys.md, 0003-grpc-api.md. — One of this dimension's main actionable groups (3 recommendation-level).
  2. Enforce Architectural Integrity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D9 · Test Distribution9.8 / 10Exemplary✓ Tool-verified

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

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

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

18183 test methods: 17915 unit, 26 integration, 2 BDD, 240 e2e. The JavaScript/TypeScript suite contributes 4276 `it`/`test` case(s) across 449 test file(s) declaring at least one; its tier split is read from package names and paths only. The Rust suite contributes 63 `#[test]` function(s) across 5 file(s) declaring at least one; its unit/integration split is Cargo's own — 0 of those file(s) are integration-test targets under a crate's tests/ directory, and the rest are #[test] functions compiled into the crate they test. The Python suite contributes 13844 test function(s) across 1029 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only.

✓ On the Gold path — maintain.

Detailed fixes: d9_recommendation.md.

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

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

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

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

0 skipped, 1 zero-assertion, 1 synchronised by a fixed sleep, no mocking-framework packages referenced (hand-written doubles or no mocking) across 4276 tests. Measured on the JavaScript/TypeScript suite only — at least 1,044 test source file(s) (.py) went unread, so its test quality is unmeasured and is not in these counts.

No assertions: A: a turn on session S endsdesktop/src/__tests__/streamingTestIsolation.test.ts:60
Fixed-sleep synchronisation: a stale answer after a reset is droppeddesktop/src/services/__tests__/canvasSession.test.ts:86
Mock-dominated test: AC3: the desktop account step has a "Configure later" control that completes onboarding · ×27desktop/src/pages/__tests__/OnboardingPage.test.tsx:221

What to do

  1. Resolve the 27 Mock-dominated test finding(s) in Test Quality — start with OnboardingPage.test.tsx (4), CommunityOverlay.test.tsx (4), AuthConfigPanel.test.tsx (3). — One of this dimension's main actionable groups (27 recommendation-level).
  2. Resolve the 1 No assertions finding(s) in Test Quality — start with streamingTestIsolation.test.ts. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 Fixed-sleep synchronisation finding(s) in Test Quality — start with canvasSession.test.ts. — One of this dimension's main actionable groups (1 warning-level).
  4. Enforce Test Quality in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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

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

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

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

11 outdated, 0 yanked direct Cargo dependencies. Only DIRECT edges are graded: a transitive crate cannot be moved past what its parent's requirement admits, so reporting one would be advice its owner cannot take. A newer release is reported only where this repository's OWN requirement already admits it, so the remedy is `cargo update` and never a manifest edit — which means a release outside the declared range is deliberately NOT charged, because a written-down constraint is a decision rather than a defect. Note that a bare requirement is a CARET, and for a 0.x crate its ceiling is the minor. Whether any crate is UNMAINTAINED is not graded — crates.io publishes no maintenance status, and release age does not stand in for one. Known CVEs in this dependency graph are D30's question, read from REDACTED there.

Outdated: serde_json · ×11

✓ On the Gold path — maintain.

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

D13 · REDACTED Scanning0.0 / 10Critical✓ Tool-verified

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

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

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

2 secret(s) detected.

REDACTED

What to do

  1. Resolve the 2 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 issue-level).

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

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

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

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

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

0 of 688 shipped crate(s) use a banned license. Licences were resolved from crates.io over the crates a consumer compiles — this repository's REDACTED closed over its manifests' `[dependencies]` and `[build-dependencies]`. Crates it asks for ONLY under `[dev-dependencies]` are excluded: they are not compiled by anything that depends on this repository. ★ COVERAGE OF THIS VERDICT: it grades this repository's crate dependencies and nothing else. The repository also declares package.json and a Python pyproject.toml/requirements.txt (pip/uv/Poetry), and the licences of those dependency graphs were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots8.7 / 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.7 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: desktop/src/pages/ChatPage.tsx (64×431=27584); backend/core/streaming_orchestrator.py (75×280=21000); backend/core/session_router.py (136×140=19040) Repeated repair below the complexity floor: desktop/src/hooks/streaming-guards.ts (6 of 10 changes were fixes); backend/core/recall_metrics.py (4 of 5 changes were fixes); backend/hooks/auto_commit_hook.py (3 of 5 changes were fixes)

Hotspot: desktop/src/pages/ChatPage.tsx · ×263desktop/src/pages/ChatPage.tsx:160
Repeated repair: desktop/src/hooks/streaming-guards.ts · ×6desktop/src/hooks/streaming-guards.ts:338

What to do

  1. Resolve the 263 Hotspot finding(s) in Churn × Complexity Hotspots — start with swarm_out.py (2), HistoryView.tsx (2), ChatPage.tsx. — One of this dimension's main actionable groups (263 warning-level).
  2. Resolve the 6 Repeated repair finding(s) in Churn × Complexity Hotspots — start with streaming-guards.ts, recall_metrics.py, auto_commit_hook.py. — One of this dimension's main actionable groups (6 warning-level).

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

D17 · Explicit Debt10.0 / 10Stronggated by 25 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

25 deducted task-comment markers across 362883 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 · ×24desktop/src/types/index.ts:1831
HackCommentdesktop/src/components/layout/__tests__/NewBrainOverlay.interaction.test.tsx:250

What to do

  1. Resolve the 24 TodoComment finding(s) in Explicit Debt — start with ChatPage.tsx (3), test_todos_router.py (2), todos.py (2). — One of this dimension's main actionable groups (24 warning-level).
  2. Resolve the 1 HackComment finding(s) in Explicit Debt — start with NewBrainOverlay.interaction.test.tsx. — One of this dimension's main actionable groups (1 warning-level).
  3. Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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

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

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

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

1 of 1 documentation facets pass in full. 274 document(s) read across 3 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 3 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.

D24 · Comment Value9.1 8.9 / 10Strong✓ Tool-verified

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

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

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

57 of 6592 judged comments only repeat the code they sit on (0.9 %). 239 comment(s) in another language or script were not judged.

redundant comment · ×53desktop/src/__tests__/streaming-lifecycle-preservation.test.ts:132
doc comments repeat the namesdesktop/src/components/chat/AttachedFileChips.tsx:21

What to do

  1. Resolve the 53 redundant comment finding(s) in Comment Value — start with streaming-lifecycle-preservation.test.ts (4), useChatStreamingLifecycle.test.ts (3), ThreeColumnLayout.regions.test.tsx (3). — One of this dimension's main actionable groups (53 recommendation-level).

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

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

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

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

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

2 of 5 build units (Cargo, Python, npm) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion

What to do

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

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

D27 · Navigability9.6 / 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 9.6 / 10 · rule-coverage 100% · ceiling Documented

84 % of calls cross a namespace and 0 % go through an interface, but 90 % 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 .py source only — this repository's .tsx 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)6.0 / 10Adequate✓ Tool-verified

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

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

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

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

REDACTED
REDACTED

What to do

  1. Resolve the 4 REDACTED finding(s) in Secrets (history) — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (4 issue-level).
  2. 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)0.1 / 10Critical✓ 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 0.1 / 10 · rule-coverage 100% · ceiling Documented

115 finding(s): 0 critical, 90 high, 20 medium, 5 low. 67 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 28 file(s) — `.swarmai/review.md`, `backend/channels/swarmai_backend.sh` (line 110), `backend/channels/swarmai_guardian.sh` (line 104), `backend/core/security_hooks.py`, `backend/skills/s_pollinate/channels/bilibili.yaml`, … (+23 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 2 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

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

What to do

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

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

D30 · Dependency Vulnerabilities0.0 / 10Critical✓ 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 0.0 / 10 · rule-coverage 100% · ceiling Documented

67 finding(s): 5 critical, 30 high, 30 medium, 2 low.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

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

What to do

  1. Resolve the 29 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (23), REDACTED (6). — One of this dimension's main actionable groups (29 issue-level).
  2. Resolve the 4 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (3), REDACTED. — One of this dimension's main actionable groups (4 issue-level).
  3. Resolve the 1 Critical vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).

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

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

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

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

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

Every significant source file has living knowledge — recently and meaningfully worked. Counted over 978 of the 1148 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

✓ On the Gold path — maintain.

Detailed fixes: d34_recommendation.md.

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

Strongest change-coupling: community_api.py↔community.ts 82%; ThreeColumnLayout.tsx↔useExclusiveOverlay.ts 82%; canvas_session.py↔canvasSession.ts 77%

Change coupling: community_api.py ↔ community.ts · ×17backend/routers/community_api.py:1
Change-coupling hub: BrainHubHome.tsx → ddd_brain.py, BrainMap.tsx, BrainMapView.tsxdesktop/src/components/layout/BrainHubHome.tsx

What to do

  1. Resolve the 17 Change coupling finding(s) in Change Coupling — start with community_api.py (2), community_data.py (2), canvas_changes.py (2). — One of this dimension's main actionable groups (17 warning-level).
  2. Resolve the 1 Change-coupling hub finding(s) in Change Coupling — start with BrainHubHome.tsx. — 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
REDACTED

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

What to do

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

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

D37 · Vulnerability-disclosure Policy10.0 / 10Exemplary✓ Tool-verified

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

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

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

A vulnerability-disclosure policy (SECURITY.md) is published with a reporting contact.

✓ On the Gold path — maintain.

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

AC1 · Text alternatives6.3 / 10Adequate✓ Tool-verified

Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.

Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.

  • Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation). — desktop/src/components/file-viewer/renderers/VideoRenderer.tsx:60

What to do

  • Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
AC2 · Forms & labels5.2 / 10Adequate✓ Tool-verified

Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.

Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id. (×5) — desktop/public/brain-hub-demo.html:408, desktop/public/brain-hub-demo.html:409, desktop/public/brain-hub-demo.html:410, …
  • This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label. (×2) — desktop/public/brain-hub-demo.html:408, desktop/public/brain-hub-demo.html:409
  • This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label. (×15) — desktop/src/components/awsAccount/ConnectAccount.tsx:958, desktop/src/components/common/AgentFormModal.tsx:214, desktop/src/components/common/AgentFormModal.tsx:238, …
  • This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id. (×9) — desktop/src/components/common/AgentFormModal.tsx:213, desktop/src/components/common/AgentFormModal.tsx:237, desktop/src/components/common/AgentFormModal.tsx:249, …
  • A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one). (×5) — desktop/src/components/common/AgentFormModal.tsx:265, desktop/src/components/common/AgentFormModal.tsx:288, desktop/src/components/common/AgentFormModal.tsx:351, …
  • This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. (×3) — desktop/src/components/common/FileEditorCore.tsx:2123, REDACTED:1068, desktop/src/components/layout/BrainHub.tsx:781
  • This <div> carries a click handler, which makes it a control, but it has no text, aria-label or labelled child (the icon-only case), so assistive tech has no name to announce for it. Note that switching it to <button type="button"> — the right fix for its keyboard operability — does not give it a name either: an icon-only button still needs one. Add visible text or an aria-label. — REDACTED:237

What to do

  • Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
AC3 · Page structure7.2 / 10Strong✓ Tool-verified

Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.

Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • A page with no <title> gives no name in the tab, history or screen-reader page list. Add a descriptive <title> in <head>. (×2) — assets/SwarmAI-Architecture-Design-Doc.html:2, assets/readme/src/one-brain.html:1
  • No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. (×6) — assets/SwarmAI-Architecture-Design-Doc.html:2, assets/readme/src/one-brain.html:1, backend/skills/s_pollinate/templates/html-report/comparison.html:2, …
  • Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one. — assets/SwarmAI-Architecture-Design-Doc.html:2896
  • The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en"). — assets/readme/src/one-brain.html:1
  • A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope). — desktop/src/components/file-viewer/renderers/OfficeRenderer.tsx:95

What to do

  • Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
AC4 · Keyboard semantics2.2 / 10Critical✓ Tool-verified

Other · Accessibility — Whether interactive behaviour is keyboard-reachable — no click handler on a non-interactive element lacking a role, tabindex and key handler, no element the repo's own CSS styles `cursor: pointer` without giving it any of the three, no unfocusable element whose only binding is a mouse enter/leave pair or a double-click, no positive tabindex, no href-less anchor, no placeholder-href (#/javascript) link acting as a button. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: click handlers on non-interactive elements lacking role+tabindex+key handler, positive tabindex values, and href-less anchors. Components skipped, spreads suppressed. Deterministic, hard fact per element.

Coverage: Population: elements that pose a keyboard-semantics question, in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) — a non-natively-interactive element carrying a click handler, a double-click or hover enter/leave binding, a pointer-only gesture on a tabindex="0" element, or `cursor: pointer` from the repo's own CSS; an href-less or placeholder-href (#, javascript:) anchor; and any element with a positive tabindex. Natively interactive elements used correctly (<button>, <a href>, form controls) are NOT in the population — there is nothing to judge — so a page of nothing but correct controls gives AC4 nothing to measure. Keyboard reachability is judged from the markup, never from a rendered page. ★ An interactive element declared in a tagged-template (html`…`) or hyperscript frontend is NOT in this population — no producer reads either — so an empty population is reported as an analyzer gap, never as "this repository has no interactive elements".

  • A script attaches a click listener to this <div>, but it has no role, no tabindex and no key handler, so it can only be operated with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. (×4) — desktop/public/brain-hub-demo.html:241, desktop/public/brain-hub-demo.html:242, desktop/public/brain-hub-demo.html:243, …
  • A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler. (×25) — desktop/public/brain-hub-demo.html:270, desktop/public/brain-hub-demo.html:278, desktop/public/brain-hub-demo.html:287, …
  • A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler. (×6) — desktop/src/components/chat/AttachmentPreviewCard.tsx:47, desktop/src/components/chat/VoiceConversationIndicator.tsx:71, desktop/src/components/common/Dropdown.tsx:75, …
  • This <div role="alertdialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. — desktop/src/components/common/FileEditorCore.tsx:2227
  • This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. (×2) — desktop/src/components/common/FileEditorModal.tsx:230, desktop/src/components/common/Modal.tsx:141
  • A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}. — REDACTED:237
  • This <div> announces itself as a role="button" and binds a click, but nothing can put focus on it: no tabIndex={0} in any spelling, no key handler, and nothing in this file moves focus or sets aria-activedescendant. The role tells assistive tech what the control IS; it does not make the control reachable, so a keyboard user cannot operate it at all (WCAG 2.1.1). Give it tabIndex={0}="0" and an Enter/Space key handler, or make it a native <button>. If a parent widget owns the keyboard model, that parent must move focus onto the active role="button" or point aria-activedescendant at it. — desktop/src/components/common/ReviewModeGutter.tsx:124

What to do

  • Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
AC5 · ARIA correctness10.0 / 10Exemplary○ Nothing flagged

Other · Accessibility — Whether ARIA is used correctly — valid non-abstract roles, the ARIA state a role requires, valid (non-misspelled) aria-* attribute names, in-enum values for token-typed aria-* attributes, and no aria-hidden on (or wrapping) a focusable element. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: role values checked against the WAI-ARIA role set (abstract/invalid flagged), required ARIA state for a role, and aria-hidden on a focusable element. Deterministic, role/attribute level.

Coverage: Population: elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) that carry a role or an aria-* attribute; roles and token values are checked against the ARIA enums exhaustively within that set. An expression-valued (dynamic) role or aria-* value is skipped rather than guessed, and markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

AC6 · Visual & motion safety5.3 / 10Adequate✓ Tool-verified

Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.

Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.

Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • `.score-bar-fill` moves (`transition: width 0.3s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — backend/skills/s_pollinate/templates/html-report/scorecard.html:95
  • <div> moves — its inline style sets `transition: height 0.05s ease` — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. — backend/skills/s_pollinate/templates/remotion/components/AudioWaveform.tsx:66
  • `.buildhead .spin` moves (`animation: spin 1s linear infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — desktop/public/brain-hub-demo.html:178
  • `.navbtn.active` sets color: #f0a500 on background-color: #7a5600 — 3.2:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — desktop/public/brain-hub-demo.html:23
  • `.navbtn .badge` sets color: #fff on background-color: #f85149 — 3.4:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — desktop/public/brain-hub-demo.html:25
  • `.tab .cnt` sets color: #fff on background-color: #f85149 — 3.4:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — desktop/public/brain-hub-demo.html:36
  • `.btn.primary` sets color: #f0a500 on background-color: #7a5600 — 3.2:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — desktop/public/brain-hub-demo.html:47
  • `.sixdot` sets color: #5b636d on background-color: #1b2029 — 2.7:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — desktop/public/brain-hub-demo.html:69
  • `.panehdr` sets color: #5b636d on background-color: #161b22 — 2.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — desktop/public/brain-hub-demo.html:92
  • `.stepdot.active .n` sets color: #f0a500 on background-color: #7a5600 — 3.2:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — desktop/public/brain-hub-demo.html:148
  • `.kindopt.sel` sets color: #f0a500 on background-color: #7a5600 — 3.2:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — desktop/public/brain-hub-demo.html:160
  • `.disttable .drow.head` sets color: #5b636d on background-color: #12161c — 3.0:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — desktop/public/brain-hub-demo.html:215
  • <span> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. (×6) — desktop/src/components/awsAccount/ConnectAccount.tsx:470, desktop/src/components/awsAccount/ConnectAccount.tsx:531, desktop/src/components/awsAccount/ConnectAccount.tsx:570, …
  • <div> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. (×5) — desktop/src/components/chat/AttachmentPreviewCard.tsx:107, desktop/src/components/common/Dropdown.tsx:133, desktop/src/components/common/LoadingSpinner.tsx:16, …
  • <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×9) — desktop/src/components/common/AgentFormModal.tsx:214, desktop/src/components/common/AgentFormModal.tsx:238, desktop/src/components/common/Dropdown.tsx:117, …
  • <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×2) — desktop/src/components/common/AgentFormModal.tsx:250, desktop/src/components/common/FileEditorCore.tsx:2123
  • <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×3) — desktop/src/components/common/AgentFormModal.tsx:265, desktop/src/components/common/AgentFormModal.tsx:288, desktop/src/components/layout/BrainHubHome.tsx:128
  • <svg> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. (×2) — desktop/src/components/common/BackendStartupOverlay.tsx:86, desktop/src/components/common/SkeletonLoader.tsx:218
  • <g> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). — desktop/src/components/layout/BrainMap.tsx:146

What to do

  • Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
AC7 · A11y enforcement4.0 / 10Weak✓ Tool-verified

Other · Accessibility — Whether accessibility is ENFORCED in the toolchain — an accessibility checker configured over the markup (an a11y lint rule set, e.g. eslint-plugin-jsx-a11y or vuejs-accessibility where the project lints JavaScript) and an automated accessibility assertion wired into tests or CI (axe/pa11y/Lighthouse or an equivalent) — on the Documented→Verified→Prevented ladder.

Method: Repo config/CI scan: an accessibility checker configured over the markup (an a11y lint rule set such as eslint-plugin-jsx-a11y / vuejs-accessibility where JavaScript is linted) and an automated accessibility assertion in tests or CI (axe/pa11y/Lighthouse or equivalent), graded on the Documented→Verified→Prevented rungs. Deterministic, presence/rung detection.

Coverage: Population: the repository's own tooling configuration — lint config, test and CI files — NOT the markup. It is read for a configured accessibility checker and an automated accessibility assertion (axe/pa11y/Lighthouse, or a native-toolkit equivalent), and it credits an INVOCATION, never a mention: a licence filename, an import comment or a doc reference earns no rung. Enforcement configured entirely outside the repository leaves no evidence here and cannot be credited.

  • No accessibility enforcement found — no a11y linter (eslint-plugin-jsx-a11y) and no axe/pa11y/Lighthouse in tests or CI. Start with the linter to catch issues at author time. What was searched, so you can tell an absence from a miss: the 249 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here. — package.json:1

What to do

  • Enforce accessibility in the toolchain: add eslint-plugin-jsx-a11y, then assert with vitest-axe in tests, then gate axe/pa11y/Lighthouse in CI.
AX10 · Code composition9.8 / 10Exemplary✓ Tool-verified

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

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

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

What to do

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

Other · Architecture — Whether singleton services avoid mutable shared instance state that concurrent callers would race on.

Method: Roslyn scan: singleton field mutations unguarded by lock or Interlocked, per type; syntax-based guard detection. Deterministic, traceable per field.

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.

AX6 · Interface segregation9.8 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').

Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.

  • `UseUnifiedTabStateReturn` declares 16 required operations: `addTab`, `addHiveTab`, `closeTab`, `selectTab`, `updateTabTitle`, `updateTabSessionId`, `setTabIsNew`, `getTabState`, `updateTabState`, `updateTabStatus`, `restoreTab`, `initTabState`, `cleanupTabState`, `removeInvalidTabs`, `restoreFromFile`, `fetchMaxTabs`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — desktop/src/hooks/useUnifiedTabState.ts:382
  • `ChatStreamingLifecycle` declares 18 required operations: `setLocalSending`, `applyActivity`, `rebindActivity`, `noteSend`, `applyServerQueue`, `syncQueuedBadges`, `rebindQueue`, `clearPendingStreamTab`, `bumpStreamingDerivation`, `incrementStreamGen`, `createStreamHandler`, `createCompleteHandler`, `createDisconnectHandler`, `createErrorHandler`, `removePendingStateForSession`, `clearContextWarning`, `refreshContextUsage`, `cancelBusyWait`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — desktop/src/hooks/useChatStreamingLifecycle.ts:934
  • `TurnControlDeps` declares 21 required operations: `tabs`, `activeTabId`, `agentId`, `options`, `buildContent`, `initTab`, `setLocalSending`, `incrementStreamGen`, `setTabStatus`, `titleFromFirstMessage`, `updateTab`, `noteSend`, `editorContext`, `pluginCommand`, `rebindQueue`, `syncQueuedBadges`, `setMessages`, `clearPendingQuestion`, `clearPendingPermission`, `dismissNotice`, `newClientId`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — desktop/src/pages/chat/turnControls.ts:43

What to do

  • Split fat interfaces into focused role-interfaces so clients depend only on what they use.
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.

C2 · Access Controls10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether access is authorized by default — a framework authorization attribute/decorator or policy, or imperative guard methods (throw-on-violation) called from handlers.

Method: Roslyn scan: [Authorize] usage and authorization policies, plus imperative throw-on-violation guard methods detected via syntax. Deterministic.

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

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

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

What to do

  • Add a README to the 2 of 8 project(s) that lack one — worth up to 0.5 pts.
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.

What to do

  • Grow the ADR log (currently 3) — reach 8 to raise the maturity tier; document significant decisions as they're made.
M3 · Folder & project structure8.0 / 10Strong✓ Tool-verified

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

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

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

What to do

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

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

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

  • README.md names React 19, but the manifest declares `react` ^18.3.0. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — README.md:202
  • docs/README.md links to `SwarmAI-Architecture-Design.pdf`, but `docs/SwarmAI-Architecture-Design.pdf` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:9
  • docs/README.md links to `Self-Evolution-Harness-Design.pdf`, but `docs/Self-Evolution-Harness-Design.pdf` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:10
  • docs/README.md links to `Memory-Management-Design.pdf`, but `docs/Memory-Management-Design.pdf` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:11
  • docs/README.md links to `AIDLC-Phase3-Design.pdf`, but `docs/AIDLC-Phase3-Design.pdf` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:23

What to do

  • Reconcile the README with reality: README.md names React 19, but the manifest declares `react` ^18.3.0; docs/README.md links to `SwarmAI-Architecture-Design.pdf`, but `docs/SwarmAI-Architecture-Design.pdf` does not exist; docs/README.md links to `Self-Evolution-Harness-Design.pdf`, but `docs/Self-Evolution-Harness-Design.pdf` does not exist; docs/README.md links to `Memory-Management-Design.pdf`, but `docs/Memory-Management-Design.pdf` does not exist; docs/README.md links to `AIDLC-Phase3-Design.pdf`, but `docs/AIDLC-Phase3-Design.pdf` does not exist.
P1 · CI/CD gates10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

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

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

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

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

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

What to do

  • Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
  • Add OpenTelemetry tracing/metrics (opentelemetry-sdk) so requests are traceable across the system, not just health-probable.
P3 · Security & performance tooling0.0 / 10Critical✓ Tool-verified

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

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

  • No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 43315 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
  • `backend/skills/s_browser-agent/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`. — backend/skills/s_browser-agent/package.json:5

What to do

  • Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — 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 & Rollback10.0 / 10Exemplary✓ 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.

P5 · DR & Backup4.0 / 10Weak✓ Tool-verified

Readiness · Readiness — Whether disaster recovery is planned and codified — backups, geo-recovery, RTO/RPO, persistence guarantees — from IaC + container manifests + docs, never the live cloud.

Method: Filesystem scan: disaster recovery, backup, geo-recovery, RTO/RPO, persistence guarantees from IaC, manifests, and docs. Exhaustive, deterministic, never a live environment.

What to do

  • Document RTO/RPO and a tested restore procedure (a backup config alone isn't disaster recovery).
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.

P7 · Outbound HTTP resilience3.0 / 10Weak✓ Tool-verified

Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.

Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.

  • `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. — backend/core/run_protocol/findings.py:398

What to do

  • Pass `timeout=` on every `requests`/`httpx` call (requests has no default and will wait forever), mount an `HTTPAdapter(max_retries=Retry(...))` on shared sessions, and wrap calls to flaky dependencies in `tenacity` retries or a `pybreaker` circuit breaker.
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.

  • `_clone_plugin_source` is async and calls subprocess.run — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs. — backend/core/plugin_manager.py:481
  • `_wait_healthy_via_ssm` is async and calls time.sleep — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs. — backend/hive/provisioner.py:902
  • `stop_backend` is async and calls thread::sleep — a blocking call inside async code stalls the executor thread, and every task scheduled on it for as long as it runs. — desktop/src-tauri/src/lib.rs:2652

What to do

  • Python: await the async equivalent (asyncio.sleep, an async HTTP client such as httpx.AsyncClient or aiohttp, asyncio.create_subprocess_exec), or move the blocking call off the loop with `await asyncio.to_thread(...)`; never call asyncio.run inside a coroutine — await the coroutine.
  • Rust: `.await` the future instead of `block_on` (on a Tokio runtime thread it panics outright) and use `tokio::time::sleep(..).await` instead of `std::thread::sleep`; where synchronous code must run, move it to `tokio::task::spawn_blocking` or `block_in_place`.
R1 · Type Safety9.9 / 10Exemplary✓ Tool-verified

React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.

Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.

What to do

  • Migrate the remaining .js/.jsx files to TypeScript.
R10 · Code Duplication9.2 / 10Exemplary✓ Tool-verified

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

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

  • 45 duplicated blocks under desktop/src/components/ have copies in at least two of the sibling directories awsAccount, chat, common, file-viewer, layout, modals (+7 more sibling(s) not listed) — 21 of them are reported below, and 24 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 45 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 45 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 45 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — desktop/src/components/layout/PipelineRunCard.tsx:99
  • 44 duplicated blocks under desktop/src/ have copies in at least two of the sibling directories components, contexts, hooks, pages, services, stores (+2 more sibling(s) not listed) — 20 of them are reported below, and 24 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 44 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 44 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 44 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — desktop/src/components/settings/BackupTab.tsx:21
  • desktop/src/components/common/Dropdown.tsx:32 · desktop/src/components/common/MultiSelect.tsx:37 — the two spans are one implementation copied and then locally edited — 669 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/components/common/Dropdown.tsx:32
  • desktop/src/components/layout/PipelineRunCard.tsx:99 · desktop/src/components/swarm-out/RunOverlay.tsx:767 — the two spans are one implementation copied and then locally edited — 1001 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/components/layout/PipelineRunCard.tsx:99
  • desktop/src/components/settings/BackupTab.tsx:21 · desktop/src/pages/OnboardingPage.tsx:513 — the two spans are one implementation copied and then locally edited — 478 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/components/settings/BackupTab.tsx:21
  • desktop/src/components/file-viewer/renderers/CsvRenderer.tsx:16 · desktop/src/components/file-viewer/renderers/PdfRenderer.tsx:22 — the two spans are one implementation copied and then locally edited — 377 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/components/file-viewer/renderers/CsvRenderer.tsx:16
  • desktop/src/components/workspace/FileBrowser.tsx:161 · desktop/src/components/workspace/FolderPickerModal.tsx:156 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — desktop/src/components/workspace/FileBrowser.tsx:161
  • desktop/src/components/layout/JobsRunsOverlay.tsx:479 · desktop/src/components/layout/ToDoOverlay.tsx:1054 — the two spans are one implementation copied and then locally edited — 349 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/components/layout/JobsRunsOverlay.tsx:479
  • desktop/src/services/agents.ts:18 · desktop/src/services/channels.ts:64 — the two spans are one implementation copied and then locally edited — 401 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/services/agents.ts:18
  • desktop/src/components/layout/PipelineOverlay.tsx:100 · desktop/src/components/swarm-out/RunList.tsx:90 — the two spans are one implementation copied and then locally edited — 459 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/components/layout/PipelineOverlay.tsx:100
  • desktop/src/components/file-viewer/FileViewerPanel.tsx:588 · desktop/src/components/file-viewer/FileViewerPanel.tsx:632 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — desktop/src/components/file-viewer/FileViewerPanel.tsx:588
  • desktop/src/components/common/CommentPopover.tsx:131 · desktop/src/components/common/FileEditorCore.tsx:349 — the two spans are one implementation copied and then locally edited — 221 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/components/common/CommentPopover.tsx:131
  • desktop/src/services/tasks.ts:18 · desktop/src/services/todos.ts:31 — the two spans are one implementation copied and then locally edited — 345 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/services/tasks.ts:18
  • desktop/src/hooks/useChatStreamingLifecycle.ts:2253 · desktop/src/hooks/useStreamingActivity.ts:42 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — desktop/src/hooks/useChatStreamingLifecycle.ts:2253
  • desktop/src/pages/chat/components/ChatInput.tsx:826 · desktop/src/pages/chat/components/ChatInput.tsx:865 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — desktop/src/pages/chat/components/ChatInput.tsx:826
  • desktop/src/components/layout/CMBrainOverlay.tsx:936 · desktop/src/components/layout/CMBrainOverlay.tsx:980 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — desktop/src/components/layout/CMBrainOverlay.tsx:936
  • desktop/src/pages/SkillsPage.tsx:470 · desktop/src/pages/SkillsPage.tsx:580 · desktop/src/pages/SkillsPage.tsx:748 — 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. — desktop/src/pages/SkillsPage.tsx:470
  • desktop/src/components/file-viewer/renderers/AudioRenderer.tsx:15 · desktop/src/components/file-viewer/renderers/VideoRenderer.tsx:15 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — desktop/src/components/file-viewer/renderers/AudioRenderer.tsx:15
  • backend/skills/s_pollinate/templates/remotion/components/ShortCTACard.tsx:10 · backend/skills/s_pollinate/templates/remotion/components/ShortIntroCard.tsx:11 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — backend/skills/s_pollinate/templates/remotion/components/ShortCTACard.tsx:10
  • desktop/src/pages/chat/components/CompactNotice.tsx:37 · desktop/src/pages/chat/components/CompactNotice.tsx:129 — the two spans are one implementation copied and then locally edited — 262 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/pages/chat/components/CompactNotice.tsx:37
  • desktop/src/pages/SkillsPage.tsx:951 · desktop/src/pages/SkillsPage.tsx:980 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — desktop/src/pages/SkillsPage.tsx:951
  • desktop/src/pages/chat/components/TSCCPanel.tsx:128 · desktop/src/pages/chat/components/TSCCPanel.tsx:206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — desktop/src/pages/chat/components/TSCCPanel.tsx:128
  • backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:293 · backend/skills/s_pollinate/templates/remotion/components/FlowChart.tsx:30 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:293
  • desktop/src/components/common/AgentFormModal.tsx:256 · desktop/src/components/common/AgentFormModal.tsx: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. — desktop/src/components/common/AgentFormModal.tsx:256
  • desktop/src/components/common/BackendStartupOverlay.tsx:412 · desktop/src/components/common/BackendStartupOverlay.tsx:464 — the two spans are one implementation copied and then locally edited — 104 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — desktop/src/components/common/BackendStartupOverlay.tsx:412
  • backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:135 · backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:166 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:135
  • desktop/src/hooks/useChatStreamingLifecycle.ts:3239 · desktop/src/hooks/useChatStreamingLifecycle.ts:3264 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — desktop/src/hooks/useChatStreamingLifecycle.ts:3239
  • desktop/src/services/chat.ts:998 · desktop/src/services/chat.ts:1035 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — desktop/src/services/chat.ts:998
  • desktop/src/services/tscc.ts:134 · desktop/src/services/tscc.ts:170 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — desktop/src/services/tscc.ts:134
  • backend/skills/s_pollinate/templates/remotion/components/animations.tsx:134 · backend/skills/s_pollinate/templates/remotion/components/animations.tsx:153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — backend/skills/s_pollinate/templates/remotion/components/animations.tsx:134
  • backend/skills/s_pollinate/templates/remotion/Video.tsx:118 · backend/skills/s_pollinate/templates/remotion/Video.tsx:258 — all 2 copies are in the same file, and what repeats is a LIST OF ENTRIES rather than behaviour — the same entries written out more than once. Extract them into one shared, exported constant and spread that constant into each site, rather than into a function the sites call: a list like this often lives in declarative metadata (a decorator's options object, a static configuration table) that a build step must be able to read statically, where a function call is not allowed. Adding an entry to one copy and not the other is the failure this prevents. — backend/skills/s_pollinate/templates/remotion/Video.tsx:118
  • desktop/src/components/file-viewer/FileViewer.tsx:339 · desktop/src/components/file-viewer/FileViewer.tsx:382 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — desktop/src/components/file-viewer/FileViewer.tsx:339
  • desktop/src/hooks/streaming-machine.ts:129 · desktop/src/hooks/streaming-machine.ts:234 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — desktop/src/hooks/streaming-machine.ts:129
  • desktop/src/hooks/useUnifiedAttachments.ts:173 · desktop/src/hooks/useUnifiedAttachments.ts:307 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — desktop/src/hooks/useUnifiedAttachments.ts:173
  • backend/skills/s_pollinate/templates/remotion/Video.tsx:152 · backend/skills/s_pollinate/templates/remotion/Video.tsx:202 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — backend/skills/s_pollinate/templates/remotion/Video.tsx:152
  • desktop/src/components/layout/CMBrainOverlay.tsx:375 · desktop/src/components/layout/CMBrainOverlay.tsx:1033 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — desktop/src/components/layout/CMBrainOverlay.tsx:375
  • desktop/src/hooks/streaming-machine.ts:223 · desktop/src/hooks/streaming-machine.ts:243 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — desktop/src/hooks/streaming-machine.ts:223
  • desktop/src/hooks/useVoiceConversation.ts:219 · desktop/src/hooks/useVoiceConversation.ts: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. — desktop/src/hooks/useVoiceConversation.ts:219
  • desktop/src/components/layout/HiveFleetOverlay.tsx:178 · desktop/src/components/layout/JobsRunsOverlay.tsx:220 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — desktop/src/components/layout/HiveFleetOverlay.tsx:178
  • desktop/src/components/layout/HiveFleetOverlay.tsx:257 · desktop/src/components/layout/JobsRunsOverlay.tsx:165 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — desktop/src/components/layout/HiveFleetOverlay.tsx:257

What to do

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

React / JS · Architecture — Conformance to the detected frontend architecture layout (feature-sliced / layered src) plus cross-package deep-import rules (D-386).

Method: Conformance to the detected frontend layout (feature-sliced / layered src) plus cross-package deep-import rules, over the module graph. Deterministic.

  • backend/skills/s_browser-agent/smoke-commands.mjs:16 reaches into another package with a relative path (./node_modules/playwright/index.mjs) — import the package by name instead. — backend/skills/s_browser-agent/smoke-commands.mjs:16
  • REDACTED:20 reaches into another package with a relative path (./node_modules/playwright/index.mjs) — import the package by name instead. — REDACTED:20

What to do

  • Fix the listed violations: import through public entries (package exports / slice index), never reach into another layer or package's internals.
R2 · Cyclomatic Complexity8.0 / 10Strong✓ Tool-verified

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

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

  • inner has cyclomatic complexity 314 and cognitive complexity 522; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/src/hooks/useChatStreamingLifecycle.ts:2688
  • main has cyclomatic complexity 115 and cognitive complexity 152; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — backend/skills/s_browser-agent/browser-agent.mjs:393
  • FileEditorCore has cyclomatic complexity 102 and cognitive complexity 86; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/src/components/common/FileEditorCore.tsx:688
  • ConnectAccount has cyclomatic complexity 93 and cognitive complexity 88; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/src/components/awsAccount/ConnectAccount.tsx:110
  • (anonymous) has cyclomatic complexity 76 and cognitive complexity 128; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — backend/skills/s_pptx/scripts/html2pptx.js:534
  • reconcile has cyclomatic complexity 73 and cognitive complexity 115; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/src/hooks/useChatStreamingLifecycle.ts:1265
  • AwsAccountTab has cyclomatic complexity 71 and cognitive complexity 65; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/src/components/settings/AwsAccountTab.tsx:41
  • (anonymous) has cyclomatic complexity 67 and cognitive complexity 93; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:484
  • AssistantMessageView has cyclomatic complexity 65 and cognitive complexity 56; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/src/pages/chat/components/AssistantMessageView.tsx:226
  • AgentRow has cyclomatic complexity 60 and cognitive complexity 50; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/src/pages/chat/components/TurnZones.tsx:513
  • ChatInput has cyclomatic complexity 58 and cognitive complexity 54; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/src/pages/chat/components/ChatInput.tsx:173
  • FileViewerPanelImpl has cyclomatic complexity 58 and cognitive complexity 51; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/src/components/file-viewer/FileViewerPanel.tsx:181
  • DispatchCard has cyclomatic complexity 57 and cognitive complexity 42; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/src/pages/chat/components/DispatchCard.tsx:160
  • deriveTurnView has cyclomatic complexity 56 and cognitive complexity 72; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:314
  • fetchFileContent has cyclomatic complexity 54 and cognitive complexity 84; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/src/components/file-viewer/FileViewer.tsx:321
  • CaseDetailView has cyclomatic complexity 53 and cognitive complexity 50; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/src/pages/eval/CasesTab.tsx:368
  • RunOverlay has cyclomatic complexity 50 and cognitive complexity 45; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/src/components/swarm-out/RunOverlay.tsx:653
  • labelBash has cyclomatic complexity 49 and cognitive complexity 80; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:872
  • CommandPanel has cyclomatic complexity 49 and cognitive complexity 49; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/src/components/swarm-out/RunOverlay.tsx:337
  • (anonymous) has cyclomatic complexity 48 and cognitive complexity 50; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — desktop/src/hooks/useChatStreamingLifecycle.ts:3997

What to do

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

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

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

  • desktop/src/hooks/useChatStreamingLifecycle.ts has 4726 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/hooks/useChatStreamingLifecycle.ts:1
  • desktop/src/pages/ChatPage.tsx has 2917 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/pages/ChatPage.tsx:1
  • desktop/src/components/common/FileEditorCore.tsx has 2150 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/components/common/FileEditorCore.tsx:1
  • desktop/src/types/index.ts has 1663 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/types/index.ts:1
  • desktop/src/stores/MessageStore.ts has 1300 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/stores/MessageStore.ts:1
  • desktop/src/components/layout/BrainHub.tsx has 1243 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/components/layout/BrainHub.tsx:1
  • REDACTED has 1132 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
  • desktop/src/components/layout/ToDoOverlay.tsx has 1131 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/components/layout/ToDoOverlay.tsx:1
  • desktop/src/components/layout/CMBrainOverlay.tsx has 1099 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/components/layout/CMBrainOverlay.tsx:1
  • desktop/src/pages/chat/components/ChatInput.tsx has 1062 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/pages/chat/components/ChatInput.tsx:1
  • REDACTED has 1041 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
  • desktop/src/pages/SkillsPage.tsx has 1007 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/pages/SkillsPage.tsx:1
  • desktop/src/pages/chat/components/TurnZones.tsx has 994 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/pages/chat/components/TurnZones.tsx:1
  • desktop/src/services/chat.ts has 984 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/services/chat.ts:1
  • desktop/src/components/layout/ThreeColumnLayout.tsx has 983 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/components/layout/ThreeColumnLayout.tsx:1
  • desktop/src/hooks/useUnifiedTabState.ts has 977 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/hooks/useUnifiedTabState.ts:1
  • desktop/src/components/awsAccount/ConnectAccount.tsx has 974 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/components/awsAccount/ConnectAccount.tsx:1
  • desktop/src/components/file-viewer/FileViewer.tsx has 959 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/components/file-viewer/FileViewer.tsx:1
  • desktop/src/components/workspace-explorer/VirtualizedTree.tsx has 942 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/components/workspace-explorer/VirtualizedTree.tsx:1
  • desktop/src/pages/chat/components/TabView.tsx has 930 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/pages/chat/components/TabView.tsx:1
  • desktop/src/components/file-viewer/FileViewerPanel.tsx has 902 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/components/file-viewer/FileViewerPanel.tsx:1
  • desktop/src/components/swarm-out/RunOverlay.tsx has 895 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/components/swarm-out/RunOverlay.tsx:1
  • desktop/src/hooks/useCanvasHost.ts has 822 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/hooks/useCanvasHost.ts:1
  • backend/skills/s_browser-agent/browser-agent.mjs has 792 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — backend/skills/s_browser-agent/browser-agent.mjs:1
  • desktop/src/components/layout/PollinateOverlay.tsx has 775 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/components/layout/PollinateOverlay.tsx:1
  • desktop/src/pages/chat/components/TSCCModules.tsx has 738 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/pages/chat/components/TSCCModules.tsx:1
  • desktop/src/components/layout/CapabilitiesOverlay.tsx has 715 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/components/layout/CapabilitiesOverlay.tsx:1
  • REDACTED has 701 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
  • desktop/src/contexts/ExplorerContext.tsx has 690 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/contexts/ExplorerContext.tsx:1
  • desktop/src/pages/OnboardingPage.tsx has 682 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/pages/OnboardingPage.tsx:1
  • desktop/src/pages/eval/CasesTab.tsx has 650 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/pages/eval/CasesTab.tsx:1
  • desktop/src/pages/chat/turnZones.ts has 649 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/pages/chat/turnZones.ts:1
  • desktop/src/components/common/BackendStartupOverlay.tsx has 641 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/components/common/BackendStartupOverlay.tsx:1
  • backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx has 638 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx:1
  • desktop/src/pages/chat/components/AssistantMessageView.tsx has 628 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/pages/chat/components/AssistantMessageView.tsx:1
  • desktop/src/components/swarm-out/live.ts has 615 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/components/swarm-out/live.ts:1
  • desktop/src/components/layout/ArtifactsOverlay.tsx has 606 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/components/layout/ArtifactsOverlay.tsx:1
  • desktop/src/pages/chat/turnControls.ts has 605 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/pages/chat/turnControls.ts:1
  • REDACTED has 565 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
  • desktop/src/components/terminal/TerminalPanel.tsx has 535 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — desktop/src/components/terminal/TerminalPanel.tsx:1

What to do

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

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

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

  • No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×40) — backend/skills/s_pptx/scripts/html2pptx.js:1, backend/skills/s_browser-agent/browser-agent.mjs:1, backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx:1, …

What to do

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

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

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

R6 · Tooling10.0 / 10Exemplary✓ Tool-verified

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

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

R7 · Dead Code7.9 / 10Strong✓ Tool-verified

React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).

Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.

  • Unreachable from the 91 application, 16 tooling and 532 test entry point(s) detected in this repo. Gate removals on `npm run build` — an undetected custom entry would make these reachable.
  • no import path from any entry point (91 application, 16 tooling, 532 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make (×8) — desktop/src/components/workspace/FileBrowser.tsx, backend/skills/s_browser-agent/test-aria-perceive.mjs, desktop/src/components/modals/ConvertToTaskModal.tsx, …
  • Nothing imports this binding — it is safe to review for removal. (×5) — backend/skills/s_pollinate/templates/remotion/Thumbnail.tsx:105, backend/skills/s_pollinate/templates/remotion/Video.tsx:360, desktop/src/components/chat/AttachedFileChips.tsx:273, …
  • Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists. (×26) — backend/skills/s_pollinate/templates/remotion/components/AudioWaveform.tsx:19, backend/skills/s_pollinate/templates/remotion/components/CodeBlock.tsx:5, backend/skills/s_pollinate/templates/remotion/components/ComparisonCard.tsx:5, …

What to do

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

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

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

  • Imported but not declared in any reachable package.json — installs work only by hoisting accident. — backend/skills/s_pptx/scripts/html2pptx.js:28
  • Imported only as a TYPE and declared in no reachable package.json. The import is erased at compile time, so nothing is installed and no runtime resolution depends on it — but type-checking a clean clone will fail. Declare the typings it resolves through (or the package itself) in the owning package.json. — REDACTED:21
  • Declared in desktop/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.

What to do

  • Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
R9 · Circular Imports0.0 / 10Critical✓ Tool-verified

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

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

  • desktop/src/components/common/FileEditorCore.tsx → desktop/src/components/common/FileEditorModal.tsx → desktop/src/components/common/FileEditorCore.tsx — desktop/src/components/common/FileEditorCore.tsx:38
  • desktop/src/components/layout/ArtifactsOverlay.tsx → desktop/src/components/layout/overlayQueries.ts → desktop/src/components/layout/overlayChunks.ts → desktop/src/components/layout/ArtifactsOverlay.tsx (one verified cycle inside a mutually-dependent group of 16 files) — desktop/src/components/layout/ArtifactsOverlay.tsx:29
  • desktop/src/components/settings/HiveBrains.tsx → REDACTED → desktop/src/components/settings/HiveBrains.tsx — desktop/src/components/settings/HiveBrains.tsx:27
  • desktop/src/components/swarm-out/LiveDispatches.tsx → desktop/src/components/swarm-out/RunList.tsx → desktop/src/components/swarm-out/LiveDispatches.tsx (one verified cycle inside a mutually-dependent group of 3 files) — desktop/src/components/swarm-out/LiveDispatches.tsx:42
  • desktop/src/components/workspace-explorer/TreeNodeRow.tsx → desktop/src/components/workspace-explorer/VirtualizedTree.tsx → desktop/src/components/workspace-explorer/TreeNodeRow.tsx — desktop/src/components/workspace-explorer/TreeNodeRow.tsx:32

What to do

  • Break each cycle by extracting the shared piece into a module both sides can import.
S1 · Web-Security Posture8.0 / 10Strong✓ Tool-verified

Other · Security — Only what this repository's own non-C# files could be read for was assessed — and because this repository commits the configuration that serves its own HTTP surface, that configuration could be read in full for the security response headers it sets. Nothing else in this dimension was assessed: the transport, cookie, input-validation and crypto controls are read from a source model that was not loaded for this repository’s language, so their absence here is not a finding about this repository.

Method: Roslyn plus filesystem scan: HSTS/security headers, secure cookies, input validation, middleware order, weak crypto (MD5/SHA1/DES); HTTPS-metadata context-aware. On a repository with no .NET source it reads JavaScript/TypeScript, Dart, Ruby, Scala, Rust or Elixir source itself (test, vendored, generated and minified paths not) for the arms that hold whether or not the code serves HTTP: a weak hash or cipher, key material fixed in the source, a TLS client that accepts any certificate, and (JavaScript/TypeScript, Ruby, Scala, Rust and Elixir) an obsolete TLS version; the server controls are not assessed there, and a Dart, Ruby, Scala, Rust or Elixir repository that serves no HTTP of its own is N/A on them. Deterministic.

  • None of the 11 security response headers the OWASP Secure Headers Project recommends (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options, …) is configured — defense in depth, even when a reverse proxy could set them. This is reported because `Caddyfile` is committed to this repository and declares the server that serves it, so the configuration that would carry these headers is in this repository and was read in full. (−2.0 on this card.) — hive/Caddyfile:40

What to do

  • Set security response headers on the surface this repository serves: an `add_header` directive per header in the nginx/Caddy/Apache config, a `_headers` / `vercel.json` / `netlify.toml` entry for a static host, or `helmet()` in the HTTP server. `Content-Security-Policy` is the one that pays for itself first — it is what contains an injected script once one reaches the page — followed by `X-Content-Type-Options: nosniff` and a frame policy (`X-Frame-Options: DENY`, or CSP `frame-ancestors`). Where the app is served from a build container, the header configuration belongs in the image beside the built assets, so it ships with them rather than depending on where it lands.
X1 · Async correctness7.7 / 10Strong✓ Tool-verified

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

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

  • This `async` body is polled on an executor's worker thread, and `std::thread::sleep` blocks that thread: for the whole delay no other task scheduled on it makes progress — the Rust form of blocking on a task. Use `tokio::time::sleep(…).await` (or the runtime's own timer), which suspends only this task. Where the blocking work is not a sleep but a synchronous call that cannot be made async, move it off the executor with `tokio::task::spawn_blocking(…).await`. (×2) — desktop/src-tauri/src/lib.rs:487, desktop/src-tauri/src/lib.rs:2666
  • The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception. (×21) — backend/main.py:1083, backend/main.py:1111, backend/main.py:1189, …
  • This `async def` runs on the event loop's thread, and `time.sleep` blocks that thread: for the whole delay no other coroutine, request or callback on the loop makes progress — the Python form of blocking on a task. Use `await asyncio.sleep(…)`, which suspends only this coroutine. Where the blocking work is not a sleep but a synchronous call that cannot be made async, move it off the loop with `await asyncio.to_thread(…)` (or `loop.run_in_executor(…)`). — backend/skills/s_pollinate/scripts/tts/backends/edge.py:78

What to do

  • Blocking `thread::sleep` inside an `async` body
X12 · Unreachable branch10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

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

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

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

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

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

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

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

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

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

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

X17 · Uncapped recursion over a caller-supplied document1.4 / 10Critical✓ Tool-verified

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

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

  • `mapIngestionValue` is exported and takes `value: unknown` from its caller, and it calls itself at line 252 (`mapIngestionValue`) with a piece of `value` (and at line 255) — and nowhere in `mapIngestionValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `mapIngestionValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — desktop/src/services/ingestion.ts:252
  • `treeNodeToCamelCase` is exported and takes `data: Record<string, unknown>` from its caller, and it calls itself at line 168 (`treeNodeToCamelCase`) with a piece of `data` — and nowhere in `treeNodeToCamelCase` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `treeNodeToCamelCase` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — desktop/src/services/workspace.ts:168
  • `toFileTreeItem` is exported and takes `node: TreeNode` from its caller, and it calls itself at line 29 (`toFileTreeItem`) with a piece of `node` — and nowhere in `toFileTreeItem` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `toFileTreeItem` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — desktop/src/components/workspace-explorer/toFileTreeItem.ts:29
  • `structured` is public, takes a document from its caller (line 675) and hands it to `_check_schema`, which calls itself at line 552 (`_check_schema`) with a piece of `schema` (and at line 554) — and nowhere in `_check_schema` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_check_schema` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — backend/jobs/bedrock.py:552
  • `structured` is public, takes a document from its caller (line 675) and hands it to `_validate`, which calls itself at line 640 (`_validate`) with a piece of `value` (and at line 643) — and nowhere in `_validate` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_validate` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — backend/jobs/bedrock.py:640
  • `canonical_json` is public, takes a document from its caller (line 184) and hands it to `_canonical`, which calls itself at line 173 (`_canonical`) with a piece of `value` — and nowhere in `_canonical` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_canonical` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — backend/core/app_manifest.py:173
  • `strip_degenerate_in_value` is public and takes `value: Any` from its caller, and it calls itself at line 270 (`strip_degenerate_in_value`) with a piece of `value` (and at line 275) — and nowhere in `strip_degenerate_in_value` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `strip_degenerate_in_value` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — backend/core/output_degeneration.py:270
  • `record_tool_result` is public, takes a document from its caller (line 89) and hands it to `_measured_fields`, which calls itself at line 82 (`_measured_fields`) with a piece of `value` — and nowhere in `_measured_fields` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_measured_fields` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — backend/core/session_inputs.py:82
  • `externalize_payload` is public, takes a document from its caller (line 490) and hands it to `_externalize`, which calls itself at line 480 (`_externalize`) with a piece of `value` (and at line 484) — and nowhere in `_externalize` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_externalize` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — backend/core/run_protocol/events.py:480
  • `requirements_text` is public, takes a document from its caller (line 173) and hands it to `walk`, which calls itself at line 197 (`walk`) with a piece of `v` (and at line 200) — and nowhere in `walk` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `walk` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — backend/core/run_protocol/run_knowledge.py:197

What to do

  • Each finding names the externally-callable member that accepts the document and the self-call that descends, and states that no depth parameter or counter exists anywhere in the walk. Confirm from the two, then thread a depth argument through the walk and reject documents past a fixed maximum, or rewrite it with an explicit stack.
X18 · Disposal-pattern correctness10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

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

X2 · Cancellation propagation6.7 / 10Adequate✓ Tool-verified

Other · Code Health — Whether async functions that make a cancellable request accept or pass on an AbortSignal (adoption curve).

Method: Roslyn scan: every async method (excluding framework-fixed overrides/Blazor handlers) checked for CancellationToken parameter presence. Deterministic, adoption percentage. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same question: every named async function that itself makes a request an AbortSignal can cancel (global `fetch`, axios and its file-local instances, ky, ofetch) counts, and it is compliant when its parameters or body name a signal or it hands one of its own parameters to the request as options; signatures a framework fixes (JSX event handlers, route and lifecycle exports, request-first handlers, `override`, `'use server'` modules, TanStack `mutationFn`) are exempt unless they take a signal. Deterministic, adoption percentage.

  • Only 4/9 async functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
  • `flush` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — desktop/src/services/logForwarder.ts:59
  • `synthesizeSpeech` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — desktop/src/services/voice.ts:25
  • `getVoices` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — desktop/src/services/voice.ts:54
  • `fetchArtifactText` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — backend/apps/pptx-maker/package/upstream/kirocrew/website/src/apps/pptx-maker/api.ts:169
  • `fetchArtifactJson` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — backend/apps/pptx-maker/package/upstream/kirocrew/website/src/apps/pptx-maker/api.ts:176

What to do

  • Thread an AbortSignal through async functions that make requests, so the work stops when its caller gives up.
X21 · Side-effecting pattern guard10.0 / 10Exemplary○ Nothing flagged

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

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

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

Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back. Also whether a `finally` that gives the primitive back unconditionally can run in a state where the method does not hold it: after a timed wait whose result was discarded, after an acquire inside the `try` that can fail, after the body already released it, or never, because a `return` left between the acquire and the `try`.

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

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

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

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

X24 · Document value interpolated into markup unescaped6.5 / 10Adequate✓ Tool-verified

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

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

  • `displayText.substring(0,80)` carries text this program read out of a document — an attribute or a text node, which the DOM hands back already decoded, so an entity its author wrote is a live character again — and it is written straight into the text of an element of markup built here with nothing escaping it on the way. The value is chosen by whoever authored that document, not by this program, so it can close the attribute or element it sits in and open another — a crafted document becomes markup in what this code renders. Escape `displayText.substring(0,80)` at this site, or validate it against the shape the position accepts before interpolating it. — backend/skills/s_browser-agent/browser-agent.mjs:292
  • `highlighted+'\n'` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — desktop/src/components/common/FileEditorCore.tsx:1274
  • `svg` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. (×2) — REDACTED:124, REDACTED:386
  • `scaledSvg` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — REDACTED:245
  • `svg` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — REDACTED:538
  • `html` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — REDACTED:115

What to do

  • Each finding names the expression, the attribute it lands in and the line. Confirm the value's origin from the read this analyzer traced, then escape it at the sink or validate it against the shape the attribute accepts before interpolating.
X25 · Inert configuration knob10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

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

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

Other · Code Health — Whether a `for` loop leaves the `RefCell` it is walking alone — safe Rust rejects a body that changes the collection its loop borrows at compile time, except through interior mutability: a `RefCell` borrowed in the loop's header stays borrowed until the loop ends, so a `borrow_mut()` of it inside the body panics with `already borrowed: BorrowMutError` and the remaining elements are never seen. Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.

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

X28 · Index access outside its own emptiness guard7.8 / 10Strong✓ Tool-verified

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.

  • This condition tests `prog` for emptiness and then indexes it on a branch that test does not reach. `prog[0]` is evaluated whenever the guarded half is false — which includes the case the guard exists to anticipate, `prog` being empty — so an empty `prog` indexes position 0 of nothing and throws. This same condition already shows the intended bracketing: `prog[1]` sits INSIDE the guard. Either the guard is load-bearing, in which case this access escapes it and crashes, or `prog` cannot be empty here, in which case the guard beside it is dead code — the condition is wrong under both readings. Move the parenthesis so the emptiness test brackets every access to `prog`. — backend/core/pipeline_command.py:105

What to do

  • Each finding names the index access that escapes the guard and the line of the correctly bracketed access beside it. Compare the two: they differ only in where one parenthesis sits. Move it so the emptiness test brackets every access to that symbol — and if the value provably cannot be empty at this point, delete the test rather than leave a condition that guards one access and not its neighbour.
X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged

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

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

X3 · Exception handling6.6 / 10Adequate✓ Tool-verified

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

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

  • An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×28) — desktop/src/App.tsx:116, desktop/src/App.tsx:206, desktop/src/stores/MessageStore.ts:1263, …
  • `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it. (×11) — desktop/src/stores/terminalLocation.ts:168, desktop/src/services/chat.ts:493, desktop/src/services/sessionEvents.ts:166, …
  • `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. — desktop/src/hooks/useChatStreamingLifecycle.ts:899

What to do

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

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

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

X4 · Structured logging5.5 / 10Adequate✓ Tool-verified

Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.

Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.

  • `info` at line 148 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — backend/main.py:148
  • `info` at line 614 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — backend/main.py:614
  • `error` at line 616 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — backend/main.py:616
  • `warning` at line 631 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — backend/main.py:631
  • `info` at line 799 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — backend/main.py:799
  • `info` at line 1036 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — backend/main.py:1036
  • `info` at line 1037 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — backend/main.py:1037
  • `info` at line 1038 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — backend/main.py:1038
  • `info` at line 1039 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — backend/main.py:1039
  • `debug` at line 85 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — backend/utils/bundle_paths.py:85
  • `debug` at line 91 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — backend/utils/bundle_paths.py:91
  • `debug` at line 95 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — backend/utils/bundle_paths.py:95
  • `debug` at line 97 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — backend/utils/bundle_paths.py:97
  • `debug` at line 124 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — backend/utils/bundle_paths.py:124
  • `debug` at line 130 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — backend/utils/bundle_paths.py:130
  • `debug` at line 135 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — backend/utils/bundle_paths.py:135
  • `info` at line 137 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — backend/utils/bundle_paths.py:137
  • `warning` at line 145 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — backend/utils/bundle_paths.py:145
  • `warning` at line 72 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:72
  • `warning` at line 80 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:80
  • `warning` at line 84 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:84
  • `warning` at line 120 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:120
  • `warning` at line 124 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:124
  • `warning` at line 305 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:305
  • `warning` at line 339 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:339
  • `warning` at line 1431 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1431
  • `warning` at line 73 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — backend/skills/s_notify/notify.py:73
  • `error` at line 79 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — backend/skills/s_notify/notify.py:79
  • `info` at line 341 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — backend/skills/s_notify/notify.py:341
  • `info` at line 182 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — backend/scripts/generate_mock_data.py:182
  • `info` at line 59 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — backend/scripts/generate_seed_db.py:59
  • `warning` at line 99 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — backend/scripts/generate_seed_db.py:99
  • `info` at line 153 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — backend/scripts/generate_seed_db.py:153
  • `warning` at line 165 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — backend/scripts/generate_seed_db.py:165
  • `info` at line 192 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — backend/scripts/generate_seed_db.py:192
  • `info` at line 243 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — backend/scripts/generate_seed_db.py:243
  • `error` at line 272 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — backend/scripts/generate_seed_db.py:272
  • `info` at line 274 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — backend/scripts/generate_seed_db.py:274
  • `info` at line 315 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — backend/scripts/generate_seed_db.py:315
  • `info` at line 316 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — backend/scripts/generate_seed_db.py:316

What to do

  • Interpolated log message defeats structured logging
X5 · Nullable reference types6.9 / 10Adequate✓ Tool-verified

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

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

  • 2/3 of this repository's type-checking configuration(s) turn on strict null checking (`"strict": true`, or `"strictNullChecks": true`). A configuration that states neither is counted as OFF, because off is tsc's own default; a solution-style one whose `"files"` is empty and whose `"references"` point at other projects is in neither number, because it checks no source itself. Where it is off, `string` admits `null` and `undefined`: passing a value that is null compiles silently and throws on the first property access.
  • ~1.5 `!` null assertions per 1k TypeScript source lines — 163 assertion(s) across the 109317 source line(s) of the 430 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: desktop/src/pages/ChatPage.tsx (15), desktop/src/hooks/useChatStreamingLifecycle.ts (14), desktop/src/components/file-viewer/CanvasChanges.tsx (12). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.

What to do

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

WCAG coverage — what static analysis assessed

Statically assessed 15 of 55 WCAG 2.2 Level A/AA success criteria (27%; ≈30% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 40 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).

DimensionWCAG 2.2 A/AA criteriaCoverage
AC1 · Text alternatives1.1.1, 1.2.2, 1.2.5Partial signal
AC2 · Forms & labels1.3.1, 3.3.2, 4.1.2Partial signal
AC3 · Page structure1.4.4, 2.2.1, 2.4.1, 2.4.2, 3.1.1, 4.1.2Partial signal
AC4 · Keyboard semantics2.1.1, 2.4.3Partial signal
AC5 · ARIA correctness4.1.2Partial signal
AC6 · Visual & motion safety1.4.3, 2.4.7Partial — literal CSS only
AC7 · A11y enforcementenforcement — no page criterionEnforcement posture (process)

Not statically assessed — these 40 Level A/AA criteria need runtime or manual evaluation (WCAG-EM): 1.2.1, 1.2.3, 1.2.4, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.4.1, 1.4.2, 1.4.5, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 2.1.2, 2.1.4, 2.2.2, 2.3.1, 2.4.4, 2.4.5, 2.4.6, 2.4.11, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.7, 2.5.8, 3.1.2, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.6, 3.3.1, 3.3.3, 3.3.4, 3.3.7, 3.3.8, 4.1.3.

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 Health59%Adequate — gated by D1, D2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture68%Adequate — gated by D26, R9Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity80%StrongStrongest area.
Readiness41%Weak — gated by D13, P3, P7Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security75%Adequate — gated by D29, D36Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Accessibility46%Weak — gated by AC4Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance60%AdequateAcceptable, with room to improve.
Unscored — 3 check(s) recorded observations but carry no score

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

  • X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X6 Hand-rolled structured-format parsing — 18 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.
Not evidenced — 3 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: this repository stores data through 'sqlite3' (REDACTED:246) but declares no persisted model this check reads (Django, SQLAlchemy, SQLModel, Peewee, Tortoise and MongoEngine model fields, Alembic and Django migration 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 its changes need an audit trail could not be established, and the trail's absence is not scored.
  • C4 Data Retention — Not assessed: this repository stores data through 'sqlite3' (REDACTED:246) but declares no persisted model this check reads (Django, SQLAlchemy, SQLModel, Peewee, Tortoise and mongoengine model fields, Alembic and Django migration columns, SQL schemas). 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' (REDACTED:246) but declares no persisted model this check reads (Django, SQLAlchemy, SQLModel, Peewee, Tortoise and mongoengine model fields, Alembic and Django migration 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.
Not included — 35 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.

  • 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
  • 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
  • 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 dev`) exited before it served a page. Likely cause (the repository): package.json has no "dev" script, so `npm run dev` could not start the app. Last output: "npm error Missing script: "dev" / npm error / npm error To see a list of scripts, run: / npm error npm run / 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.
  • D11 Test Reliability — Test reliability not included
  • D16 Bus Factor — single-maintainer repository — bus factor is not applicable
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D21 Naming Consistency — Naming consistency is measured on C# and TypeScript only; JavaScript, Python, Rust, html not measured.
  • D22 Internal API Consistency — API consistency is measured on C# only; the exposed Python, Rust surface was not measured.
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D25 ADR Conformance — None of 2 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.
  • D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
  • D32 Data Compliance (PII/GDPR) — 6 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D8 Code Coverage — Coverage NOT MEASURED: the JavaScript/TypeScript half could not be measured — desktop/ runs vitest but declares no coverage provider, so the suite can run and still produce no lcov — add `@vitest/coverage-v8` (or `@vitest/coverage-istanbul`) as a devDependency. Coverage is excluded from the score rather than counted as a near-zero. The named suite step is one the repository's maintainers can perform; once it passes, the real number is measured on the next scan. Alternatively, commit the lcov/Cobertura report your CI produces and it is read without a re-run.
  • DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (301 value object(s))
  • ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and a call made through an inferred or generic receiver has no resolvable owner in the source. Reported as guidance rather than measured
  • ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
  • ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
  • GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
  • IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
  • P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
  • P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
  • PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for a pytest-benchmark or pytest-codspeed dependency with tests taking the `benchmark` fixture, an asv.conf.json with its `time_`/`mem_`/`peakmem_` benchmarks, or a pyperf Runner, 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.
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A — Findings (grouped)

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

Critical — 217 finding(s)
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
  • + 42 more in this group — see findings.md.
AC4 · Keyboard semantics · Click handler on a non-interactive <div> · ×32
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:241 — A script attaches a click listener to this <div>, but it has no role, no tabindex and no key handler, so it can only be operated with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:242 — A script attaches a click listener to this <div>, but it has no role, no tabindex and no key handler, so it can only be operated with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:243 — A script attaches a click listener to this <div>, but it has no role, no tabindex and no key handler, so it can only be operated with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:244 — A script attaches a click listener to this <div>, but it has no role, no tabindex and no key handler, so it can only be operated with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:270 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:278 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:287 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:308 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:309 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:312 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:313 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:314 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:315 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:316 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:322 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:323 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:324 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:327 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:330 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:331 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:423 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:424 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:425 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:426 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:427 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • + 7 more in this group — see findings.md.
D30 · Dependency Vulnerabilities · High CVE · ×29
  • 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
  • + 4 more in this group — see findings.md.
AC2 · Forms & labels · <label> that labels no control · ×14
  • <label> that labels no control desktop/public/brain-hub-demo.html:408 — This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control desktop/public/brain-hub-demo.html:409 — This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control desktop/public/brain-hub-demo.html:410 — This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control desktop/public/brain-hub-demo.html:420 — This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control desktop/public/brain-hub-demo.html:430 — This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control desktop/src/components/common/AgentFormModal.tsx:213 — This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control desktop/src/components/common/AgentFormModal.tsx:237 — This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control desktop/src/components/common/AgentFormModal.tsx:249 — This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control desktop/src/components/common/AgentFormModal.tsx:262 — This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control desktop/src/components/common/AgentFormModal.tsx:285 — This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control desktop/src/components/common/AgentFormModal.tsx:344 — This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control desktop/src/components/common/Dropdown.tsx:72 — This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control desktop/src/components/common/MultiSelect.tsx:93 — This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control desktop/src/components/common/ToolSelector.tsx:163 — This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
AC2 · Forms & labels · <input> without a programmatic label · ×13
  • <input> without a programmatic label desktop/public/brain-hub-demo.html:408 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label desktop/public/brain-hub-demo.html:409 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label desktop/src/components/common/AgentFormModal.tsx:214 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label desktop/src/components/common/AgentFormModal.tsx:238 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label desktop/src/components/common/AskUserQuestion.tsx:154 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label desktop/src/components/common/Dropdown.tsx:117 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label desktop/src/components/common/FileEditorCore.tsx:644 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label REDACTED:1068 — This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
  • <input> without a programmatic label desktop/src/components/common/MultiSelect.tsx:152 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label desktop/src/components/common/SearchBar.tsx:21 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label desktop/src/components/layout/ArtifactsOverlay.tsx:378 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label desktop/src/components/layout/BrainHub.tsx:383 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label desktop/src/components/layout/BrainMapView.tsx:423 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
AC2 · Forms & labels · <textarea> without a programmatic label · ×6
  • <textarea> without a programmatic label desktop/src/components/awsAccount/ConnectAccount.tsx:958 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <textarea> without a programmatic label desktop/src/components/common/AgentFormModal.tsx:250 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <textarea> without a programmatic label desktop/src/components/common/CommentPopover.tsx:167 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <textarea> without a programmatic label desktop/src/components/common/FileEditorCore.tsx:392 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <textarea> without a programmatic label desktop/src/components/common/FileEditorCore.tsx:2123 — This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
  • <textarea> without a programmatic label desktop/src/components/layout/BrainLearnedView.tsx:272 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
AC2 · Forms & labels · <button> with no accessible text · ×5
  • <button> with no accessible text desktop/src/components/common/AgentFormModal.tsx:265 — A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
  • <button> with no accessible text desktop/src/components/common/AgentFormModal.tsx:288 — A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
  • <button> with no accessible text desktop/src/components/common/AgentFormModal.tsx:351 — A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
  • <button> with no accessible text desktop/src/components/common/ToolSelector.tsx:195 — A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
  • <button> with no accessible text desktop/src/components/common/ToolSelector.tsx:243 — A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
AC4 · Keyboard semantics · Click handler on a non-interactive <span> · ×4
  • Click handler on a non-interactive <span> desktop/public/brain-hub-demo.html:398 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <span> desktop/public/brain-hub-demo.html:432 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <span> desktop/public/brain-hub-demo.html:433 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <span> desktop/public/brain-hub-demo.html:434 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
D28 · Secrets (history) · REDACTED · ×4
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Critical CVE · ×4
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
R9 · Circular Imports · Import cycle (2 files) · ×4
  • Import cycle (2 files) desktop/src/components/common/FileEditorCore.tsx:38 — desktop/src/components/common/FileEditorCore.tsx → desktop/src/components/common/FileEditorModal.tsx → desktop/src/components/common/FileEditorCore.tsx
  • Import cycle (2 files) desktop/src/components/settings/HiveBrains.tsx:27 — desktop/src/components/settings/HiveBrains.tsx → REDACTED → desktop/src/components/settings/HiveBrains.tsx
  • Import cycle (2 files) desktop/src/components/swarm-out/LiveDispatches.tsx:42 — desktop/src/components/swarm-out/LiveDispatches.tsx → desktop/src/components/swarm-out/RunList.tsx → desktop/src/components/swarm-out/LiveDispatches.tsx (one verified cycle inside a mutually-dependent group of 3 files)
  • Import cycle (2 files) desktop/src/components/workspace-explorer/TreeNodeRow.tsx:32 — desktop/src/components/workspace-explorer/TreeNodeRow.tsx → desktop/src/components/workspace-explorer/VirtualizedTree.tsx → desktop/src/components/workspace-explorer/TreeNodeRow.tsx
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
AC3 · Page structure · Document without a <title> · ×2
  • Document without a <title> assets/SwarmAI-Architecture-Design-Doc.html:2 — A page with no <title> gives no name in the tab, history or screen-reader page list. Add a descriptive <title> in <head>.
  • Document without a <title> assets/readme/src/one-brain.html:1 — A page with no <title> gives no name in the tab, history or screen-reader page list. Add a descriptive <title> in <head>.
D13 · REDACTED Scanning · Leaked secret · ×2
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
AC2 · Forms & labels · Custom control with no accessible name on <div> · ×1
  • Custom control with no accessible name on <div> REDACTED:237 — This <div> carries a click handler, which makes it a control, but it has no text, aria-label or labelled child (the icon-only case), so assistive tech has no name to announce for it. Note that switching it to <button type="button"> — the right fix for its keyboard operability — does not give it a name either: an icon-only button still needs one. Add visible text or an aria-label.
AC2 · Forms & labels · <select> without a programmatic label · ×1
  • <select> without a programmatic label desktop/src/components/layout/BrainHub.tsx:781 — This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC3 · Page structure · <html> without a lang · ×1
  • <html> without a lang assets/readme/src/one-brain.html:1 — The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
AC4 · Keyboard semantics · Clickable role="button" that no keyboard user can reach · ×1
  • Clickable role="button" that no keyboard user can reach desktop/src/components/common/ReviewModeGutter.tsx:124 — This <div> announces itself as a role="button" and binds a click, but nothing can put focus on it: no tabIndex={0} in any spelling, no key handler, and nothing in this file moves focus or sets aria-activedescendant. The role tells assistive tech what the control IS; it does not make the control reachable, so a keyboard user cannot operate it at all (WCAG 2.1.1). Give it tabIndex={0}="0" and an Enter/Space key handler, or make it a native <button>. If a parent widget owns the keyboard model, that parent must move focus onto the active role="button" or point aria-activedescendant at it.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Critical vulnerability · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · High vulnerability · ×1
  • REDACTED
R8 · Dependency Hygiene · Unlisted import 'playwright' · ×1
  • Unlisted import 'playwright' backend/skills/s_pptx/scripts/html2pptx.js:28 — Imported but not declared in any reachable package.json — installs work only by hoisting accident.
R9 · Circular Imports · Import cycle (3 files) · ×1
  • Import cycle (3 files) desktop/src/components/layout/ArtifactsOverlay.tsx:29 — desktop/src/components/layout/ArtifactsOverlay.tsx → desktop/src/components/layout/overlayQueries.ts → desktop/src/components/layout/overlayChunks.ts → desktop/src/components/layout/ArtifactsOverlay.tsx (one verified cycle inside a mutually-dependent group of 16 files)
Serious — 3192 finding(s)
D15 · Churn × Complexity Hotspots · Hotspot · ×263
  • Hotspot: desktop/src/pages/ChatPage.tsx desktop/src/pages/ChatPage.tsx:160 — desktop/src/pages/ChatPage.tsx changed 64 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 431 in ChatPage.ChatPage at line 160. 20 of those changes were fix/bug commits, and the other 44 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- desktop/src/pages/ChatPage.tsx`: 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: backend/core/streaming_orchestrator.py backend/core/streaming_orchestrator.py:1422 — backend/core/streaming_orchestrator.py changed 75 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 280 in StreamingOrchestrator._read_formatted_response_body at line 1422. 43 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- backend/core/streaming_orchestrator.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: backend/core/session_router.py backend/core/session_router.py:4751 — backend/core/session_router.py changed 136 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 140 in SessionRouter._run_conversation_impl at line 4751. 43 of those changes were fix/bug commits, and the other 93 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- backend/core/session_router.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: desktop/src/hooks/useChatStreamingLifecycle.ts desktop/src/hooks/useChatStreamingLifecycle.ts:2609 — desktop/src/hooks/useChatStreamingLifecycle.ts changed 52 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 310 in useChatStreamingLifecycle.useChatStreamingLifecycle.createStreamHandler at line 2609. 23 of those changes were fix/bug commits, and the other 29 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- desktop/src/hooks/useChatStreamingLifecycle.ts`: 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: backend/core/security_hooks.py backend/core/security_hooks.py:5893 — backend/core/security_hooks.py changed 123 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 66 in security_hooks._audit_tool_hit at line 5893. 44 of those changes were fix/bug commits, and the other 79 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- backend/core/security_hooks.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: REDACTED REDACTED:314 — REDACTED changed 42 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 163 in turnView.deriveTurnView at line 314. 12 of those changes were fix/bug commits, and the other 30 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: desktop/src/components/common/FileEditorCore.tsx desktop/src/components/common/FileEditorCore.tsx:688 — desktop/src/components/common/FileEditorCore.tsx changed 26 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 258 in FileEditorCore.FileEditorCore at line 688. 7 of those changes were fix/bug commits, and the other 19 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- desktop/src/components/common/FileEditorCore.tsx`: 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: backend/core/session_unit.py backend/core/session_unit.py:2420 — backend/core/session_unit.py changed 89 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 62 in SessionUnit.send at line 2420. 36 of those changes were fix/bug commits, and the other 53 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- backend/core/session_unit.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: desktop/src/pages/chat/components/TabView.tsx desktop/src/pages/chat/components/TabView.tsx:268 — desktop/src/pages/chat/components/TabView.tsx changed 37 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 133 in TabView.TabViewImpl at line 268. 11 of those changes were fix/bug commits, and the other 26 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- desktop/src/pages/chat/components/TabView.tsx`: 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: backend/main.py backend/main.py:1014 — backend/main.py changed 71 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 68 in main.lifespan at line 1014. 15 of those changes were fix/bug commits, and the other 56 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- backend/main.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: desktop/src/pages/chat/components/AssistantMessageView.tsx desktop/src/pages/chat/components/AssistantMessageView.tsx:226 — desktop/src/pages/chat/components/AssistantMessageView.tsx changed 55 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 87 in AssistantMessageView.AssistantMessageView at line 226. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- desktop/src/pages/chat/components/AssistantMessageView.tsx`: 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: backend/core/run_protocol/engine.py backend/core/run_protocol/engine.py:2422 — backend/core/run_protocol/engine.py changed 102 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 42 in RunEngine.stage_complete at line 2422. 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- backend/core/run_protocol/engine.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: backend/scripts/artifact_cli.py backend/scripts/artifact_cli.py:178 — backend/scripts/artifact_cli.py changed 184 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in artifact_cli.cmd_release_gate at line 178. 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- backend/scripts/artifact_cli.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: REDACTED REDACTED:2306 — REDACTED changed 69 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 56 in PromptBuilder.build_options at line 2306. 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: backend/core/swarm_out_results.py backend/core/swarm_out_results.py:308 — backend/core/swarm_out_results.py changed 27 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 139 in swarm_out_results.summarize at line 308. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- backend/core/swarm_out_results.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: backend/core/run_protocol/audit.py backend/core/run_protocol/audit.py:781 — backend/core/run_protocol/audit.py changed 43 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 85 in audit.render at line 781. 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- backend/core/run_protocol/audit.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: backend/channels/gateway.py backend/channels/gateway.py:1676 — backend/channels/gateway.py changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 174 in ChannelGateway._handle_conversation at line 1676. 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- backend/channels/gateway.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: backend/scripts/eval_runner.py backend/scripts/eval_runner.py:2612 — backend/scripts/eval_runner.py changed 35 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 88 in eval_runner.generate_html_report at line 2612. 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- backend/scripts/eval_runner.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: desktop/src/pages/chat/components/ChatInput.tsx desktop/src/pages/chat/components/ChatInput.tsx:173 — desktop/src/pages/chat/components/ChatInput.tsx changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 159 in ChatInput.ChatInput at line 173. 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- desktop/src/pages/chat/components/ChatInput.tsx`: 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: desktop/src/components/file-viewer/FileViewer.tsx desktop/src/components/file-viewer/FileViewer.tsx:156 — desktop/src/components/file-viewer/FileViewer.tsx changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 133 in FileViewer.FileViewerImpl at line 156. 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- desktop/src/components/file-viewer/FileViewer.tsx`: 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: backend/core/runtime_hooks.py backend/core/runtime_hooks.py:917 — backend/core/runtime_hooks.py changed 64 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 40 in runtime_hooks._prompt_reads at line 917. 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- backend/core/runtime_hooks.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: backend/core/run_protocol/lifecycle.py backend/core/run_protocol/lifecycle.py:751 — backend/core/run_protocol/lifecycle.py changed 34 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 73 in lifecycle._apply at line 751. 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- backend/core/run_protocol/lifecycle.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: desktop/src/pages/chat/components/TurnZones.tsx desktop/src/pages/chat/components/TurnZones.tsx:513 — desktop/src/pages/chat/components/TurnZones.tsx changed 42 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 58 in TurnZones.AgentRow at line 513. 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- desktop/src/pages/chat/components/TurnZones.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: REDACTED REDACTED:151 — REDACTED changed 36 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 66 in executor.execute_job at line 151. 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: backend/database/sqlite.py backend/database/sqlite.py:2888 — backend/database/sqlite.py changed 40 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 59 in SQLiteDatabase._run_versioned_migrations at line 2888. 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- backend/database/sqlite.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • + 238 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×97
  • FileTooLong: core/security_hooks.py backend/core/security_hooks.py — FileTooLong — 4297 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3797 over it, 8.59× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: run_protocol/engine.py backend/core/run_protocol/engine.py — FileTooLong — 3419 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2919 over it, 6.84× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: core/session_router.py backend/core/session_router.py — FileTooLong — 3292 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2792 over it, 6.58× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: core/session_unit.py backend/core/session_unit.py — FileTooLong — 2608 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2108 over it, 5.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: hooks/useChatStreamingLifecycle.ts desktop/src/hooks/useChatStreamingLifecycle.ts — FileTooLong — 2409 significant lines (blank, comment-only and punctuation-only lines excluded), about 82% of them inside a single declaration: pushedStateRef (1079-5033). The bar is 500 significant lines; this is 1909 over it, 4.82× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: database/sqlite.py backend/database/sqlite.py — FileTooLong — 2344 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1844 over it, 4.69× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: scripts/eval_runner.py backend/scripts/eval_runner.py — FileTooLong — 1945 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1445 over it, 3.89× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: core/streaming_orchestrator.py backend/core/streaming_orchestrator.py — FileTooLong — 1875 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1375 over it, 3.75× 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: pages/ChatPage.tsx desktop/src/pages/ChatPage.tsx — FileTooLong — 1857 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1357 over it, 3.71× 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: channels/gateway.py backend/channels/gateway.py — FileTooLong — 1677 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1177 over it, 3.35× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: common/FileEditorCore.tsx desktop/src/components/common/FileEditorCore.tsx — FileTooLong — 1630 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1130 over it, 3.26× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/lib.rs desktop/src-tauri/src/lib.rs — FileTooLong — 1628 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 57 free functions. The bar is 500 significant lines; this is 1128 over it, 3.26× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: core/swarm_out.py backend/core/swarm_out.py — FileTooLong — 1605 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1105 over it, 3.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: core/run_worktree.py backend/core/run_worktree.py — FileTooLong — 1512 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1012 over it, 3.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: code_intel/parser.py backend/core/code_intel/parser.py — FileTooLong — 1366 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 866 over it, 2.73× 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: hive/provisioner.py backend/hive/provisioner.py — FileTooLong — 1347 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 847 over it, 2.69× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: backend/main.py backend/main.py — FileTooLong — 1287 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 787 over it, 2.57× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 1274 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 774 over it, 2.55× 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: scripts/ai_ready_helpers.py backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py — FileTooLong — 1270 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 770 over it, 2.54× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 1221 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 721 over it, 2.44× 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: routers/workspace_api.py backend/routers/workspace_api.py — FileTooLong — 1190 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 690 over it, 2.38× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 1187 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 687 over it, 2.37× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: core/swarm_workspace_manager.py backend/core/swarm_workspace_manager.py — FileTooLong — 1178 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 678 over it, 2.36× 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: code_intel/graph_store.py backend/core/code_intel/graph_store.py — FileTooLong — 1106 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 606 over it, 2.21× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: core/lifecycle_manager.py backend/core/lifecycle_manager.py — FileTooLong — 1101 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 601 over it, 2.20× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • + 72 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×89
  • FunctionTooLong: ChatInput.ChatInput desktop/src/pages/chat/components/ChatInput.tsx:173 — FunctionTooLong — ChatInput runs 649 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 549 over it, 6.49× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: useChatStreamingLifecycle.useChatStreamingLifecycle.createStreamHandler desktop/src/hooks/useChatStreamingLifecycle.ts:2609 — FunctionTooLong — useChatStreamingLifecycle.createStreamHandler runs 615 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 515 over it, 6.15× 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: SkillsPage.GenerateSkillForm desktop/src/pages/SkillsPage.tsx:328 — FunctionTooLong — GenerateSkillForm 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.
  • FunctionTooLong: html2pptx.extractSlideData backend/skills/s_pptx/scripts/html2pptx.js:244 — FunctionTooLong — extractSlideData 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.
  • FunctionTooLong: AuthConfigPanel.AuthConfigPanel desktop/src/components/settings/AuthConfigPanel.tsx:25 — FunctionTooLong — AuthConfigPanel runs 391 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 291 over it, 3.91× 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: browser-agent.main backend/skills/s_browser-agent/browser-agent.mjs:393 — FunctionTooLong — main runs 339 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 239 over it, 3.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: BackendStartupOverlay.BackendStartupOverlay desktop/src/components/common/BackendStartupOverlay.tsx:243 — FunctionTooLong — BackendStartupOverlay runs 330 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 230 over it, 3.30× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: AgentFormModal.AgentFormModal desktop/src/components/common/AgentFormModal.tsx:36 — FunctionTooLong — AgentFormModal runs 327 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 227 over it, 3.27× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: useUnifiedTabState.useUnifiedTabState desktop/src/hooks/useUnifiedTabState.ts:523 — FunctionTooLong — useUnifiedTabState runs 318 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 218 over it, 3.18× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: LibraryPanel.LibraryPanel backend/apps/pptx-maker/package/upstream/kirocrew/website/src/apps/pptx-maker/LibraryPanel.tsx:98 — FunctionTooLong — LibraryPanel runs 301 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 201 over it, 3.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: TreeNodeRow.TreeNodeRow desktop/src/components/workspace-explorer/TreeNodeRow.tsx:190 — FunctionTooLong — TreeNodeRow runs 285 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 185 over it, 2.85× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: FileContextMenu.FileContextMenu desktop/src/components/workspace-explorer/FileContextMenu.tsx:61 — FunctionTooLong — FileContextMenu runs 280 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 180 over it, 2.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.
  • FunctionTooLong: CsvRenderer.CsvRenderer desktop/src/components/file-viewer/renderers/CsvRenderer.tsx:49 — FunctionTooLong — CsvRenderer runs 243 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 143 over it, 2.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.
  • FunctionTooLong: FolderPickerModal.FolderPickerModal desktop/src/components/workspace/FolderPickerModal.tsx:22 — FunctionTooLong — FolderPickerModal runs 228 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 128 over it, 2.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.
  • FunctionTooLong: PdfRenderer.PdfRenderer desktop/src/components/file-viewer/renderers/PdfRenderer.tsx:45 — FunctionTooLong — PdfRenderer runs 226 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 126 over it, 2.26× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: RunOverlay.RunOverlay desktop/src/components/swarm-out/RunOverlay.tsx:653 — FunctionTooLong — RunOverlay runs 222 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 122 over it, 2.22× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: AwsAccountTab.AwsAccountTab desktop/src/components/settings/AwsAccountTab.tsx:41 — FunctionTooLong — AwsAccountTab 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: VirtualizedTree.VirtualizedTree desktop/src/components/workspace-explorer/VirtualizedTree.tsx:697 — FunctionTooLong — VirtualizedTree runs 215 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 115 over it, 2.15× 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: RunOverlay.CommandPanel desktop/src/components/swarm-out/RunOverlay.tsx:337 — FunctionTooLong — CommandPanel runs 208 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 108 over it, 2.08× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: useUnifiedAttachments.useUnifiedAttachments desktop/src/hooks/useUnifiedAttachments.ts:123 — FunctionTooLong — useUnifiedAttachments runs 206 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 106 over it, 2.06× 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: OverlayHost.OverlayHost desktop/src/components/layout/OverlayHost.tsx:69 — FunctionTooLong — OverlayHost runs 203 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 103 over it, 2.03× 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: SkillsPage.SkillsPage desktop/src/pages/SkillsPage.tsx:78 — FunctionTooLong — SkillsPage runs 202 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 102 over it, 2.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.
  • FunctionTooLong: ExplorerToolbar.ExplorerToolbar desktop/src/components/workspace-explorer/ExplorerToolbar.tsx:36 — FunctionTooLong — ExplorerToolbar runs 196 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 96 over it, 1.96× 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: PollinateOverlay.PollinateContent desktop/src/components/layout/PollinateOverlay.tsx:114 — FunctionTooLong — PollinateContent runs 193 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 93 over it, 1.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.
  • FunctionTooLong: useVoiceRecorder.useVoiceRecorder desktop/src/hooks/useVoiceRecorder.ts:48 — FunctionTooLong — useVoiceRecorder runs 192 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 92 over it, 1.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.
  • + 64 more in this group — see findings.md.
R4 · Test Coverage · No test reaches this file · ×40
  • No test reaches this file backend/skills/s_pptx/scripts/html2pptx.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file backend/skills/s_browser-agent/browser-agent.mjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file REDACTED:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file backend/skills/s_pollinate/templates/remotion/Video.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file backend/skills/s_browser-agent/wait-engine.mjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file desktop/src/components/workspace/FileBrowser.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file backend/skills/s_pollinate/templates/remotion/components/animations.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file backend/skills/s_pollinate/templates/remotion/components/AnimatedBackground.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file backend/skills/s_browser-agent/aria-perceive.mjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file backend/skills/s_pollinate/templates/remotion/Root.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file REDACTED:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file backend/skills/s_pollinate/templates/remotion/components/FlowChart.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file backend/skills/s_pollinate/templates/remotion/components/Subtitles.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file backend/skills/s_browser-agent/smoke-commands.mjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file backend/skills/s_pollinate/templates/remotion/components/Timeline.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file backend/skills/s_pollinate/templates/remotion/components/AudioWaveform.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file backend/skills/s_browser-agent/test-aria-perceive.mjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file backend/skills/s_pollinate/templates/remotion/components/MediaSection.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file scripts/generate-update-manifest.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file backend/skills/s_pollinate/templates/remotion/components/ChapterProgressBar.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file desktop/src/services/logForwarder.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file backend/skills/s_pollinate/templates/remotion/Thumbnail.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file backend/skills/s_pollinate/templates/remotion/components/LottieAnimation.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • + 15 more in this group — see findings.md.
X3 · Exception handling · Swallowed exception (empty catch) · ×39
  • Swallowed exception (empty catch) desktop/src/App.tsx:116 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) desktop/src/App.tsx:206 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) desktop/src/stores/MessageStore.ts:1263 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) desktop/src/stores/MessageStore.ts:1275 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) desktop/src/stores/MessageStore.ts:1308 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) desktop/src/stores/terminalLocation.ts:57 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) desktop/src/stores/terminalLocation.ts:168 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) desktop/src/stores/terminalLocation.ts:218 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) desktop/src/services/chat.ts:348 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) desktop/src/services/chat.ts:350 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) desktop/src/services/chat.ts:402 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) desktop/src/services/chat.ts:493 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) desktop/src/services/chat.ts:550 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) desktop/src/services/logForwarder.ts:54 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) desktop/src/services/logForwarder.ts:73 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) desktop/src/services/sessionEvents.ts:166 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) desktop/src/services/skills.ts:159 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) desktop/src/services/system.ts:420 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) desktop/src/pages/ChatPage.tsx:430 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) desktop/src/pages/ChatPage.tsx:885 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) desktop/src/pages/ChatPage.tsx:1443 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) desktop/src/pages/ChatPage.tsx:2088 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) desktop/src/pages/OnboardingPage.tsx:115 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) desktop/src/pages/OnboardingPage.tsx:150 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) desktop/src/pages/OnboardingPage.tsx:402 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • + 14 more in this group — see findings.md.
D17 · Explicit Debt · TodoComment · ×24
  • TodoComment desktop/src/types/index.ts:1831 — // ============== Todo Types (canonical Todo entity) ============== — 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 desktop/src/types/todo.ts:50 — // ToDo flow-closure fields (run_5088b841, A2) — mirror A1's 7 backend columns. — 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 desktop/src/services/todos.ts:171 — // ── ToDo flow-closure (A2) ────────────────────────────────────────── — 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 desktop/src/pages/ChatPage.tsx:74 — // ToDo / Jobs & Runs / Pipeline / Pollinate + NewBrain overlays retired (M3+M4): — 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 desktop/src/pages/ChatPage.tsx:1299 — // ToDo Dispatch ①→② (A2, run_5088b841). APPEND-ONLY record of dispatches whose — 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 desktop/src/pages/ChatPage.tsx:2118 — // ToDo Dispatch backfill: this tab's session just materialized (active path). — 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 desktop/src/pages/chat/constants.ts:24 — // ToDo Radar sidebar constants — 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 desktop/src/components/layout/ThreeColumnLayout.tsx:600 — // ToDo — a checklist: a card with a check mark (queued work you own). — 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 desktop/src/components/layout/overlayHostE2E.test.tsx:153 — // ToDo gone, Jobs shown — exactly one surface open — 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 backend/tests/test_property_enum_validation.py:16 — # --- ToDo enums --- — 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 backend/tests/test_run2_type_wiring.py:137 — # VALID_TYPES guard as the honor, or "[TODO] ..." loses content. — 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 backend/tests/test_todos_router.py:370 — # ToDo Flow-Closure — History, Stats, Review (run_d28de5fd) — 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 backend/tests/test_todos_router.py:485 — # ToDo Flow-Closure — Dispatch + Retreat (run_5088b841, A2) — 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 backend/scripts/migrate_followups_to_todos.py:71 — # ToDo). A model's "release" stands only when the text says so in these words: a model — 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 backend/schemas/todo.py:144 — # ToDo flow-closure fields (run_d28de5fd) — review dimension is ORTHOGONAL to status. — 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 backend/routers/todos.py:76 — # ── ToDo flow-closure History (run_d28de5fd) ──────────────────────────────── — 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 backend/routers/todos.py:433 — # ── ToDo Attachments (run_162b8817) ────────────────────────────────── — 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 REDACTED:1807 — # ── Todo Lifecycle: Expiration, Escalation, Purge ──────────────────── — 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 REDACTED:1853 — # todo still awaiting human review (review_state='completed'), even if 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 backend/jobs/models.py:82 — # path; `queries` is a commented-out TODO). Exposing member editing would be an — 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 backend/jobs/system_jobs.py:339 — # (Todo Resolution job removed run_50db230a — it auto-resolved/cancelled todos, — 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 backend/jobs/adapters/web_search.py:36 — # TODO: Implement Tavily search when API key is available — 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 backend/database/sqlite.py:3833 — # ToDo Schema Extensions (Swarm Radar ToDos — Sub-Spec 2) — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment backend/core/todo_manager.py:653 — # ToDo flow-closure fields (run_d28de5fd) — Gate-1 C: _dict_to_response is an — 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 · Duplicated block (5 lines × 2) · ×20
  • Duplicated block (5 lines × 2) backend/core/aws_account.py:628 — backend/core/aws_account.py:628-632 | backend/core/aws_account.py:681-685 — both copies are in the same file, so extract the 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) backend/core/daily_activity_writer.py:212 — backend/core/daily_activity_writer.py:212-216 | backend/core/ingestion/materializer.py:192-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.
  • Duplicated block (5 lines × 2) backend/core/run_protocol/documents.py:152 — backend/core/run_protocol/documents.py:152-156 | backend/core/run_protocol/documents.py:166-170 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/core/run_protocol/documents.py:152` it does not close everything it opens, so those exact lines 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) backend/core/run_protocol/engine.py:2944 — backend/core/run_protocol/engine.py:2944-2948 | backend/core/run_protocol/engine.py:3223-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.
  • Duplicated block (5 lines × 2) backend/core/run_protocol/engine.py:2999 — backend/core/run_protocol/engine.py:2999-3003 | backend/core/run_protocol/engine.py:3267-3271 — both copies are in the same file, so extract the 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 (5 lines × 2) backend/core/run_protocol/hook_bridge.py:437 — backend/core/run_protocol/hook_bridge.py:437-442 | backend/core/run_protocol/usage.py:87-91 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 `backend/core/run_protocol/hook_bridge.py:437` it does not close everything it opens, so those 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) backend/core/run_protocol/tree.py:71 — backend/core/run_protocol/tree.py:71-75 | backend/core/run_protocol/tree.py:109-113 — both copies are in the same file, so extract the 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) backend/routers/pipelines.py:221 — backend/routers/pipelines.py:221-226 | backend/routers/pipelines.py:663-667 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/routers/pipelines.py:221` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, 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) backend/routers/todos.py:112 — backend/routers/todos.py:112-117 | backend/routers/todos.py:128-132 — both copies are in the same file, so extract the 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) backend/scripts/ingestion_holdout_size.py:39 — backend/scripts/ingestion_holdout_size.py:39-43 | backend/scripts/ingestion_holdout_size.py:46-50 — both copies are in the same file, so extract the 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) backend/skills/s_frontend-design/scripts/design_system.py:485 — backend/skills/s_frontend-design/scripts/design_system.py:485-491 | backend/skills/s_frontend-design/scripts/design_system.py:673-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 (5 lines × 2) backend/core/voice_synthesize.py:240 — backend/core/voice_synthesize.py:240-244 | backend/skills/s_pollinate/scripts/tts/backends/polly.py:147-151 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) backend/hive/accounts.py:211 — backend/hive/accounts.py:211-215 | backend/hive/fleet.py:86-90 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 `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) backend/skills/s_docx/ooxml/scripts/validation/pptx.py:122 — backend/skills/s_docx/ooxml/scripts/validation/pptx.py:122-126 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:122-126 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/pptx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/pptx.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 298 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 `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) backend/core/main_dirty_scan.py:85 — backend/core/main_dirty_scan.py:85-89 | backend/core/swarm_out_settle.py:103-107 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (5 lines × 2) backend/core/swarm_out_results.py:421 — backend/core/swarm_out_results.py:421-425 | backend/core/swarm_out_results.py:432-436 — both copies are in the same file, so extract the 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 (5 lines × 2) backend/scripts/cdf_batch_eval.py:465 — backend/scripts/cdf_batch_eval.py:465-469 | backend/scripts/cdf_batch_eval.py:476-480 — both copies are in the same file, so extract the 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) backend/scripts/cdf_move_misrouted.py:158 — backend/scripts/cdf_move_misrouted.py:158-162 | backend/scripts/memory_relocate.py:229-233 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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) backend/scripts/da_resummarize.py:433 — backend/scripts/da_resummarize.py:433-437 | backend/scripts/da_resummarize.py:592-596 — both copies are in the same file, so extract the 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) desktop/src-tauri/src/lib.rs:1958 — desktop/src-tauri/src/lib.rs:1958-1962 | desktop/src-tauri/src/lib.rs:2007-2011 — both copies are in the same file, so extract the 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 (7 lines × 2) · ×19
  • Duplicated block (7 lines × 2) backend/core/eval_service.py:805 — backend/core/eval_service.py:805-811 | backend/core/eval_service.py:819-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.
  • Duplicated block (7 lines × 2) backend/core/ingestion/governed_edit.py:406 — backend/core/ingestion/governed_edit.py:406-412 | backend/core/ingestion/governed_edit.py:417-423 — both copies are in the same file, so extract the 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) backend/core/ingestion/materializer.py:197 — backend/core/ingestion/materializer.py:197-203 | backend/core/ingestion/writer.py:1026-1032 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (7 lines × 2) backend/core/run_protocol/documents.py:141 — backend/core/run_protocol/documents.py:141-147 | backend/core/run_protocol/review.py:666-672 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (7 lines × 2) backend/core/run_protocol/landing.py:125 — backend/core/run_protocol/landing.py:125-131 | backend/core/run_protocol/landing.py:159-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 (7 lines × 2) backend/core/run_protocol/schemas.py:300 — backend/core/run_protocol/schemas.py:300-306 | backend/core/run_protocol/schemas.py:508-514 — both copies are in the same file, so extract the 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) backend/core/security_hooks.py:2775 — backend/core/security_hooks.py:2775-2792 | backend/core/shell_segments.py:61-67 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (7 lines × 2) backend/core/swarm_out_relay.py:131 — backend/core/swarm_out_relay.py:131-137 | backend/core/swarm_out_relay.py:139-145 — both copies are in the same file, so extract the 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) backend/routers/ddd_brain.py:200 — backend/routers/ddd_brain.py:200-206 | backend/routers/ddd_brain.py:252-258 — both copies are in the same file, so extract the 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) backend/routers/hive.py:591 — backend/routers/hive.py:591-597 | backend/routers/hive.py:613-619 — both copies are in the same file, so extract the 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 (7 lines × 2) backend/routers/swarm_out.py:205 — backend/routers/swarm_out.py:205-211 | backend/routers/swarm_out.py:245-251 — both copies are in the same file, so extract the 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) backend/scripts/probe_ddd.py:30 — backend/scripts/probe_ddd.py:30-36 | backend/scripts/probe_ddd.py:72-78 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) backend/skills/s_frontend-design/scripts/design_system.py:443 — backend/skills/s_frontend-design/scripts/design_system.py:443-449 | backend/skills/s_frontend-design/scripts/design_system.py:838-844 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) backend/skills/s_pollinate/scripts/check_rpv.py:19 — backend/skills/s_pollinate/scripts/check_rpv.py:19-25 | backend/skills/s_pollinate/scripts/check_rpv.py:93-99 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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) backend/skills/s_pptx/scripts/style-extract.py:95 — backend/skills/s_pptx/scripts/style-extract.py:95-101 | backend/skills/s_pptx/scripts/style-extract.py:109-115 — both copies are in the same file, so extract the 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) backend/core/brain_knowledge.py:166 — backend/core/brain_knowledge.py:166-172 | backend/core/ingestion/health.py:218-224 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) backend/core/daemon_guard.py:82 — backend/core/daemon_guard.py:82-88 | desktop/resources/daemon/daemon_guard.py:82-88 — before extracting anything, compare `backend/core/daemon_guard.py` and `desktop/resources/daemon/daemon_guard.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/docx.py:264 — backend/skills/s_docx/ooxml/scripts/validation/docx.py:264-270 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:264-270 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/docx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/docx.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 244 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) scripts/smoke_e2e.py:354 — scripts/smoke_e2e.py:354-360 | scripts/smoke_e2e.py:363-369 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D35 · Change Coupling · Change coupling · ×17
  • Change coupling: community_api.py ↔ community.ts backend/routers/community_api.py:1 — `backend/routers/community_api.py` and `desktop/src/services/community.ts` change together 82% of the time (9 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `0cb3a94a` P7: Community overlay and Need You digests stop reading GitHub_Community; `eb4015ba` perf(nav): /community/engagement sends only each row's latest reply; …; `96b057c3` Redesign Community overlay UI (de-box all 3 tabs, one-focus-per-tab per — run `git show` on any of them.
  • Change coupling: ThreeColumnLayout.tsx ↔ useExclusiveOverlay.ts desktop/src/components/layout/ThreeColumnLayout.tsx:1 — `desktop/src/components/layout/ThreeColumnLayout.tsx` and `desktop/src/components/layout/useExclusiveOverlay.ts` change together 82% of the time (9 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) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `1e0fbcc4` Add an Artifacts entry in the left-nav under History (twin sub-entry). C; `317e077e` Community overlay redesign + nav card moves: (1) Community System→Work z; `5daa1961` Promote Capabilities from a Settings-tab entry to a first-class user-fac — run `git show` on any of them.
  • Change coupling: canvas_session.py ↔ canvasSession.ts backend/core/canvas_session.py:1 — `backend/core/canvas_session.py` and `desktop/src/services/canvasSession.ts` change together 77% of the time (10 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) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `7c5b47c5` fix(terminal): working repo from the session's transcript, not pipeli…; `63c3ee11` restore: 25 files a23fc2a00 set back to 044dd7ba2; `23ea9294` feat(canvas): Changes from the session's own transcript, not pipeline… — run `git show` on any of them.
  • Change coupling: community_data.py ↔ CommunityOverlay.tsx backend/core/community_data.py:1 — `backend/core/community_data.py` and `desktop/src/components/layout/CommunityOverlay.tsx` change together 67% of the time (8 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `0cb3a94a` P7: Community overlay and Need You digests stop reading GitHub_Community; `96b057c3` Redesign Community overlay UI (de-box all 3 tabs, one-focus-per-tab per; `fa5d7c66` fix(community): E2E-review fixes — real needs-followup, weekly-in-sig… — run `git show` on any of them.
  • Change coupling: community_data.py ↔ community.ts backend/core/community_data.py:1 — `backend/core/community_data.py` and `desktop/src/services/community.ts` change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `0cb3a94a` P7: Community overlay and Need You digests stop reading GitHub_Community; `96b057c3` Redesign Community overlay UI (de-box all 3 tabs, one-focus-per-tab per; `49c94be3` Community overlay redesign: rename tabs to Inbound/Watching/Outbound; In — run `git show` on any of them.
  • Change coupling: canvas_changes.py ↔ canvasSession.ts backend/routers/canvas_changes.py:1 — `backend/routers/canvas_changes.py` and `desktop/src/services/canvasSession.ts` change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `7c5b47c5` fix(terminal): working repo from the session's transcript, not pipeli…; `63c3ee11` restore: 25 files a23fc2a00 set back to 044dd7ba2; `23ea9294` feat(canvas): Changes from the session's own transcript, not pipeline… — run `git show` on any of them.
  • Change coupling: community_api.py ↔ CommunityOverlay.tsx backend/routers/community_api.py:1 — `backend/routers/community_api.py` and `desktop/src/components/layout/CommunityOverlay.tsx` change together 60% of the time (9 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `0cb3a94a` P7: Community overlay and Need You digests stop reading GitHub_Community; `eb4015ba` perf(nav): /community/engagement sends only each row's latest reply; …; `96b057c3` Redesign Community overlay UI (de-box all 3 tabs, one-focus-per-tab per — run `git show` on any of them.
  • Change coupling: BrainHub.tsx ↔ BrainMap.tsx desktop/src/components/layout/BrainHub.tsx:1 — `desktop/src/components/layout/BrainHub.tsx` and `desktop/src/components/layout/BrainMap.tsx` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `ef1e3703` brain: a Brain holds knowledge only; Eval asks two knowledge questions; `42af00b9` brain: remove the knowledge-proposal review from the desktop app; `2276418b` fix(brain-hub): whole-card targets, content-sized cards, search where… — run `git show` on any of them.
  • Change coupling: streaming-guards.ts ↔ useUnifiedTabState.ts desktop/src/hooks/streaming-guards.ts:1 — `desktop/src/hooks/streaming-guards.ts` and `desktop/src/hooks/useUnifiedTabState.ts` change together 57% of the time (13 of the 23 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 13 shared commits counted here, the most recent 3 are `2d790bc7` steer frontend: review fixes (state-machine + correctness, one round); `c87138c9` feat(chat): turn liveness P2c — the queue lives only in the backend; `4d81110f` feat(chat): turn liveness P2a — the bee follows the backend's session… — run `git show` on any of them.
  • Change coupling: canvas_changes.py ↔ CanvasChanges.tsx backend/routers/canvas_changes.py:1 — `backend/routers/canvas_changes.py` and `desktop/src/components/file-viewer/CanvasChanges.tsx` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `63c3ee11` restore: 25 files a23fc2a00 set back to 044dd7ba2; `23ea9294` feat(canvas): Changes from the session's own transcript, not pipeline…; `332b37b7` fix(canvas): Changes from the session's own run worktrees; parts load… — run `git show` on any of them.
  • Change coupling: ddd_brain.py ↔ ddd.ts backend/routers/ddd_brain.py:1 — `backend/routers/ddd_brain.py` and `desktop/src/services/ddd.ts` change together 54% of the time (19 of the 35 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 19 shared commits counted here, the most recent 3 are `ef1e3703` brain: a Brain holds knowledge only; Eval asks two knowledge questions; `e7d16067` feat(project-agent): the agent confirms its own Project Agent; `61fa12bf` local roots: a repository declared on this machine is read at once — run `git show` on any of them.
  • Change coupling: REDACTED ↔ system_jobs.py REDACTED:1 — `REDACTED` and `backend/jobs/system_jobs.py` change together 54% of the time (28 of the 52 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 28 shared commits counted here, the most recent 3 are `5d74fec2` feat(cdf): Health tab — is what the cognition system keeps useful, is…; `80756ca8` brain-driven step 8: monthly brain mistake audit; governance text say…; `8ef767f5` jobs: no per-job spend cap either; the ledger keeps every row — run `git show` on any of them.
  • Change coupling: swarm_out.py ↔ swarmOut.ts backend/routers/swarm_out.py:1 — `backend/routers/swarm_out.py` and `desktop/src/services/swarmOut.ts` change together 52% of the time (12 of the 23 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 12 shared commits counted here, the most recent 3 are `f98400b2` swarm-run: the first review's fixes (impl §4 A-M); `2a236132` swarm-out: landing is the judgment; protected paths need no separate …; `d9b9dc0d` swarm out: the dispatching agent may give the commands on its runs — run `git show` on any of them.
  • Change coupling: chat.py ↔ chat.ts backend/routers/chat.py:1 — `backend/routers/chat.py` and `desktop/src/services/chat.ts` change together 50% of the time (30 of the 60 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 30 shared commits counted here, the most recent 3 are `b5d96b0d` steer D7 F1: Waiting / Read / Queued-with-reason on the user bubble; `2c78abd7` chore(titus): 保全 4 摊裸露的未提交改动(清工作树以便 unified-inbox 开发); `a3f3bcec` fix(chat): history messages carry row_revs; a feed change already in … — run `git show` on any of them.
  • Change coupling: queries.py ↔ CognitiveDistillationFlow.tsx backend/core/ingestion/queries.py:1 — `backend/core/ingestion/queries.py` and `desktop/src/components/layout/CognitiveDistillationFlow.tsx` change together 50% of the time (6 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `d1b429da` Needs You: governance proposals reach a person again; removed mechani…; `d09e0afd` cdf: the backlog of the deleted paths is marked discarded_backlog, no…; `bff661f3` cdf: every session is reviewed by its own agent and model, from its r… — run `git show` on any of them.
  • Change coupling: PollinateOverlay.tsx ↔ ToDoOverlay.tsx desktop/src/components/layout/PollinateOverlay.tsx:1 — `desktop/src/components/layout/PollinateOverlay.tsx` and `desktop/src/components/layout/ToDoOverlay.tsx` 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) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `281bd525` refactor(nav): every first-load error box in the overlays is OverlayE…; `74fe513e` feat(nav): ToDo, Pipeline, Pollinate fetch through shared overlay que…; `85c227aa` M4: migrate the 4 workbench overlays to OverlayHost + fix propriocept… — run `git show` on any of them.
  • Change coupling: PipelineOverlay.tsx ↔ PollinateOverlay.tsx desktop/src/components/layout/PipelineOverlay.tsx:1 — `desktop/src/components/layout/PipelineOverlay.tsx` and `desktop/src/components/layout/PollinateOverlay.tsx` 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) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `281bd525` refactor(nav): every first-load error box in the overlays is OverlayE…; `74fe513e` feat(nav): ToDo, Pipeline, Pollinate fetch through shared overlay que…; `85c227aa` M4: migrate the 4 workbench overlays to OverlayHost + fix propriocept… — run `git show` on any of them.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×17
  • Duplicated block (6 lines × 2) backend/core/code_intel/receivers.py:491 — backend/core/code_intel/receivers.py:491-496 | backend/core/code_intel/receivers.py:526-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. The matched lines also transfer control out of the body holding them, 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, `backend/core/code_intel/receivers.py:532` calls `_text`, `_passthrough` and `backend/core/code_intel/receivers.py:497` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) backend/core/ddd_packager.py:1318 — backend/core/ddd_packager.py:1318-1323 | backend/core/ddd_packager.py:1380-1385 — both copies are in the same file, so extract the 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) backend/core/ingestion/provenance.py:181 — backend/core/ingestion/provenance.py:181-187 | backend/core/ingestion/provenance.py:189-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. The matched lines also transfer control out of the body holding them, 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) backend/core/repo_pipeline_config.py:91 — backend/core/repo_pipeline_config.py:91-96 | backend/core/repo_pipeline_config.py:110-117 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/core/repo_pipeline_config.py:110` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `rev` to `str = "HEAD"` in one and `str` 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 × 2) backend/core/run_protocol/audit.py:905 — backend/core/run_protocol/audit.py:905-911 | backend/core/run_protocol/audit.py:913-918 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/core/run_protocol/audit.py:905` it does not close everything it opens, so those exact lines 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) backend/core/run_protocol/schemas.py:245 — backend/core/run_protocol/schemas.py:245-250 | backend/core/run_protocol/schemas.py:263-268 — both copies are in the same file, so extract the 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) backend/core/security_hooks.py:269 — backend/core/security_hooks.py:269-274 | backend/core/security_hooks.py:1483-1488 — both copies are in the same file, so extract the 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) backend/core/security_hooks.py:1041 — backend/core/security_hooks.py:1041-1046 | backend/core/security_hooks.py:4889-4894 — both copies are in the same file, so extract the 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) backend/database/sqlite.py:588 — backend/database/sqlite.py:588-593 | backend/database/sqlite.py:2002-2008 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) backend/jobs/cron_utils.py:34 — backend/jobs/cron_utils.py:34-41 | backend/jobs/cron_utils.py:124-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.
  • Duplicated block (6 lines × 2) backend/scripts/verify_build.py:382 — backend/scripts/verify_build.py:382-387 | backend/scripts/verify_build.py:394-413 — both copies are in the same file, so extract the 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) backend/core/ingestion/pipeline_v2.py:152 — backend/core/ingestion/pipeline_v2.py:152-157 | backend/core/ingestion/writer.py:64-69 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (6 lines × 2) backend/routers/workspace.py:62 — backend/routers/workspace.py:62-67 | backend/routers/workspace_api.py:140-145 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (6 lines × 2) backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/paths.py:139 — backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/paths.py:139-144 | backend/jobs/handlers/ddd_refresh.py:50-55 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, 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) backend/core/run_protocol/audit.py:855 — backend/core/run_protocol/audit.py:855-860 | backend/core/run_protocol/audit.py:864-869 — both copies are in the same file, so extract the 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, `backend/core/run_protocol/audit.py:870` calls `get` and `backend/core/run_protocol/audit.py:861` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) backend/skills/s_frontend-design/scripts/design_system.py:342 — backend/skills/s_frontend-design/scripts/design_system.py:342-347 | backend/skills/s_frontend-design/scripts/design_system.py:380-385 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) scripts/security_scan.py:233 — scripts/security_scan.py:233-238 | scripts/security_scan.py:336-341 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
X1 · Async correctness · Task from `asyncio.create_task` is not kept · ×17
  • Task from `asyncio.create_task` is not kept backend/main.py:1083 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
  • Task from `asyncio.create_task` is not kept backend/main.py:1111 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
  • Task from `asyncio.create_task` is not kept backend/main.py:1189 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
  • Task from `asyncio.create_task` is not kept backend/main.py:1242 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
  • Task from `asyncio.create_task` is not kept backend/main.py:1250 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
  • Task from `asyncio.create_task` is not kept backend/main.py:1258 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
  • Task from `asyncio.create_task` is not kept backend/main.py:1273 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
  • Task from `asyncio.create_task` is not kept backend/main.py:1350 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
  • Task from `asyncio.create_task` is not kept backend/main.py:1562 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
  • Task from `asyncio.create_task` is not kept backend/main.py:1603 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
  • Task from `asyncio.create_task` is not kept backend/main.py:1610 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
  • Task from `asyncio.create_task` is not kept backend/main.py:1651 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
  • Task from `asyncio.create_task` is not kept backend/main.py:1652 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
  • Task from `asyncio.create_task` is not kept backend/core/lifecycle_manager.py:140 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
  • Task from `asyncio.create_task` is not kept REDACTED:322 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
  • Task from `asyncio.create_task` is not kept REDACTED:438 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
  • Task from `asyncio.create_task` is not kept backend/channels/gateway.py:2698 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
AC6 · Visual & motion safety · Animation without a prefers-reduced-motion guard · ×16
  • Animation without a prefers-reduced-motion guard backend/skills/s_pollinate/templates/html-report/scorecard.html:95 — `.score-bar-fill` moves (`transition: width 0.3s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard backend/skills/s_pollinate/templates/remotion/components/AudioWaveform.tsx:66 — <div> moves — its inline style sets `transition: height 0.05s ease` — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
  • Animation without a prefers-reduced-motion guard desktop/public/brain-hub-demo.html:178 — `.buildhead .spin` moves (`animation: spin 1s linear infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard desktop/src/components/awsAccount/ConnectAccount.tsx:470 — <span> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
  • Animation without a prefers-reduced-motion guard desktop/src/components/awsAccount/ConnectAccount.tsx:531 — <span> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
  • Animation without a prefers-reduced-motion guard desktop/src/components/awsAccount/ConnectAccount.tsx:570 — <span> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
  • Animation without a prefers-reduced-motion guard desktop/src/components/chat/AttachmentPreviewCard.tsx:107 — <div> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
  • Animation without a prefers-reduced-motion guard desktop/src/components/common/BackendStartupOverlay.tsx:86 — <svg> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
  • Animation without a prefers-reduced-motion guard desktop/src/components/common/Dropdown.tsx:133 — <div> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
  • Animation without a prefers-reduced-motion guard desktop/src/components/common/LoadingSpinner.tsx:16 — <div> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
  • Animation without a prefers-reduced-motion guard desktop/src/components/common/MultiSelect.tsx:167 — <div> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
  • Animation without a prefers-reduced-motion guard desktop/src/components/common/ShutdownOverlay.tsx:37 — <div> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
  • Animation without a prefers-reduced-motion guard desktop/src/components/common/SkeletonLoader.tsx:218 — <svg> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
  • Animation without a prefers-reduced-motion guard desktop/src/components/file-viewer/CanvasChanges.tsx:88 — <span> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
  • Animation without a prefers-reduced-motion guard desktop/src/components/file-viewer/FileViewer.tsx:135 — <span> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
  • Animation without a prefers-reduced-motion guard desktop/src/components/file-viewer/renderers/PdfRenderer.tsx:297 — <span> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
D30 · Dependency Vulnerabilities · Medium CVE · ×16
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
AC6 · Visual & motion safety · Focus outline removed inline · ×15
  • Focus outline removed inline desktop/src/components/common/AgentFormModal.tsx:214 — <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline desktop/src/components/common/AgentFormModal.tsx:238 — <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline desktop/src/components/common/AgentFormModal.tsx:250 — <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline desktop/src/components/common/AgentFormModal.tsx:265 — <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline desktop/src/components/common/AgentFormModal.tsx:288 — <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline desktop/src/components/common/Dropdown.tsx:117 — <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline desktop/src/components/common/FileEditorCore.tsx:644 — <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline desktop/src/components/common/FileEditorCore.tsx:2123 — <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline desktop/src/components/common/MultiSelect.tsx:152 — <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline desktop/src/components/common/SearchBar.tsx:21 — <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline desktop/src/components/layout/ArtifactsOverlay.tsx:378 — <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline desktop/src/components/layout/BrainHub.tsx:383 — <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline desktop/src/components/layout/BrainHubHome.tsx:128 — <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline desktop/src/components/layout/BrainMap.tsx:146 — <g> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline desktop/src/components/layout/CMBrainOverlay.tsx:841 — <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
D3 · God Classes · TooManyMethods · ×15
  • TooManyMethods: RunEngine backend/core/run_protocol/engine.py:447 — TooManyMethods — 142 methods. The bar is 30 methods; this is 112 over it, 4.73× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SessionUnit backend/core/session_unit.py:546 — TooManyMethods — 82 methods. The bar is 30 methods; this is 52 over it, 2.73× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SessionRouter backend/core/session_router.py:2296 — TooManyMethods — 79 methods. The bar is 30 methods; this is 49 over it, 2.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: EvalService backend/core/eval_service.py:51 — TooManyMethods — 58 methods. The bar is 30 methods; this is 28 over it, 1.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: GraphStore backend/core/code_intel/graph_store.py:361 — TooManyMethods — 48 methods. The bar is 30 methods; this is 18 over it, 1.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: LifecycleManager backend/core/lifecycle_manager.py:58 — TooManyMethods — 43 methods. The bar is 30 methods; this is 13 over it, 1.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: StreamingOrchestrator backend/core/streaming_orchestrator.py:220 — TooManyMethods — 42 methods. The bar is 30 methods; this is 12 over it, 1.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SwarmWorkspaceManager backend/core/swarm_workspace_manager.py:907 — TooManyMethods — 42 methods. The bar is 30 methods; this is 12 over it, 1.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: HiveProvisioner backend/hive/provisioner.py:326 — TooManyMethods — 41 methods. The bar is 30 methods; this is 11 over it, 1.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SlackChannelAdapter REDACTED:399 — TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: MessageStore desktop/src/stores/MessageStore.ts:66 — TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ContextHealthHook backend/hooks/context_health_hook.py:169 — TooManyMethods — 35 methods. The bar is 30 methods; this is 5 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SQLiteDatabase backend/database/sqlite.py:2240 — TooManyMethods — 33 methods. The bar is 30 methods; this is 3 over it, 1.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ChannelGateway backend/channels/gateway.py:231 — TooManyMethods — 32 methods. The bar is 30 methods; this is 2 over it, 1.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: PermissionManager backend/core/permission_manager.py:58 — TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×12
  • Duplicated block (9 lines × 2) backend/channels/gateway.py:521 — backend/channels/gateway.py:521-530 | backend/channels/gateway.py:614-622 — both copies are in the same file, so extract the 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) backend/core/code_intel/graph_store.py:661 — backend/core/code_intel/graph_store.py:661-669 | backend/core/code_intel/graph_store.py:796-804 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) backend/core/code_intel/graph_store.py:655 — backend/core/code_intel/graph_store.py:655-663 | backend/core/code_intel/graph_store.py:698-706 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/core/code_intel/graph_store.py: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 (9 lines × 2) backend/database/sqlite.py:612 — backend/database/sqlite.py:612-620 | backend/database/sqlite.py:2031-2039 — both copies are in the same file, so extract the 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 (9 lines × 2) backend/database/sqlite.py:1793 — backend/database/sqlite.py:1793-1801 | backend/database/sqlite.py:1825-1833 — both copies are in the same file, so extract the 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 (9 lines × 2) backend/hive/provisioner.py:920 — backend/hive/provisioner.py:920-931 | backend/hive/provisioner.py:1914-1922 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/hive/provisioner.py:920` it begins part-way through the construct above it, so those exact lines 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) REDACTED:343 — REDACTED:343-351 | REDACTED:400-408 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:343` it begins part-way through the construct above it, so those exact lines 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) backend/jobs/scheduler.py:604 — backend/jobs/scheduler.py:604-612 | backend/jobs/scheduler.py:622-630 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `backend/jobs/scheduler.py:619` calls `set` and `backend/jobs/scheduler.py: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 (9 lines × 2) backend/routers/pollinate.py:508 — backend/routers/pollinate.py:508-516 | backend/routers/pollinate.py:679-687 — both copies are in the same file, so extract the 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) backend/scripts/cdf_move_misrouted.py:203 — backend/scripts/cdf_move_misrouted.py:203-211 | backend/scripts/memory_relocate.py:273-281 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (9 lines × 2) backend/scripts/scenario_runner.py:95 — backend/scripts/scenario_runner.py:95-103 | backend/scripts/scenario_runner.py:148-156 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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, `backend/scripts/scenario_runner.py:146` calls `get`, `isinstance` and `backend/scripts/scenario_runner.py:94` 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) backend/skills/s_docx/ooxml/scripts/validation/base.py:816 — backend/skills/s_docx/ooxml/scripts/validation/base.py:816-824 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:819-827 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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 `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.
D30 · Dependency Vulnerabilities · Medium advisory (unmaintained) · ×10
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
X17 · Uncapped recursion over a caller-supplied document · Recursive walk over a caller-supplied document has no depth cap · ×10
  • Recursive walk over a caller-supplied document has no depth cap desktop/src/services/ingestion.ts:252 — `mapIngestionValue` is exported and takes `value: unknown` from its caller, and it calls itself at line 252 (`mapIngestionValue`) with a piece of `value` (and at line 255) — and nowhere in `mapIngestionValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `mapIngestionValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap desktop/src/services/workspace.ts:168 — `treeNodeToCamelCase` is exported and takes `data: Record<string, unknown>` from its caller, and it calls itself at line 168 (`treeNodeToCamelCase`) with a piece of `data` — and nowhere in `treeNodeToCamelCase` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `treeNodeToCamelCase` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap desktop/src/components/workspace-explorer/toFileTreeItem.ts:29 — `toFileTreeItem` is exported and takes `node: TreeNode` from its caller, and it calls itself at line 29 (`toFileTreeItem`) with a piece of `node` — and nowhere in `toFileTreeItem` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `toFileTreeItem` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap backend/jobs/bedrock.py:552 — `structured` is public, takes a document from its caller (line 675) and hands it to `_check_schema`, which calls itself at line 552 (`_check_schema`) with a piece of `schema` (and at line 554) — and nowhere in `_check_schema` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_check_schema` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap backend/jobs/bedrock.py:640 — `structured` is public, takes a document from its caller (line 675) and hands it to `_validate`, which calls itself at line 640 (`_validate`) with a piece of `value` (and at line 643) — and nowhere in `_validate` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_validate` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap backend/core/app_manifest.py:173 — `canonical_json` is public, takes a document from its caller (line 184) and hands it to `_canonical`, which calls itself at line 173 (`_canonical`) with a piece of `value` — and nowhere in `_canonical` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_canonical` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap backend/core/output_degeneration.py:270 — `strip_degenerate_in_value` is public and takes `value: Any` from its caller, and it calls itself at line 270 (`strip_degenerate_in_value`) with a piece of `value` (and at line 275) — and nowhere in `strip_degenerate_in_value` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `strip_degenerate_in_value` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap backend/core/session_inputs.py:82 — `record_tool_result` is public, takes a document from its caller (line 89) and hands it to `_measured_fields`, which calls itself at line 82 (`_measured_fields`) with a piece of `value` — and nowhere in `_measured_fields` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_measured_fields` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap backend/core/run_protocol/events.py:480 — `externalize_payload` is public, takes a document from its caller (line 490) and hands it to `_externalize`, which calls itself at line 480 (`_externalize`) with a piece of `value` (and at line 484) — and nowhere in `_externalize` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_externalize` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap backend/core/run_protocol/run_knowledge.py:197 — `requirements_text` is public, takes a document from its caller (line 173) and hands it to `walk`, which calls itself at line 197 (`walk`) with a piece of `v` (and at line 200) — and nowhere in `walk` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `walk` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×9
  • Duplicated block (11 lines × 2) backend/core/ingestion/units.py:140 — backend/core/ingestion/units.py:140-150 | backend/core/ingestion/units.py:159-169 — both copies are in the same file, so extract the 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) backend/core/knowledge_graph.py:213 — backend/core/knowledge_graph.py:213-223 | backend/core/knowledge_graph.py:235-245 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) backend/core/security_hooks.py:1561 — backend/core/security_hooks.py:1561-1571 | backend/core/security_hooks.py:3014-3024 — both copies are in the same file, so extract the 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) backend/database/sqlite.py:1072 — backend/database/sqlite.py:1072-1082 | backend/database/sqlite.py:1097-1107 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/database/sqlite.py:1072` it does not close everything it opens, so those exact lines 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) backend/hive/provisioner.py:1296 — backend/hive/provisioner.py:1296-1306 | backend/hive/provisioner.py:1345-1355 — both copies are in the same file, so extract the 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) REDACTED:412 — REDACTED:412-422 | REDACTED:433-444 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:412` it begins part-way through the construct above it, so those exact lines 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) backend/scripts/scenario_runner.py:85 — backend/scripts/scenario_runner.py:85-95 | backend/scripts/scenario_runner.py:135-145 — both copies are in the same file, so extract the 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, `backend/scripts/scenario_runner.py:146` calls `get`, `isinstance` and `backend/scripts/scenario_runner.py:96` 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) backend/skills/s_pollinate/scripts/cross_format_check.py:137 — backend/skills/s_pollinate/scripts/cross_format_check.py:137-147 | backend/skills/s_pollinate/scripts/cross_format_check.py:212-222 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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) backend/core/daemon_guard.py:414 — backend/core/daemon_guard.py:414-424 | desktop/resources/daemon/daemon_guard.py:414-424 — before extracting anything, compare `backend/core/daemon_guard.py` and `desktop/resources/daemon/daemon_guard.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×9
  • Duplicated block (8 lines × 2) backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/library.py:393 — backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/library.py:393-400 | backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/library.py:637-644 — both copies are in the same file, so extract the 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) backend/channels/gateway.py:943 — backend/channels/gateway.py:943-950 | backend/channels/gateway.py:1005-1016 — both copies are in the same file, so extract the 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) backend/core/ingestion/governed_edit.py:389 — backend/core/ingestion/governed_edit.py:389-396 | backend/core/ingestion/governed_edit.py:408-415 — both copies are in the same file, so extract the 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) backend/core/run_protocol/cli_commands.py:218 — backend/core/run_protocol/cli_commands.py:218-225 | backend/core/run_protocol/cli_commands.py:227-234 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `backend/core/run_protocol/cli_commands.py:215` calls `add_parser`, `add_argument` and `backend/core/run_protocol/cli_commands.py:225` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) backend/core/run_protocol/engine.py:1625 — backend/core/run_protocol/engine.py:1625-1632 | backend/core/run_protocol/engine.py:1732-1739 — both copies are in the same file, so extract the 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) backend/hive/provisioner.py:1682 — backend/hive/provisioner.py:1682-1689 | backend/hive/provisioner.py:1834-1841 — both copies are in the same file, so extract the 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) backend/core/voice_synthesize.py:266 — backend/core/voice_synthesize.py:266-280 | backend/skills/s_pollinate/scripts/tts/backends/polly.py:155-162 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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) backend/core/aws_detect.py:192 — backend/core/aws_detect.py:192-199 | backend/scripts/mutation_check.py:94-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.
  • Duplicated block (8 lines × 2) desktop/src-tauri/src/lib.rs:2813 — desktop/src-tauri/src/lib.rs:2813-2820 | desktop/src-tauri/src/lib.rs:2908-2915 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D29 · Static Analysis (SAST) · REDACTED · ×8
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×8
  • Duplicated block (12 lines × 2) backend/core/daemon_guard.py:134 — backend/core/daemon_guard.py:134-145 | desktop/resources/daemon/daemon_guard.py:134-145 — before extracting anything, compare `backend/core/daemon_guard.py` and `desktop/resources/daemon/daemon_guard.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) backend/core/ingestion/governed_edit.py:832 — backend/core/ingestion/governed_edit.py:832-843 | backend/core/ingestion/governed_edit.py:860-873 — both copies are in the same file, so extract the 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) backend/core/mcp_config_loader.py:688 — backend/core/mcp_config_loader.py:688-699 | backend/core/mcp_config_loader.py:726-737 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/core/mcp_config_loader.py:688` it does not close everything it opens, so those exact lines 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) backend/hive/provisioner.py:393 — backend/hive/provisioner.py:393-404 | backend/hive/provisioner.py:407-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. 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) backend/routers/workspace.py:731 — backend/routers/workspace.py:731-742 | backend/routers/workspace.py:844-855 — both copies are in the same file, so extract the 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) backend/scripts/generate_app_execution_releases.py:87 — backend/scripts/generate_app_execution_releases.py:87-98 | backend/scripts/generate_app_execution_releases.py:124-135 — both copies are in the same file, so extract the 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) backend/skills/s_frontend-design/scripts/design_system.py:961 — backend/skills/s_frontend-design/scripts/design_system.py:961-972 | backend/skills/s_frontend-design/scripts/design_system.py:974-985 — both copies are in the same file, so extract the 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) backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:446 — backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:446-457 | backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:573-584 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
AC3 · Page structure · Page without a main landmark · ×6
  • Page without a main landmark assets/SwarmAI-Architecture-Design-Doc.html:2 — No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
  • Page without a main landmark assets/readme/src/one-brain.html:1 — No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
  • Page without a main landmark backend/skills/s_pollinate/templates/html-report/comparison.html:2 — No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
  • Page without a main landmark backend/skills/s_pollinate/templates/html-report/report.html:2 — No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
  • Page without a main landmark backend/skills/s_pollinate/templates/html-report/scorecard.html:2 — No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
  • Page without a main landmark desktop/public/brain-hub-demo.html:2 — No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
D15 · Churn × Complexity Hotspots · Repeated repair · ×6
  • Repeated repair: desktop/src/hooks/streaming-guards.ts desktop/src/hooks/streaming-guards.ts:338 — desktop/src/hooks/streaming-guards.ts changed 10 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is streaming-guards.firstSteerOfTurn at line 338), 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: “steer frontend: review fixes (state-machine + correctness, one round)”; “fix(terminal): layered roomy panel, one-click Browse, taller bottom bar; parked sends keep terminal output”; “fix(chat): one client_id per message — every send of it is the same send (P1)”; “fix(chat): CLI-initiated turns continue the previous bubble; SESSION_BUSY is never re-sent”. 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- desktop/src/hooks/streaming-guards.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: backend/core/recall_metrics.py backend/core/recall_metrics.py:55 — backend/core/recall_metrics.py changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is recall_metrics.record_recall_metric at line 55), 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 the thing”; “fix(recall-metrics): requeue a drained window when the flush write fails (no data hole)”; “fix(recall-metrics): stamp timestamp at measurement time, not flush time”; “fix(observability): clear the last 17 lying-result handlers; gate against logs that crash”. 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- backend/core/recall_metrics.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: backend/hooks/auto_commit_hook.py backend/hooks/auto_commit_hook.py:54 — backend/hooks/auto_commit_hook.py 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 11 (its worst body is auto_commit_hook._git_running_in at line 54), 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(stability): our own kills log at INFO, reaper reads owners without ps, runtime-state files are not UNCOMMITTED, git -C holds the lock”; “fix(stability): batch 3 — guards judge structure and identity, not substrings; Slack closes its dead socket”; “fix(git-safety): close the ungated auto-commit R1 door (DoD3, Option B)”. 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- backend/hooks/auto_commit_hook.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: backend/core/run_protocol/child_merge.py backend/core/run_protocol/child_merge.py:144 — backend/core/run_protocol/child_merge.py changed 4 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 child_merge.merge at line 144), 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: “swarm-run: fix the consistency audit's findings (code Swarm Run E2E, three Hive children)”; “swarm-run: the second review's fixes (impl §5 P-W)”; “swarm-run: the first review's fixes (impl §4 A-M)”. 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- backend/core/run_protocol/child_merge.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: REDACTED REDACTED:256 — REDACTED changed 4 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 6 (its worst body is CredentialValidator.check at line 256), 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: “Sign-in errors: right words per sign-in, "not connected" said as it is, a fix button for every path”; “fix(cold-start): the credential check is single-flight and shielded, so its cache fills”; “fix(stability): batch 4 — syntax guard skips the shell for plain commands; offline credential checks back off; per-hook timing”. 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: backend/channels/install_backend_daemon.py backend/channels/install_backend_daemon.py:97 — backend/channels/install_backend_daemon.py changed 4 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 12 (its worst body is install_backend_daemon._sync_bundle_staged at line 97), 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(deploy): Stage bundle swaps and isolate build probes”; “fix(deploy): Close six follow-ups from the offline dive”; “fix(daemon): Run backend at Standard priority, keep degraded alive”. 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-08..2026-11-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-08 00:24:13 +08:00' --until='2026-11-06 00:24:13 +08:00' --full-history --no-merges -- backend/channels/install_backend_daemon.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
D2 · Cognitive Complexity · swarmai · ×6
  • swarmai::spawn_daemon_health_watchdog (cognitive 99) desktop/src-tauri/src/lib.rs:2159 — swarmai::spawn_daemon_health_watchdog has cognitive complexity 99 (threshold 15). Drivers by points: if/else 26 (64 pts), match/switch 9 (26 pts), boolean chains 8, loops 1 (nesting depth added 55). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • swarmai::sync_daemon_version (cognitive 36) desktop/src-tauri/src/lib.rs:1343 — swarmai::sync_daemon_version has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 2 (6 pts), boolean chains 3, match/switch 3 (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.
  • swarmai::check_python_version (cognitive 27) desktop/src-tauri/src/lib.rs:2834 — swarmai::check_python_version has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (26 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.
  • swarmai::runtime_deploy::deploy (cognitive 23) desktop/src-tauri/src/runtime_deploy.rs:161 — swarmai::runtime_deploy::deploy has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 3, loops 2 (3 pts), match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • swarmai::get_fallback_path (cognitive 22) desktop/src-tauri/src/lib.rs:124 — swarmai::get_fallback_path has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (8 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.
  • swarmai::screen_capture::prune_old_screenshots (cognitive 18) desktop/src-tauri/src/screen_capture.rs:74 — swarmai::screen_capture::prune_old_screenshots has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 1 (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.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×6
  • Duplicated block (22 lines × 2) backend/core/context_injector.py:379 — backend/core/context_injector.py:379-400 | backend/core/context_injector.py:417-438 — both copies are in the same file, so extract the 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) backend/skills/s_docx/ooxml/scripts/pack.py:134 — backend/skills/s_docx/ooxml/scripts/pack.py:134-155 | backend/skills/s_pptx/ooxml/scripts/pack.py:134-155 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/pack.py` and `backend/skills/s_pptx/ooxml/scripts/pack.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 127 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (22 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:742 — backend/skills/s_docx/ooxml/scripts/validation/base.py:742-763 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:745-766 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (22 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:792 — backend/skills/s_docx/ooxml/scripts/validation/base.py:792-813 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:795-816 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (22 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/docx.py:193 — backend/skills/s_docx/ooxml/scripts/validation/docx.py:193-214 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:193-214 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/docx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/docx.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 244 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 `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) backend/core/daemon_guard.py:238 — backend/core/daemon_guard.py:238-259 | desktop/resources/daemon/daemon_guard.py:238-259 — before extracting anything, compare `backend/core/daemon_guard.py` and `desktop/resources/daemon/daemon_guard.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 236 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 (13 lines × 2) · ×6
  • Duplicated block (13 lines × 2) backend/core/pipeline_human.py:83 — backend/core/pipeline_human.py:83-95 | backend/core/run_owner_gate.py:220-232 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (13 lines × 2) backend/database/sqlite.py:623 — backend/database/sqlite.py:623-635 | backend/database/sqlite.py:1293-1305 — both copies are in the same file, so extract the 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 (13 lines × 2) backend/hooks/context_health_hook.py:1546 — backend/hooks/context_health_hook.py:1546-1559 | backend/hooks/context_health_hook.py:1561-1573 — both copies are in the same file, so extract the 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) backend/routers/channels.py:313 — backend/routers/channels.py:313-325 | backend/routers/channels.py:363-375 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/routers/channels.py:313` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) backend/routers/hive_brains.py:254 — backend/routers/hive_brains.py:254-266 | backend/routers/hive_brains.py:303-315 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) backend/routers/workspace_api.py:1523 — backend/routers/workspace_api.py:1523-1538 | backend/routers/workspace_api.py:1566-1578 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
X24 · Document value interpolated into markup unescaped · Untrusted text written into markup unescaped · ×6
  • Untrusted text written into markup unescaped desktop/src/components/common/FileEditorCore.tsx:1274 — `highlighted+'\n'` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped REDACTED:124 — `svg` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped REDACTED:245 — `scaledSvg` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped REDACTED:386 — `svg` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped REDACTED:538 — `svg` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped REDACTED:115 — `html` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×5
  • Duplicated block (15 lines × 2) backend/core/code_intel/route_parser.py:165 — backend/core/code_intel/route_parser.py:165-179 | backend/core/code_intel/route_parser.py:220-234 — both copies are in the same file, so extract the 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) backend/core/security_hooks.py:4387 — backend/core/security_hooks.py:4387-4401 | backend/core/security_hooks.py:5159-5173 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/core/security_hooks.py:5159` 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) backend/skills/s_docx/ooxml/scripts/validation/base.py:107 — backend/skills/s_docx/ooxml/scripts/validation/base.py:107-121 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:107-121 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) backend/routers/artifacts.py:75 — backend/routers/artifacts.py:75-89 | backend/routers/workspace_api.py:162-176 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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) desktop/src-tauri/src/lib.rs:317 — desktop/src-tauri/src/lib.rs:317-331 | desktop/src-tauri/src/lib.rs:348-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.
X2 · Cancellation propagation · Async function without AbortSignal · ×5
  • Async function without AbortSignal: flush desktop/src/services/logForwarder.ts:59 — `flush` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: synthesizeSpeech desktop/src/services/voice.ts:25 — `synthesizeSpeech` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: getVoices desktop/src/services/voice.ts:54 — `getVoices` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: fetchArtifactText backend/apps/pptx-maker/package/upstream/kirocrew/website/src/apps/pptx-maker/api.ts:169 — `fetchArtifactText` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: fetchArtifactJson backend/apps/pptx-maker/package/upstream/kirocrew/website/src/apps/pptx-maker/api.ts:176 — `fetchArtifactJson` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
AC6 · Visual & motion safety · Low contrast colour pair in CSS (3.2 · ×4
  • Low contrast colour pair in CSS (3.2:1) desktop/public/brain-hub-demo.html:23 — `.navbtn.active` sets color: #f0a500 on background-color: #7a5600 — 3.2:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
  • Low contrast colour pair in CSS (3.2:1) desktop/public/brain-hub-demo.html:47 — `.btn.primary` sets color: #f0a500 on background-color: #7a5600 — 3.2:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
  • Low contrast colour pair in CSS (3.2:1) desktop/public/brain-hub-demo.html:148 — `.stepdot.active .n` sets color: #f0a500 on background-color: #7a5600 — 3.2:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
  • Low contrast colour pair in CSS (3.2:1) desktop/public/brain-hub-demo.html:160 — `.kindopt.sel` sets color: #f0a500 on background-color: #7a5600 — 3.2:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
D29 · Static Analysis (SAST) · REDACTED · ×4
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (35 lines × 2) · ×4
  • Duplicated block (35 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:870 — backend/skills/s_docx/ooxml/scripts/validation/base.py:870-904 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:873-907 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (35 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/docx.py:125 — backend/skills/s_docx/ooxml/scripts/validation/docx.py:125-159 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:125-159 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/docx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/docx.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 244 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 `backend/skills/s_docx/ooxml/scripts/validation/docx.py:125` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, 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 (35 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/pptx.py:78 — backend/skills/s_docx/ooxml/scripts/validation/pptx.py:78-112 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:78-112 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/pptx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/pptx.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 298 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 (35 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/redlining.py:218 — backend/skills/s_docx/ooxml/scripts/validation/redlining.py:218-252 | backend/skills/s_pptx/ooxml/scripts/validation/redlining.py:218-252 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/redlining.py` and `backend/skills/s_pptx/ooxml/scripts/validation/redlining.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 245 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 (17 lines × 2) · ×4
  • Duplicated block (17 lines × 2) backend/core/ddd_job_registry.py:214 — backend/core/ddd_job_registry.py:214-230 | backend/core/ddd_skill_registry.py:279-295 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (17 lines × 2) backend/database/sqlite.py:3633 — backend/database/sqlite.py:3633-3649 | backend/database/sqlite.py:3670-3686 — both copies are in the same file, so extract the 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) backend/skills/s_docx/ooxml/scripts/validation/docx.py:174 — backend/skills/s_docx/ooxml/scripts/validation/docx.py:174-190 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:174-190 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/docx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/docx.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 244 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) backend/skills/s_frontend-design/scripts/design_system.py:634 — backend/skills/s_frontend-design/scripts/design_system.py:634-650 | backend/skills/s_frontend-design/scripts/design_system.py:898-914 — both copies are in the same file, so extract the 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 (12–13 lines × 2) · ×4
  • Duplicated block (12–13 lines × 2) backend/core/claude_environment.py:98 — backend/core/claude_environment.py:98-110 | backend/core/claude_environment.py:121-132 — both copies are in the same file, so extract the 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 (12–13 lines × 2) backend/core/ddd_packager.py:1536 — backend/core/ddd_packager.py:1536-1548 | backend/core/ddd_packager.py:1704-1715 — both copies are in the same file, so extract the 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–13 lines × 2) backend/core/repo_guidance.py:496 — backend/core/repo_guidance.py:496-507 | backend/core/shared_checkout.py:205-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 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 (12–13 lines × 2) backend/routers/workspace_api.py:1306 — backend/routers/workspace_api.py:1306-1318 | backend/routers/workspace_api.py:1324-1335 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/routers/workspace_api.py:1306` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×4
  • Duplicated block (10 lines × 2) backend/core/plugin_manager.py:272 — backend/core/plugin_manager.py:272-281 | backend/core/plugin_manager.py:382-391 — both copies are in the same file, so extract the 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, `backend/core/plugin_manager.py:270` calls `get` and `backend/core/plugin_manager.py:380` 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 × 2) backend/schemas/auth.py:28 — backend/schemas/auth.py:28-37 | backend/schemas/auth.py:87-96 — both copies are in the same file, so extract the 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 (10 lines × 2) backend/skills/s_frontend-design/scripts/design_system.py:519 — backend/skills/s_frontend-design/scripts/design_system.py:519-528 | backend/skills/s_frontend-design/scripts/design_system.py:874-883 — both copies are in the same file, so extract the 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 (10 lines × 2) desktop/src-tauri/src/lib.rs:2797 — desktop/src-tauri/src/lib.rs:2797-2806 | desktop/src-tauri/src/lib.rs:2875-2884 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (16 lines × 2 locations) · ×4
  • Duplicated block (16 lines × 2 locations) backend/skills/s_pollinate/templates/remotion/Video.tsx:118 — backend/skills/s_pollinate/templates/remotion/Video.tsx:118 · backend/skills/s_pollinate/templates/remotion/Video.tsx:258 — all 2 copies are in the same file, and what repeats is a LIST OF ENTRIES rather than behaviour — the same entries written out more than once. Extract them into one shared, exported constant and spread that constant into each site, rather than into a function the sites call: a list like this often lives in declarative metadata (a decorator's options object, a static configuration table) that a build step must be able to read statically, where a function call is not allowed. Adding an entry to one copy and not the other is the failure this prevents.
  • Duplicated block (16 lines × 2 locations) desktop/src/components/file-viewer/FileViewer.tsx:339 — desktop/src/components/file-viewer/FileViewer.tsx:339 · desktop/src/components/file-viewer/FileViewer.tsx:382 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (16 lines × 2 locations) desktop/src/hooks/streaming-machine.ts:129 — desktop/src/hooks/streaming-machine.ts:129 · desktop/src/hooks/streaming-machine.ts:234 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (16 lines × 2 locations) desktop/src/hooks/useUnifiedAttachments.ts:173 — desktop/src/hooks/useUnifiedAttachments.ts:173 · desktop/src/hooks/useUnifiedAttachments.ts:307 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (15 lines × 2 locations) · ×4
  • Duplicated block (15 lines × 2 locations) backend/skills/s_pollinate/templates/remotion/Video.tsx:152 — backend/skills/s_pollinate/templates/remotion/Video.tsx:152 · backend/skills/s_pollinate/templates/remotion/Video.tsx:202 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (15 lines × 2 locations) desktop/src/components/layout/CMBrainOverlay.tsx:375 — desktop/src/components/layout/CMBrainOverlay.tsx:375 · desktop/src/components/layout/CMBrainOverlay.tsx:1033 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2 locations) desktop/src/hooks/streaming-machine.ts:223 — desktop/src/hooks/streaming-machine.ts:223 · desktop/src/hooks/streaming-machine.ts:243 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (15 lines × 2 locations) desktop/src/hooks/useVoiceConversation.ts:219 — desktop/src/hooks/useVoiceConversation.ts:219 · desktop/src/hooks/useVoiceConversation.ts: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.
X1 · Async correctness · Task from `asyncio.ensure_future` is not kept · ×4
  • Task from `asyncio.ensure_future` is not kept backend/core/session_router.py:3622 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
  • Task from `asyncio.ensure_future` is not kept backend/channels/streaming.py:145 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
  • Task from `asyncio.ensure_future` is not kept backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/routes.py:663 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
  • Task from `asyncio.ensure_future` is not kept backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/routes.py:895 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
AC4 · Keyboard semantics · Modal dialog does not manage focus · ×3
  • Modal dialog does not manage focus desktop/src/components/common/FileEditorCore.tsx:2227 — This <div role="alertdialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus desktop/src/components/common/FileEditorModal.tsx:230 — This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus desktop/src/components/common/Modal.tsx:141 — This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
D1 · Cyclomatic Complexity · swarmai · ×3
  • swarmai::spawn_daemon_health_watchdog (cyclomatic 40) desktop/src-tauri/src/lib.rs:2159 — swarmai::spawn_daemon_health_watchdog 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.
  • swarmai::sync_daemon_version (cyclomatic 21) desktop/src-tauri/src/lib.rs:1343 — swarmai::sync_daemon_version 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.
  • swarmai::runtime_deploy::deploy (cyclomatic 19) desktop/src-tauri/src/runtime_deploy.rs:161 — swarmai::runtime_deploy::deploy 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.
D30 · Dependency Vulnerabilities · Medium vulnerability · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×3
  • Members sharing a duplicated core (4 members, 50+ identical tokens) backend/database/sqlite.py:587 — backend/database/sqlite.py:587-609 | backend/database/sqlite.py:1776-1790 | backend/database/sqlite.py:1996-2028 | backend/database/sqlite.py:2059-2075 — 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) backend/scripts/artifact_cli.py:562 — backend/scripts/artifact_cli.py:562-584 | backend/scripts/artifact_cli.py:588-610 | backend/scripts/artifact_cli.py:614-636 | backend/scripts/artifact_cli.py:711-730 — 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) backend/skills/s_frontend-design/scripts/design_system.py:423 — backend/skills/s_frontend-design/scripts/design_system.py:423-528 | backend/skills/s_frontend-design/scripts/design_system.py:613-883 | backend/skills/s_frontend-design/scripts/design_system.py:887-992 | backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:464-561 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×3
  • Duplicated block (23 lines × 2) backend/core/daemon_guard.py:280 — backend/core/daemon_guard.py:280-302 | desktop/resources/daemon/daemon_guard.py:280-302 — before extracting anything, compare `backend/core/daemon_guard.py` and `desktop/resources/daemon/daemon_guard.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23 lines × 2) backend/skills/s_docx/ooxml/scripts/pack.py:20 — backend/skills/s_docx/ooxml/scripts/pack.py:20-42 | backend/skills/s_pptx/ooxml/scripts/pack.py:20-42 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/pack.py` and `backend/skills/s_pptx/ooxml/scripts/pack.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 127 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 (23 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/redlining.py:115 — backend/skills/s_docx/ooxml/scripts/validation/redlining.py:115-137 | backend/skills/s_pptx/ooxml/scripts/validation/redlining.py:115-137 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/redlining.py` and `backend/skills/s_pptx/ooxml/scripts/validation/redlining.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 245 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 `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 (21 lines × 2) · ×3
  • Duplicated block (21 lines × 2) backend/core/daemon_guard.py:92 — backend/core/daemon_guard.py:92-112 | desktop/resources/daemon/daemon_guard.py:92-112 — before extracting anything, compare `backend/core/daemon_guard.py` and `desktop/resources/daemon/daemon_guard.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (21 lines × 2) backend/core/search_manager.py:228 — backend/core/search_manager.py:228-248 | backend/core/search_manager.py:307-327 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/core/search_manager.py: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.
  • Duplicated block (21 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/redlining.py:255 — backend/skills/s_docx/ooxml/scripts/validation/redlining.py:255-275 | backend/skills/s_pptx/ooxml/scripts/validation/redlining.py:255-275 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/redlining.py` and `backend/skills/s_pptx/ooxml/scripts/validation/redlining.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 245 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×3
  • Duplicated block (12 lines × 3) backend/core/streaming_orchestrator.py:2788 — backend/core/streaming_orchestrator.py:2788-2799 | backend/core/streaming_orchestrator.py:2997-3008 | backend/core/streaming_orchestrator.py:3035-3046 — 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) backend/database/sqlite.py:852 — backend/database/sqlite.py:852-863 | backend/database/sqlite.py:894-905 | backend/database/sqlite.py:964-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.
  • Duplicated block (12 lines × 3) backend/routers/mcp.py:156 — backend/routers/mcp.py:156-167 | backend/routers/mcp.py:227-238 | backend/routers/mcp.py:264-275 — 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 (11 lines × 3) · ×3
  • Duplicated block (11 lines × 3) backend/core/mcp_config_loader.py:687 — backend/core/mcp_config_loader.py:687-697 | backend/core/mcp_config_loader.py:725-735 | backend/routers/mcp.py:59-69 — 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 (11 lines × 3) backend/core/security_hooks.py:3045 — backend/core/security_hooks.py:3045-3055 | backend/core/security_hooks.py:3428-3438 | backend/core/shell_segments.py:35-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.
  • Duplicated block (11 lines × 3) backend/skills/s_frontend-design/scripts/design_system.py:715 — backend/skills/s_frontend-design/scripts/design_system.py:715-725 | backend/skills/s_frontend-design/scripts/design_system.py:748-758 | backend/skills/s_frontend-design/scripts/design_system.py:808-818 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×3
  • Duplicated block (8 lines × 3) backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/routes.py:1335 — backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/routes.py:1335-1342 | backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/routes.py:1350-1357 | backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/routes.py:1402-1409 — 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 (8 lines × 3) backend/core/security_hooks.py:3761 — backend/core/security_hooks.py:3761-3768 | backend/core/security_hooks.py:4395-4402 | backend/core/security_hooks.py:5167-5174 — 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 (8 lines × 3) backend/skills/s_frontend-design/scripts/design_system.py:283 — backend/skills/s_frontend-design/scripts/design_system.py:283-290 | backend/skills/s_frontend-design/scripts/design_system.py:423-430 | backend/skills/s_frontend-design/scripts/design_system.py:613-620 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×3
  • Duplicated block (6 lines × 3) backend/core/ingestion/units.py:146 — backend/core/ingestion/units.py:146-151 | backend/core/ingestion/units.py:165-170 | backend/core/ingestion/units.py:187-192 — 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 `backend/core/ingestion/units.py:146` it does not close everything it opens, so those exact lines 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) backend/core/run_protocol/cli_commands.py:205 — backend/core/run_protocol/cli_commands.py:205-210 | backend/core/run_protocol/cli_commands.py:218-223 | backend/core/run_protocol/cli_commands.py:227-232 — 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, `backend/core/run_protocol/cli_commands.py:211` calls `add_argument` and `backend/core/run_protocol/cli_commands.py:233` 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 × 3) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1011 — backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1011-1016 | backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1018-1023 | backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1025-1030 — 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 `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1011` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
PF3 · Async & latency hygiene · Sync-over-async blocking · ×3
  • Sync-over-async blocking backend/core/plugin_manager.py:481 — `_clone_plugin_source` is async and calls subprocess.run — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs.
  • Sync-over-async blocking backend/hive/provisioner.py:902 — `_wait_healthy_via_ssm` is async and calls time.sleep — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs.
  • Sync-over-async blocking desktop/src-tauri/src/lib.rs:2652 — `stop_backend` is async and calls thread::sleep — a blocking call inside async code stalls the executor thread, and every task scheduled on it for as long as it runs.
R10 · Code Duplication · Duplicated block (18 lines × 2 locations) · ×3
  • Duplicated block (18 lines × 2 locations) desktop/src/hooks/useChatStreamingLifecycle.ts:3239 — desktop/src/hooks/useChatStreamingLifecycle.ts:3239 · desktop/src/hooks/useChatStreamingLifecycle.ts:3264 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (18 lines × 2 locations) desktop/src/services/chat.ts:998 — desktop/src/services/chat.ts:998 · desktop/src/services/chat.ts:1035 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (18 lines × 2 locations) desktop/src/services/tscc.ts:134 — desktop/src/services/tscc.ts:134 · desktop/src/services/tscc.ts:170 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
AC6 · Visual & motion safety · Low contrast colour pair in CSS (3.4 · ×2
  • Low contrast colour pair in CSS (3.4:1) desktop/public/brain-hub-demo.html:25 — `.navbtn .badge` sets color: #fff on background-color: #f85149 — 3.4:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
  • Low contrast colour pair in CSS (3.4:1) desktop/public/brain-hub-demo.html:36 — `.tab .cnt` sets color: #fff on background-color: #f85149 — 3.4:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
D1 · Cyclomatic Complexity · BaseSchemaValidator.validate_content_types (cyclomatic 25) · ×2
  • BaseSchemaValidator.validate_content_types (cyclomatic 25) backend/skills/s_docx/ooxml/scripts/validation/base.py:522 — BaseSchemaValidator.validate_content_types 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.
  • BaseSchemaValidator.validate_content_types (cyclomatic 25) backend/skills/s_pptx/ooxml/scripts/validation/base.py:525 — BaseSchemaValidator.validate_content_types 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 · BaseSchemaValidator.validate_file_references (cyclomatic 23) · ×2
  • BaseSchemaValidator.validate_file_references (cyclomatic 23) backend/skills/s_docx/ooxml/scripts/validation/base.py:277 — BaseSchemaValidator.validate_file_references 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.
  • BaseSchemaValidator.validate_file_references (cyclomatic 23) backend/skills/s_pptx/ooxml/scripts/validation/base.py:280 — BaseSchemaValidator.validate_file_references 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 · DeckStage._onKey (cyclomatic 21) · ×2
  • DeckStage._onKey (cyclomatic 21) docs/AI-Native-Transformation-Deck-CN.html:2742 — DeckStage._onKey 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.
  • DeckStage._onKey (cyclomatic 21) docs/AI-Native-Transformation-Deck.html:2742 — DeckStage._onKey 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 · BaseSchemaValidator.validate_all_relationship_ids (cyclomatic 20) · ×2
  • BaseSchemaValidator.validate_all_relationship_ids (cyclomatic 20) backend/skills/s_docx/ooxml/scripts/validation/base.py:388 — BaseSchemaValidator.validate_all_relationship_ids 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.
  • BaseSchemaValidator.validate_all_relationship_ids (cyclomatic 20) backend/skills/s_pptx/ooxml/scripts/validation/base.py:391 — BaseSchemaValidator.validate_all_relationship_ids 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 · daemon_guard._main (cyclomatic 18) · ×2
  • daemon_guard._main (cyclomatic 18) backend/core/daemon_guard.py:353 — daemon_guard._main 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.
  • daemon_guard._main (cyclomatic 18) desktop/resources/daemon/daemon_guard.py:353 — daemon_guard._main 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 · BaseSchemaValidator.validate_against_xsd (cyclomatic 16) · ×2
  • BaseSchemaValidator.validate_against_xsd (cyclomatic 16) backend/skills/s_docx/ooxml/scripts/validation/base.py:688 — BaseSchemaValidator.validate_against_xsd 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.
  • BaseSchemaValidator.validate_against_xsd (cyclomatic 16) backend/skills/s_pptx/ooxml/scripts/validation/base.py:691 — BaseSchemaValidator.validate_against_xsd 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 · PPTXSchemaValidator.validate_notes_slide_references (cyclomatic 16) · ×2
  • PPTXSchemaValidator.validate_notes_slide_references (cyclomatic 16) backend/skills/s_docx/ooxml/scripts/validation/pptx.py:243 — PPTXSchemaValidator.validate_notes_slide_references 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.
  • PPTXSchemaValidator.validate_notes_slide_references (cyclomatic 16) backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:243 — PPTXSchemaValidator.validate_notes_slide_references has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · BaseSchemaValidator.validate_all_relationship_ids (cognitive 55) · ×2
  • BaseSchemaValidator.validate_all_relationship_ids (cognitive 55) backend/skills/s_docx/ooxml/scripts/validation/base.py:388 — BaseSchemaValidator.validate_all_relationship_ids has cognitive complexity 55 (threshold 15). Drivers by points: if/else 11 (33 pts), ternaries 3 (13 pts), loops 4 (7 pts), error handling 1 (2 pts) (nesting depth added 36). 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.
  • BaseSchemaValidator.validate_all_relationship_ids (cognitive 55) backend/skills/s_pptx/ooxml/scripts/validation/base.py:391 — BaseSchemaValidator.validate_all_relationship_ids has cognitive complexity 55 (threshold 15). Drivers by points: if/else 11 (33 pts), ternaries 3 (13 pts), loops 4 (7 pts), error handling 1 (2 pts) (nesting depth added 36). 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 · compressDOM · ×2
  • compressDOM::(anonymous)::compress (cognitive 54) backend/skills/s_browser-agent/browser-agent.mjs:241 — compressDOM::(anonymous)::compress has cognitive complexity 54 (threshold 15). Drivers by points: if/else 19 (38 pts), boolean chains 8, ternaries 2 (4 pts), loops 2 (3 pts), error handling 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • compressDOM::(anonymous)::buildSelector (cognitive 17) backend/skills/s_browser-agent/browser-agent.mjs:206 — compressDOM::(anonymous)::buildSelector has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 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 · BaseSchemaValidator.validate_file_references (cognitive 46) · ×2
  • BaseSchemaValidator.validate_file_references (cognitive 46) backend/skills/s_docx/ooxml/scripts/validation/base.py:277 — BaseSchemaValidator.validate_file_references has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (26 pts), loops 6 (11 pts), error handling 2 (6 pts), boolean chains 3 (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.
  • BaseSchemaValidator.validate_file_references (cognitive 46) backend/skills/s_pptx/ooxml/scripts/validation/base.py:280 — BaseSchemaValidator.validate_file_references has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (26 pts), loops 6 (11 pts), error handling 2 (6 pts), boolean chains 3 (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 · BaseSchemaValidator.validate_content_types (cognitive 39) · ×2
  • BaseSchemaValidator.validate_content_types (cognitive 39) backend/skills/s_docx/ooxml/scripts/validation/base.py:522 — BaseSchemaValidator.validate_content_types has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (25 pts), loops 5 (6 pts), boolean chains 3, error handling 2 (3 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.
  • BaseSchemaValidator.validate_content_types (cognitive 39) backend/skills/s_pptx/ooxml/scripts/validation/base.py:525 — BaseSchemaValidator.validate_content_types has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (25 pts), loops 5 (6 pts), boolean chains 3, error handling 2 (3 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 · PPTXSchemaValidator.validate_notes_slide_references (cognitive 34) · ×2
  • PPTXSchemaValidator.validate_notes_slide_references (cognitive 34) backend/skills/s_docx/ooxml/scripts/validation/pptx.py:243 — PPTXSchemaValidator.validate_notes_slide_references has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 5 (9 pts), 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.
  • PPTXSchemaValidator.validate_notes_slide_references (cognitive 34) backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:243 — PPTXSchemaValidator.validate_notes_slide_references has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 5 (9 pts), 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 · DOCXSchemaValidator.validate_whitespace_preservation (cognitive 33) · ×2
  • DOCXSchemaValidator.validate_whitespace_preservation (cognitive 33) backend/skills/s_docx/ooxml/scripts/validation/docx.py:72 — DOCXSchemaValidator.validate_whitespace_preservation has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (18 pts), ternaries 1 (6 pts), loops 3 (5 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • DOCXSchemaValidator.validate_whitespace_preservation (cognitive 33) backend/skills/s_pptx/ooxml/scripts/validation/docx.py:72 — DOCXSchemaValidator.validate_whitespace_preservation has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (18 pts), ternaries 1 (6 pts), loops 3 (5 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · PPTXSchemaValidator.validate_uuid_ids (cognitive 30) · ×2
  • PPTXSchemaValidator.validate_uuid_ids (cognitive 30) backend/skills/s_docx/ooxml/scripts/validation/pptx.py:77 — PPTXSchemaValidator.validate_uuid_ids has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 4 (8 pts), error handling 1 (2 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.
  • PPTXSchemaValidator.validate_uuid_ids (cognitive 30) backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:77 — PPTXSchemaValidator.validate_uuid_ids has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 4 (8 pts), error handling 1 (2 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 · RedliningValidator._remove_claude_tracked_changes (cognitive 28) · ×2
  • RedliningValidator._remove_claude_tracked_changes (cognitive 28) backend/skills/s_docx/ooxml/scripts/validation/redlining.py:217 — RedliningValidator._remove_claude_tracked_changes has cognitive complexity 28 (threshold 15). Drivers by points: loops 8 (16 pts), if/else 3 (10 pts), boolean chains 2 (nesting depth added 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.
  • RedliningValidator._remove_claude_tracked_changes (cognitive 28) backend/skills/s_pptx/ooxml/scripts/validation/redlining.py:217 — RedliningValidator._remove_claude_tracked_changes has cognitive complexity 28 (threshold 15). Drivers by points: loops 8 (16 pts), if/else 3 (10 pts), boolean chains 2 (nesting depth added 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.
D2 · Cognitive Complexity · daemon_guard._main (cognitive 27) · ×2
  • daemon_guard._main (cognitive 27) backend/core/daemon_guard.py:353 — daemon_guard._main has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 9 (12 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.
  • daemon_guard._main (cognitive 27) desktop/resources/daemon/daemon_guard.py:353 — daemon_guard._main has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 9 (12 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 · PPTXSchemaValidator.validate_slide_layout_ids (cognitive 25) · ×2
  • PPTXSchemaValidator.validate_slide_layout_ids (cognitive 25) backend/skills/s_docx/ooxml/scripts/validation/pptx.py:128 — PPTXSchemaValidator.validate_slide_layout_ids has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 4 (7 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PPTXSchemaValidator.validate_slide_layout_ids (cognitive 25) backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:128 — PPTXSchemaValidator.validate_slide_layout_ids has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 4 (7 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RedliningValidator._get_git_word_diff (cognitive 23) · ×2
  • RedliningValidator._get_git_word_diff (cognitive 23) backend/skills/s_docx/ooxml/scripts/validation/redlining.py:139 — RedliningValidator._get_git_word_diff has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (4 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.
  • RedliningValidator._get_git_word_diff (cognitive 23) backend/skills/s_pptx/ooxml/scripts/validation/redlining.py:139 — RedliningValidator._get_git_word_diff has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (4 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 · BaseSchemaValidator.validate_against_xsd (cognitive 22) · ×2
  • BaseSchemaValidator.validate_against_xsd (cognitive 22) backend/skills/s_docx/ooxml/scripts/validation/base.py:688 — BaseSchemaValidator.validate_against_xsd has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (5 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.
  • BaseSchemaValidator.validate_against_xsd (cognitive 22) backend/skills/s_pptx/ooxml/scripts/validation/base.py:691 — BaseSchemaValidator.validate_against_xsd has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (5 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 · DOCXSchemaValidator.validate_deletions (cognitive 20) · ×2
  • DOCXSchemaValidator.validate_deletions (cognitive 20) backend/skills/s_docx/ooxml/scripts/validation/docx.py:124 — DOCXSchemaValidator.validate_deletions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (5 pts), ternaries 1 (4 pts), error handling 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.
  • DOCXSchemaValidator.validate_deletions (cognitive 20) backend/skills/s_pptx/ooxml/scripts/validation/docx.py:124 — DOCXSchemaValidator.validate_deletions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (5 pts), ternaries 1 (4 pts), error handling 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 · DeckStage._onKey (cognitive 20) · ×2
  • DeckStage._onKey (cognitive 20) docs/AI-Native-Transformation-Deck-CN.html:2742 — DeckStage._onKey has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (12 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.
  • DeckStage._onKey (cognitive 20) docs/AI-Native-Transformation-Deck.html:2742 — DeckStage._onKey has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (12 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 · DOCXSchemaValidator.validate_insertions (cognitive 19) · ×2
  • DOCXSchemaValidator.validate_insertions (cognitive 19) backend/skills/s_docx/ooxml/scripts/validation/docx.py:216 — DOCXSchemaValidator.validate_insertions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (6 pts), loops 3 (5 pts), boolean chains 3, ternaries 1 (3 pts), error handling 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.
  • DOCXSchemaValidator.validate_insertions (cognitive 19) backend/skills/s_pptx/ooxml/scripts/validation/docx.py:216 — DOCXSchemaValidator.validate_insertions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (6 pts), loops 3 (5 pts), boolean chains 3, ternaries 1 (3 pts), error handling 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.
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D3 · God Classes · ClassTooLong · ×2
  • ClassTooLong: ChatInput desktop/src/pages/chat/components/ChatInput.tsx:1 — ClassTooLong — 649 significant lines (blank, comment-only and punctuation-only lines excluded), 5 methods. The bar is 400 significant lines; this is 249 over it, 1.62× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MessageStore desktop/src/stores/MessageStore.ts:66 — ClassTooLong — 572 significant lines (blank, comment-only and punctuation-only lines excluded), 40 methods. The bar is 400 significant lines; this is 172 over it, 1.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.
D36 · Supply-chain Provenance & Signing · REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (41 lines × 2) · ×2
  • Duplicated block (41 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:827 — backend/skills/s_docx/ooxml/scripts/validation/base.py:827-867 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:830-870 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (41 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:907 — backend/skills/s_docx/ooxml/scripts/validation/base.py:907-947 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:910-950 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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 (38 lines × 2) · ×2
  • Duplicated block (38 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/docx.py:73 — backend/skills/s_docx/ooxml/scripts/validation/docx.py:73-110 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:73-110 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/docx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/docx.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 244 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 `backend/skills/s_docx/ooxml/scripts/validation/docx.py:73` it does not close everything it opens, so those exact 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 (38 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/pptx.py:204 — backend/skills/s_docx/ooxml/scripts/validation/pptx.py:204-241 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:204-241 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/pptx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/pptx.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 298 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (34 lines × 2) · ×2
  • Duplicated block (34 lines × 2) backend/core/daemon_guard.py:314 — backend/core/daemon_guard.py:314-347 | desktop/resources/daemon/daemon_guard.py:314-347 — before extracting anything, compare `backend/core/daemon_guard.py` and `desktop/resources/daemon/daemon_guard.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (34 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:487 — backend/skills/s_docx/ooxml/scripts/validation/base.py:487-520 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:490-523 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (31 lines × 2) · ×2
  • Duplicated block (31 lines × 2) backend/core/chat_thread_manager.py:475 — backend/core/chat_thread_manager.py:475-505 | backend/core/chat_thread_manager.py:549-581 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `data` to `ChatMessageCreate` in one and `ThreadSummaryCreate` 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 (31 lines × 2) backend/core/daemon_guard.py:199 — backend/core/daemon_guard.py:199-229 | desktop/resources/daemon/daemon_guard.py:199-229 — before extracting anything, compare `backend/core/daemon_guard.py` and `desktop/resources/daemon/daemon_guard.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 236 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 (26 lines × 2) · ×2
  • Duplicated block (26 lines × 2) backend/jobs/adapters/eastmoney_market.py:99 — backend/jobs/adapters/eastmoney_market.py:99-124 | backend/jobs/adapters/eastmoney_market.py:156-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. 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 (26 lines × 2) backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/decks.py:168 — backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/decks.py:168-193 | backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/library.py:129-156 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (24 lines × 2) · ×2
  • Duplicated block (24 lines × 2) backend/core/security_hooks.py:3045 — backend/core/security_hooks.py:3045-3068 | backend/core/security_hooks.py:3428-3451 — both copies are in the same file, so extract the 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 (24 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:766 — backend/skills/s_docx/ooxml/scripts/validation/base.py:766-789 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:769-792 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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 `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–23 lines × 2) · ×2
  • Duplicated block (20–23 lines × 2) backend/channels/gateway.py:2079 — backend/channels/gateway.py:2079-2101 | backend/channels/gateway.py:2184-2203 — both copies are in the same file, so extract the 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–23 lines × 2) backend/core/session_pending.py:523 — backend/core/session_pending.py:523-545 | backend/core/session_pending.py:567-586 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×2
  • Duplicated block (18 lines × 2) backend/core/daemon_guard.py:150 — backend/core/daemon_guard.py:150-167 | desktop/resources/daemon/daemon_guard.py:150-167 — before extracting anything, compare `backend/core/daemon_guard.py` and `desktop/resources/daemon/daemon_guard.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:187 — backend/skills/s_docx/ooxml/scripts/validation/base.py:187-204 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:187-204 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backend/skills/s_pptx/ooxml/scripts/validation/base.py:207` calls `isinstance` and `backend/skills/s_docx/ooxml/scripts/validation/base.py:206` 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 (16 lines × 2) · ×2
  • Duplicated block (16 lines × 2) backend/hive/provisioner.py:1600 — backend/hive/provisioner.py:1600-1615 | backend/hive/provisioner.py:1797-1812 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/hive/provisioner.py:1600` it begins part-way through the construct above it, so those exact 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) backend/routers/mcp.py:222 — backend/routers/mcp.py:222-237 | backend/routers/mcp.py:259-274 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/routers/mcp.py:222` it does not close everything it opens, so those exact 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–10 lines × 2) · ×2
  • Duplicated block (8–10 lines × 2) backend/core/security_hooks.py:1807 — backend/core/security_hooks.py:1807-1816 | backend/core/security_hooks.py:6388-6395 — both copies are in the same file, so extract the 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) backend/scripts/backfill_cjk_escapes.py:405 — backend/scripts/backfill_cjk_escapes.py:405-414 | backend/scripts/cleanup_message_history.py:96-103 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×2
  • Duplicated block (7–8 lines × 2) backend/core/ingestion/units.py:157 — backend/core/ingestion/units.py:157-163 | backend/core/ingestion/units.py:177-184 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7–8 lines × 2) backend/core/security_hooks.py:3283 — backend/core/security_hooks.py:3283-3289 | backend/core/security_hooks.py:3298-3305 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/core/security_hooks.py:3283` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×2
  • Duplicated block (7 lines × 4) backend/skills/s_frontend-design/scripts/design_system.py:726 — backend/skills/s_frontend-design/scripts/design_system.py:726-732 | backend/skills/s_frontend-design/scripts/design_system.py:744-750 | backend/skills/s_frontend-design/scripts/design_system.py:759-765 | backend/skills/s_frontend-design/scripts/design_system.py:789-797 — 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.
  • Duplicated block (7 lines × 4) backend/core/brain_eval.py:60 — backend/core/brain_eval.py:60-66 | backend/core/eval_followups.py:64-70 | backend/core/hive_diagnostics.py:232-238 | backend/core/swarm_out_settle.py:626-632 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×2
  • Duplicated block (5 lines × 3) backend/core/app_manifest.py:209 — backend/core/app_manifest.py:209-213 | backend/core/app_provenance.py:115-119 | backend/scripts/generate_app_execution_releases.py:32-36 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (5 lines × 3) backend/routers/tasks.py:162 — backend/routers/tasks.py:162-166 | backend/routers/tasks.py:171-175 | backend/routers/todos.py:182-189 — 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 `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.
R10 · Code Duplication · Duplicated block with local edits (42 matched lines × 2 locations) · ×2
  • Duplicated block with local edits (42 matched lines × 2 locations) desktop/src/components/layout/JobsRunsOverlay.tsx:479 — desktop/src/components/layout/JobsRunsOverlay.tsx:479 · desktop/src/components/layout/ToDoOverlay.tsx:1054 — the two spans are one implementation copied and then locally edited — 349 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
  • Duplicated block with local edits (42 matched lines × 2 locations) desktop/src/services/agents.ts:18 — desktop/src/services/agents.ts:18 · desktop/src/services/channels.ts:64 — the two spans are one implementation copied and then locally edited — 401 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (23 lines × 2 locations) · ×2
  • Duplicated block (23 lines × 2 locations) desktop/src/pages/SkillsPage.tsx:951 — desktop/src/pages/SkillsPage.tsx:951 · desktop/src/pages/SkillsPage.tsx:980 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
  • Duplicated block (23 lines × 2 locations) desktop/src/pages/chat/components/TSCCPanel.tsx:128 — desktop/src/pages/chat/components/TSCCPanel.tsx:128 · desktop/src/pages/chat/components/TSCCPanel.tsx:206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (22 lines × 2 locations) · ×2
  • Duplicated block (22 lines × 2 locations) backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:293 — backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:293 · backend/skills/s_pollinate/templates/remotion/components/FlowChart.tsx:30 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
  • Duplicated block (22 lines × 2 locations) desktop/src/components/common/AgentFormModal.tsx:256 — desktop/src/components/common/AgentFormModal.tsx:256 · desktop/src/components/common/AgentFormModal.tsx: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.
R10 · Code Duplication · Duplicated block (14 lines × 2 locations) · ×2
  • Duplicated block (14 lines × 2 locations) desktop/src/components/layout/HiveFleetOverlay.tsx:178 — desktop/src/components/layout/HiveFleetOverlay.tsx:178 · desktop/src/components/layout/JobsRunsOverlay.tsx:220 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (14 lines × 2 locations) desktop/src/components/layout/HiveFleetOverlay.tsx:257 — desktop/src/components/layout/HiveFleetOverlay.tsx:257 · desktop/src/components/layout/JobsRunsOverlay.tsx:165 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R11 · Import Boundaries · Boundary violation [package · ×2
  • Boundary violation [package:relative-cross-package] backend/skills/s_browser-agent/smoke-commands.mjs:16 — backend/skills/s_browser-agent/smoke-commands.mjs:16 reaches into another package with a relative path (./node_modules/playwright/index.mjs) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] REDACTED:20 — REDACTED:20 reaches into another package with a relative path (./node_modules/playwright/index.mjs) — import the package by name instead.
R7 · Dead Code · Dead file (~12 LoC) · ×2
  • Dead file (~12 LoC) desktop/src/components/settings/MCPServersTab.tsx — no import path from any entry point (91 application, 16 tooling, 532 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
  • Dead file (~12 LoC) desktop/src/stores/index.ts — no import path from any entry point (91 application, 16 tooling, 532 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
X1 · Async correctness · Blocking `thread · ×2
  • Blocking `thread::sleep` inside an `async` body desktop/src-tauri/src/lib.rs:487 — This `async` body is polled on an executor's worker thread, and `std::thread::sleep` blocks that thread: for the whole delay no other task scheduled on it makes progress — the Rust form of blocking on a task. Use `tokio::time::sleep(…).await` (or the runtime's own timer), which suspends only this task. Where the blocking work is not a sleep but a synchronous call that cannot be made async, move it off the executor with `tokio::task::spawn_blocking(…).await`.
  • Blocking `thread::sleep` inside an `async` body desktop/src-tauri/src/lib.rs:2666 — This `async` body is polled on an executor's worker thread, and `std::thread::sleep` blocks that thread: for the whole delay no other task scheduled on it makes progress — the Rust form of blocking on a task. Use `tokio::time::sleep(…).await` (or the runtime's own timer), which suspends only this task. Where the blocking work is not a sleep but a synchronous call that cannot be made async, move it off the executor with `tokio::task::spawn_blocking(…).await`.
AC1 · Text alternatives · <video> without a captions track · ×1
  • <video> without a captions track desktop/src/components/file-viewer/renderers/VideoRenderer.tsx:60 — Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation).
AC3 · Page structure · Heading level jumps from h2 to h4 · ×1
  • Heading level jumps from h2 to h4 assets/SwarmAI-Architecture-Design-Doc.html:2896 — Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
AC3 · Page structure · Data table has no header cells · ×1
  • Data table has no header cells desktop/src/components/file-viewer/renderers/OfficeRenderer.tsx:95 — A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
AC6 · Visual & motion safety · Low contrast colour pair in CSS (2.7 · ×1
  • Low contrast colour pair in CSS (2.7:1) desktop/public/brain-hub-demo.html:69 — `.sixdot` sets color: #5b636d on background-color: #1b2029 — 2.7:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
AC6 · Visual & motion safety · Low contrast colour pair in CSS (2.8 · ×1
  • Low contrast colour pair in CSS (2.8:1) desktop/public/brain-hub-demo.html:92 — `.panehdr` sets color: #5b636d on background-color: #161b22 — 2.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
AC6 · Visual & motion safety · Low contrast colour pair in CSS (3.0 · ×1
  • Low contrast colour pair in CSS (3.0:1) desktop/public/brain-hub-demo.html:215 — `.disttable .drow.head` sets color: #5b636d on background-color: #12161c — 3.0:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
AC7 · A11y enforcement · Accessibility enforcement below the top rung · ×1
  • Accessibility enforcement below the top rung package.json:1 — No accessibility enforcement found — no a11y linter (eslint-plugin-jsx-a11y) and no axe/pa11y/Lighthouse in tests or CI. Start with the linter to catch issues at author time. What was searched, so you can tell an absence from a miss: the 249 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
D1 · Cyclomatic Complexity · ChatPage.ChatPage (cyclomatic 431) · ×1
  • ChatPage.ChatPage (cyclomatic 431) desktop/src/pages/ChatPage.tsx:160 — ChatPage.ChatPage has cyclomatic complexity 431 (threshold 15). Of this number, 31 points are the body's own statements and 400 belong to 78 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 · useChatStreamingLifecycle.useChatStreamingLifecycle.createStreamHandler · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle.createStreamHandler::inner (cyclomatic 282) desktop/src/hooks/useChatStreamingLifecycle.ts:2688 — useChatStreamingLifecycle.useChatStreamingLifecycle.createStreamHandler::inner has cyclomatic complexity 282 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StreamingOrchestrator._read_formatted_response_body (cyclomatic 280) · ×1
  • StreamingOrchestrator._read_formatted_response_body (cyclomatic 280) backend/core/streaming_orchestrator.py:1422 — StreamingOrchestrator._read_formatted_response_body has cyclomatic complexity 280 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FileEditorCore.FileEditorCore (cyclomatic 258) · ×1
  • FileEditorCore.FileEditorCore (cyclomatic 258) desktop/src/components/common/FileEditorCore.tsx:688 — FileEditorCore.FileEditorCore has cyclomatic complexity 258 (threshold 15). Of this number, 99 points are the body's own statements and 159 belong to 56 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 · useChatStreamingLifecycle.useChatStreamingLifecycle (cyclomatic 176) · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle (cyclomatic 176) desktop/src/hooks/useChatStreamingLifecycle.ts:1084 — useChatStreamingLifecycle.useChatStreamingLifecycle has cyclomatic complexity 176 (threshold 15). Most of this is not in the body itself: 8 of the 176 points are its own statements and the rest belongs to 24 function literals inside it that branch (lines 1265, 4823, 4778, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ChannelGateway._handle_conversation (cyclomatic 174) · ×1
  • ChannelGateway._handle_conversation (cyclomatic 174) backend/channels/gateway.py:1676 — ChannelGateway._handle_conversation has cyclomatic complexity 174 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ConnectAccount.ConnectAccount (cyclomatic 173) · ×1
  • ConnectAccount.ConnectAccount (cyclomatic 173) desktop/src/components/awsAccount/ConnectAccount.tsx:110 — ConnectAccount.ConnectAccount has cyclomatic complexity 173 (threshold 15). Of this number, 81 points are the body's own statements and 92 belong to 31 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 · html2pptx.extractSlideData (cyclomatic 157) · ×1
  • html2pptx.extractSlideData (cyclomatic 157) backend/skills/s_pptx/scripts/html2pptx.js:244 — html2pptx.extractSlideData has cyclomatic complexity 157 (threshold 15). Most of this is not in the body itself: 1 of the 157 points is its own statement and the rest belongs to 15 function literals inside it that branch (lines 534, 422, 365, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · SessionRouter._run_conversation_impl (cyclomatic 140) · ×1
  • SessionRouter._run_conversation_impl (cyclomatic 140) backend/core/session_router.py:4751 — SessionRouter._run_conversation_impl has cyclomatic complexity 140 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · swarm_out_results.summarize (cyclomatic 139) · ×1
  • swarm_out_results.summarize (cyclomatic 139) backend/core/swarm_out_results.py:308 — swarm_out_results.summarize has cyclomatic complexity 139 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TabView.TabViewImpl (cyclomatic 133) · ×1
  • TabView.TabViewImpl (cyclomatic 133) desktop/src/pages/chat/components/TabView.tsx:268 — TabView.TabViewImpl has cyclomatic complexity 133 (threshold 15). Of this number, 35 points are the body's own statements and 98 belong to 20 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 · main (cyclomatic 122) · ×1
  • main (cyclomatic 122) backend/skills/s_browser-agent/browser-agent.mjs:393 — main has cyclomatic complexity 122 (threshold 15). Of this number, 115 points are the body's own statements and 7 belong to 12 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 · SkillsPage.GenerateSkillForm (cyclomatic 109) · ×1
  • SkillsPage.GenerateSkillForm (cyclomatic 109) desktop/src/pages/SkillsPage.tsx:328 — SkillsPage.GenerateSkillForm has cyclomatic complexity 109 (threshold 15). Of this number, 27 points are the body's own statements and 82 belong to 20 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 · eval_runner.generate_html_report (cyclomatic 88) · ×1
  • eval_runner.generate_html_report (cyclomatic 88) backend/scripts/eval_runner.py:2612 — eval_runner.generate_html_report has cyclomatic complexity 88 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AwsAccountTab.AwsAccountTab (cyclomatic 88) · ×1
  • AwsAccountTab.AwsAccountTab (cyclomatic 88) desktop/src/components/settings/AwsAccountTab.tsx:41 — AwsAccountTab.AwsAccountTab has cyclomatic complexity 88 (threshold 15). Of this number, 71 points are the body's own statements and 17 belong to 9 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AssistantMessageView.AssistantMessageView (cyclomatic 87) · ×1
  • AssistantMessageView.AssistantMessageView (cyclomatic 87) desktop/src/pages/chat/components/AssistantMessageView.tsx:226 — AssistantMessageView.AssistantMessageView has cyclomatic complexity 87 (threshold 15). Of this number, 59 points are the body's own statements and 28 belong to 14 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 · FileViewerPanel.FileViewerPanelImpl (cyclomatic 87) · ×1
  • FileViewerPanel.FileViewerPanelImpl (cyclomatic 87) desktop/src/components/file-viewer/FileViewerPanel.tsx:181 — FileViewerPanel.FileViewerPanelImpl has cyclomatic complexity 87 (threshold 15). Of this number, 58 points are the body's own statements and 29 belong to 14 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · audit.render (cyclomatic 85) · ×1
  • audit.render (cyclomatic 85) backend/core/run_protocol/audit.py:781 — audit.render has cyclomatic complexity 85 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RunOverlay.RunOverlay (cyclomatic 85) · ×1
  • RunOverlay.RunOverlay (cyclomatic 85) desktop/src/components/swarm-out/RunOverlay.tsx:653 — RunOverlay.RunOverlay has cyclomatic complexity 85 (threshold 15). Of this number, 41 points are the body's own statements and 44 belong to 17 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · audit.build (cyclomatic 80) · ×1
  • audit.build (cyclomatic 80) backend/core/run_protocol/audit.py:373 — audit.build has cyclomatic complexity 80 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · project_agent_draft.build (cyclomatic 79) · ×1
  • project_agent_draft.build (cyclomatic 79) backend/core/project_agent_draft.py:432 — project_agent_draft.build has cyclomatic complexity 79 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · swarm_out_settle.derive (cyclomatic 78) · ×1
  • swarm_out_settle.derive (cyclomatic 78) backend/core/swarm_out_settle.py:468 — swarm_out_settle.derive has cyclomatic complexity 78 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · checks._evaluate_check (cyclomatic 77) · ×1
  • checks._evaluate_check (cyclomatic 77) backend/core/run_protocol/checks.py:418 — checks._evaluate_check has cyclomatic complexity 77 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · receivers.scope_of (cyclomatic 73) · ×1
  • receivers.scope_of (cyclomatic 73) backend/core/code_intel/receivers.py:839 — receivers.scope_of 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 · lifecycle._apply (cyclomatic 73) · ×1
  • lifecycle._apply (cyclomatic 73) backend/core/run_protocol/lifecycle.py:751 — lifecycle._apply 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 · changed._report (cyclomatic 72) · ×1
  • changed._report (cyclomatic 72) backend/core/code_intel/changed.py:649 — changed._report has cyclomatic complexity 72 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CapabilitiesOverlay.CapabilitiesContent (cyclomatic 71) · ×1
  • CapabilitiesOverlay.CapabilitiesContent (cyclomatic 71) desktop/src/components/layout/CapabilitiesOverlay.tsx:195 — CapabilitiesOverlay.CapabilitiesContent has cyclomatic complexity 71 (threshold 15). Of this number, 45 points are the body's own statements and 26 belong to 13 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · pipeline_v2.run_unit_v2 (cyclomatic 69) · ×1
  • pipeline_v2.run_unit_v2 (cyclomatic 69) backend/core/ingestion/pipeline_v2.py:701 — pipeline_v2.run_unit_v2 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 · AuthConfigPanel.AuthConfigPanel (cyclomatic 69) · ×1
  • AuthConfigPanel.AuthConfigPanel (cyclomatic 69) desktop/src/components/settings/AuthConfigPanel.tsx:25 — AuthConfigPanel.AuthConfigPanel has cyclomatic complexity 69 (threshold 15). Of this number, 30 points are the body's own statements and 39 belong to 8 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · main.lifespan (cyclomatic 68) · ×1
  • main.lifespan (cyclomatic 68) backend/main.py:1014 — main.lifespan has cyclomatic complexity 68 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · security_hooks._audit_tool_hit (cyclomatic 66) · ×1
  • security_hooks._audit_tool_hit (cyclomatic 66) backend/core/security_hooks.py:5893 — security_hooks._audit_tool_hit 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 · executor.execute_job (cyclomatic 66) · ×1
  • executor.execute_job (cyclomatic 66) REDACTED:151 — executor.execute_job 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 · useCanvasHost.useCanvasHost (cyclomatic 66) · ×1
  • useCanvasHost.useCanvasHost (cyclomatic 66) desktop/src/hooks/useCanvasHost.ts:236 — useCanvasHost.useCanvasHost has cyclomatic complexity 66 (threshold 15). Most of this is not in the body itself: 3 of the 66 points are its own statements and the rest belongs to 14 function literals inside it that branch (lines 622, 778, 726, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · FileTypes.value_type (cyclomatic 62) · ×1
  • FileTypes.value_type (cyclomatic 62) backend/core/code_intel/receivers.py:466 — FileTypes.value_type 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 · SessionUnit.send (cyclomatic 62) · ×1
  • SessionUnit.send (cyclomatic 62) backend/core/session_unit.py:2420 — SessionUnit.send 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 · CredentialBanner.CredentialBanner (cyclomatic 61) · ×1
  • CredentialBanner.CredentialBanner (cyclomatic 61) desktop/src/components/common/CredentialBanner.tsx:49 — CredentialBanner.CredentialBanner has cyclomatic complexity 61 (threshold 15). Of this number, 23 points are the body's own statements and 38 belong to 17 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 · security_hooks._pending_commit_paths (cyclomatic 60) · ×1
  • security_hooks._pending_commit_paths (cyclomatic 60) backend/core/security_hooks.py:3379 — security_hooks._pending_commit_paths 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 · BackendStartupOverlay.BackendStartupOverlay (cyclomatic 60) · ×1
  • BackendStartupOverlay.BackendStartupOverlay (cyclomatic 60) desktop/src/components/common/BackendStartupOverlay.tsx:243 — BackendStartupOverlay.BackendStartupOverlay has cyclomatic complexity 60 (threshold 15). Most of this is not in the body itself: 14 of the 60 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 442, a function literal at line 407, a function literal at line 361, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · SQLiteDatabase._run_versioned_migrations (cyclomatic 59) · ×1
  • SQLiteDatabase._run_versioned_migrations (cyclomatic 59) backend/database/sqlite.py:2888 — SQLiteDatabase._run_versioned_migrations has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DispatchCard.DispatchCard (cyclomatic 59) · ×1
  • DispatchCard.DispatchCard (cyclomatic 59) desktop/src/pages/chat/components/DispatchCard.tsx:160 — DispatchCard.DispatchCard has cyclomatic complexity 59 (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 · browser-agent.compressDOM (cyclomatic 58) · ×1
  • browser-agent.compressDOM (cyclomatic 58) backend/skills/s_browser-agent/browser-agent.mjs:169 — browser-agent.compressDOM has cyclomatic complexity 58 (threshold 15). Most of this is not in the body itself: 1 of the 58 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 241, 206, 197). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · useChatStreamingLifecycle.useChatStreamingLifecycle.createErrorHandlerInner.<returned closure> (cyclomatic 58) · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle.createErrorHandlerInner.<returned closure> (cyclomatic 58) desktop/src/hooks/useChatStreamingLifecycle.ts:3997 — useChatStreamingLifecycle.useChatStreamingLifecycle.createErrorHandlerInner.<returned closure> has cyclomatic complexity 58 (threshold 15). Of this number, 39 points are the body's own statements and 19 belong to 5 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 · TurnZones.AgentRow (cyclomatic 58) · ×1
  • TurnZones.AgentRow (cyclomatic 58) desktop/src/pages/chat/components/TurnZones.tsx:513 — TurnZones.AgentRow has cyclomatic complexity 58 (threshold 15). Of this number, 53 points are the body's own statements and 5 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 · PromptBuilder.build_options (cyclomatic 56) · ×1
  • PromptBuilder.build_options (cyclomatic 56) REDACTED:2306 — PromptBuilder.build_options has cyclomatic complexity 56 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PipelineRunCard.PipelineRunCard (cyclomatic 56) · ×1
  • PipelineRunCard.PipelineRunCard (cyclomatic 56) desktop/src/components/layout/PipelineRunCard.tsx:66 — PipelineRunCard.PipelineRunCard has cyclomatic complexity 56 (threshold 15). Of this number, 33 points are the body's own statements and 23 belong to 10 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AgentFormModal.AgentFormModal (cyclomatic 55) · ×1
  • AgentFormModal.AgentFormModal (cyclomatic 55) desktop/src/components/common/AgentFormModal.tsx:36 — AgentFormModal.AgentFormModal has cyclomatic complexity 55 (threshold 15). Of this number, 26 points are the body's own statements and 29 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 · LibraryPanel.LibraryPanel (cyclomatic 54) · ×1
  • LibraryPanel.LibraryPanel (cyclomatic 54) backend/apps/pptx-maker/package/upstream/kirocrew/website/src/apps/pptx-maker/LibraryPanel.tsx:98 — LibraryPanel.LibraryPanel has cyclomatic complexity 54 (threshold 15). Of this number, 42 points are the body's own statements and 12 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 · turnView.labelBash (cyclomatic 54) · ×1
  • turnView.labelBash (cyclomatic 54) REDACTED:872 — turnView.labelBash has cyclomatic complexity 54 (threshold 15). Of this number, 45 points are the body's own statements and 9 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · turnView.deriveTurnView (cyclomatic 53) · ×1
  • turnView.deriveTurnView (cyclomatic 53) REDACTED:314 — turnView.deriveTurnView 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. This shape REPEATS in the file: one other method here (turnView.deriveTurnView::pushToolStep) 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 · ChatInput.ChatInput (cyclomatic 53) · ×1
  • ChatInput.ChatInput (cyclomatic 53) desktop/src/pages/chat/components/ChatInput.tsx:173 — ChatInput.ChatInput has cyclomatic complexity 53 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between 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 (ChatInput.ChatInput::handleKeyDown) 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 · PromptBuilder.build_system_prompt (cyclomatic 52) · ×1
  • PromptBuilder.build_system_prompt (cyclomatic 52) REDACTED:1354 — PromptBuilder.build_system_prompt 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 · RepoPane.RepoPane (cyclomatic 52) · ×1
  • RepoPane.RepoPane (cyclomatic 52) desktop/src/components/workspace-explorer/RepoPane.tsx:75 — RepoPane.RepoPane has cyclomatic complexity 52 (threshold 15). Of this number, 19 points are the body's own statements and 33 belong to 10 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 · CsvRenderer.CsvRenderer (cyclomatic 52) · ×1
  • CsvRenderer.CsvRenderer (cyclomatic 52) desktop/src/components/file-viewer/renderers/CsvRenderer.tsx:49 — CsvRenderer.CsvRenderer has cyclomatic complexity 52 (threshold 15). Of this number, 18 points are the body's own statements and 34 belong to 13 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · FileTypes.ann_type (cyclomatic 51) · ×1
  • FileTypes.ann_type (cyclomatic 51) backend/core/code_intel/receivers.py:384 — FileTypes.ann_type 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 · tool_summarizer.summarize_tool_use (cyclomatic 51) · ×1
  • tool_summarizer.summarize_tool_use (cyclomatic 51) backend/core/tool_summarizer.py:248 — tool_summarizer.summarize_tool_use 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 · SwarmOutWaitCard.SwarmOutWaitCard (cyclomatic 51) · ×1
  • SwarmOutWaitCard.SwarmOutWaitCard (cyclomatic 51) desktop/src/components/swarm-out/SwarmOutWaitCard.tsx:42 — SwarmOutWaitCard.SwarmOutWaitCard has cyclomatic complexity 51 (threshold 15). Of this number, 33 points are the body's own statements and 18 belong to 7 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RunOverlay.DeliverableTab (cyclomatic 51) · ×1
  • RunOverlay.DeliverableTab (cyclomatic 51) desktop/src/components/swarm-out/RunOverlay.tsx:196 — RunOverlay.DeliverableTab has cyclomatic complexity 51 (threshold 15). Of this number, 24 points are the body's own statements and 27 belong to 6 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CasesTab.CaseDetailView (cyclomatic 51) · ×1
  • CasesTab.CaseDetailView (cyclomatic 51) desktop/src/pages/eval/CasesTab.tsx:368 — CasesTab.CaseDetailView has cyclomatic complexity 51 (threshold 15). Of this number, 44 points are the body's own statements and 7 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AIModelsTab.AIModelsTab (cyclomatic 51) · ×1
  • AIModelsTab.AIModelsTab (cyclomatic 51) desktop/src/components/settings/AIModelsTab.tsx:24 — AIModelsTab.AIModelsTab has cyclomatic complexity 51 (threshold 15). Most of this is not in the body itself: 15 of the 51 points are its own statements and the rest belongs to 15 function items inside it that branch (handleAddDiscovered, a function literal at line 79, handleRefreshFromBedrock, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · security_hooks._segment_is_irreversible (cyclomatic 50) · ×1
  • security_hooks._segment_is_irreversible (cyclomatic 50) backend/core/security_hooks.py:828 — security_hooks._segment_is_irreversible 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 · desktop_main.run_ingest (cyclomatic 50) · ×1
  • desktop_main.run_ingest (cyclomatic 50) REDACTED:215 — desktop_main.run_ingest 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 · streaming-machine.streamingReducer (cyclomatic 48) · ×1
  • streaming-machine.streamingReducer (cyclomatic 48) desktop/src/hooks/streaming-machine.ts:105 — streaming-machine.streamingReducer has cyclomatic complexity 48 (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 · turnZones.turnZones (cyclomatic 48) · ×1
  • turnZones.turnZones (cyclomatic 48) desktop/src/pages/chat/turnZones.ts:229 — turnZones.turnZones has cyclomatic complexity 48 (threshold 15). Of this number, 43 points are the body's own statements and 5 belong to 5 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 · TerminalPanel.TerminalPanel (cyclomatic 48) · ×1
  • TerminalPanel.TerminalPanel (cyclomatic 48) desktop/src/components/terminal/TerminalPanel.tsx:146 — TerminalPanel.TerminalPanel has cyclomatic complexity 48 (threshold 15). Most of this is not in the body itself: 10 of the 48 points are its own statements and the rest belongs to 16 function items inside it that branch (a function literal at line 483, a function literal at line 507, sendToChat, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · RunOverlay.CommandPanel (cyclomatic 47) · ×1
  • RunOverlay.CommandPanel (cyclomatic 47) desktop/src/components/swarm-out/RunOverlay.tsx:337 — RunOverlay.CommandPanel has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (RunOverlay.CommandPanel::cmd) 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 · TerminalTab.TerminalTab (cyclomatic 46) · ×1
  • TerminalTab.TerminalTab (cyclomatic 46) desktop/src/components/terminal/TerminalTab.tsx:124 — TerminalTab.TerminalTab has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 8 of the 46 points are its own statements and the rest belongs to 13 function items inside it that branch (a function literal at line 243, a function literal at line 353, a function literal at line 271, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · provenance.enqueue_unit (cyclomatic 45) · ×1
  • provenance.enqueue_unit (cyclomatic 45) backend/core/ingestion/provenance.py:411 — provenance.enqueue_unit 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 · writer._render_block (cyclomatic 45) · ×1
  • writer._render_block (cyclomatic 45) backend/core/ingestion/writer.py:405 — writer._render_block 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 · project_agent_draft._merge (cyclomatic 45) · ×1
  • project_agent_draft._merge (cyclomatic 45) backend/core/project_agent_draft.py:582 — project_agent_draft._merge 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 · ReviewOrchestrator.plan_fix_handoff (cyclomatic 45) · ×1
  • ReviewOrchestrator.plan_fix_handoff (cyclomatic 45) backend/core/run_protocol/review.py:798 — ReviewOrchestrator.plan_fix_handoff 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 · landing.commit_repos (cyclomatic 44) · ×1
  • landing.commit_repos (cyclomatic 44) backend/core/run_protocol/landing.py:538 — landing.commit_repos has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · scheduler.run_scheduler (cyclomatic 44) · ×1
  • scheduler.run_scheduler (cyclomatic 44) backend/jobs/scheduler.py:521 — scheduler.run_scheduler has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · turnControls.sendMessage (cyclomatic 44) · ×1
  • turnControls.sendMessage (cyclomatic 44) desktop/src/pages/chat/turnControls.ts:224 — turnControls.sendMessage has cyclomatic complexity 44 (threshold 15). Of this number, 40 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 · changed.render (cyclomatic 43) · ×1
  • changed.render (cyclomatic 43) backend/core/code_intel/changed.py:884 — changed.render 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 · security_hooks._normalize_newlines_quote_aware (cyclomatic 43) · ×1
  • security_hooks._normalize_newlines_quote_aware (cyclomatic 43) backend/core/security_hooks.py:2840 — security_hooks._normalize_newlines_quote_aware 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 · cli_commands._execute_loaded (cyclomatic 42) · ×1
  • cli_commands._execute_loaded (cyclomatic 42) backend/core/run_protocol/cli_commands.py:424 — cli_commands._execute_loaded 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 · RunEngine.stage_complete (cyclomatic 42) · ×1
  • RunEngine.stage_complete (cyclomatic 42) backend/core/run_protocol/engine.py:2422 — RunEngine.stage_complete 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 · security_hooks._segment_session_link (cyclomatic 42) · ×1
  • security_hooks._segment_session_link (cyclomatic 42) backend/core/security_hooks.py:4988 — security_hooks._segment_session_link 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 · eval_scheduled.run_eval_scheduled (cyclomatic 42) · ×1
  • eval_scheduled.run_eval_scheduled (cyclomatic 42) backend/jobs/handlers/eval_scheduled.py:148 — eval_scheduled.run_eval_scheduled 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 · ArtifactsOverlay.ArtifactsContent (cyclomatic 42) · ×1
  • ArtifactsOverlay.ArtifactsContent (cyclomatic 42) desktop/src/components/layout/ArtifactsOverlay.tsx:257 — ArtifactsOverlay.ArtifactsContent has cyclomatic complexity 42 (threshold 15). Of this number, 21 points are the body's own statements and 21 belong to 13 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 · PipelineOverlay.PipelineContent (cyclomatic 42) · ×1
  • PipelineOverlay.PipelineContent (cyclomatic 42) desktop/src/components/layout/PipelineOverlay.tsx:126 — PipelineOverlay.PipelineContent has cyclomatic complexity 42 (threshold 15). Of this number, 26 points are the body's own statements and 16 belong to 11 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · prompt_builder._render_canvas_lines (cyclomatic 41) · ×1
  • prompt_builder._render_canvas_lines (cyclomatic 41) REDACTED:330 — prompt_builder._render_canvas_lines 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 · findings.fold (cyclomatic 41) · ×1
  • findings.fold (cyclomatic 41) backend/core/run_protocol/findings.py:328 — findings.fold 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 · next_step.next_step (cyclomatic 41) · ×1
  • next_step.next_step (cyclomatic 41) backend/core/run_protocol/next_step.py:181 — next_step.next_step 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 · swarm_out._dispatch_spec (cyclomatic 41) · ×1
  • swarm_out._dispatch_spec (cyclomatic 41) backend/core/swarm_out.py:773 — swarm_out._dispatch_spec has cyclomatic complexity 41 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · swarm_out_record.funnel (cyclomatic 41) · ×1
  • swarm_out_record.funnel (cyclomatic 41) backend/core/swarm_out_record.py:236 — swarm_out_record.funnel has cyclomatic complexity 41 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChatErrorMessage.ChatErrorMessage (cyclomatic 41) · ×1
  • ChatErrorMessage.ChatErrorMessage (cyclomatic 41) desktop/src/components/chat/ChatErrorMessage.tsx:55 — ChatErrorMessage.ChatErrorMessage has cyclomatic complexity 41 (threshold 15). Of this number, 40 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PipelineRunCard.Commands (cyclomatic 41) · ×1
  • PipelineRunCard.Commands (cyclomatic 41) desktop/src/components/layout/PipelineRunCard.tsx:294 — PipelineRunCard.Commands has cyclomatic complexity 41 (threshold 15). Of this number, 20 points are the body's own statements and 21 belong to 7 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · GraphStore.resolve_bare_targets (cyclomatic 40) · ×1
  • GraphStore.resolve_bare_targets (cyclomatic 40) backend/core/code_intel/graph_store.py:1806 — GraphStore.resolve_bare_targets 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 · hive_records.pull (cyclomatic 40) · ×1
  • hive_records.pull (cyclomatic 40) backend/core/hive_records.py:888 — hive_records.pull 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 · runtime_hooks._prompt_reads (cyclomatic 40) · ×1
  • runtime_hooks._prompt_reads (cyclomatic 40) backend/core/runtime_hooks.py:917 — runtime_hooks._prompt_reads 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 · workspace_api.resolve_path_to_physical (cyclomatic 40) · ×1
  • workspace_api.resolve_path_to_physical (cyclomatic 40) backend/routers/workspace_api.py:1205 — workspace_api.resolve_path_to_physical 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 · ai_ready_helpers.extract_import_graph (cyclomatic 40) · ×1
  • ai_ready_helpers.extract_import_graph (cyclomatic 40) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:579 — ai_ready_helpers.extract_import_graph 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 · ExplorerContext.ExplorerProvider (cyclomatic 40) · ×1
  • ExplorerContext.ExplorerProvider (cyclomatic 40) desktop/src/contexts/ExplorerContext.tsx:390 — ExplorerContext.ExplorerProvider has cyclomatic complexity 40 (threshold 15). Most of this is not in the body itself: 1 of the 40 points is its own statement and the rest belongs to 13 function literals inside it that branch (lines 647, 610, 483, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · transcriptFeed.planTranscriptChange (cyclomatic 40) · ×1
  • transcriptFeed.planTranscriptChange (cyclomatic 40) desktop/src/hooks/transcriptFeed.ts:71 — transcriptFeed.planTranscriptChange has cyclomatic complexity 40 (threshold 15). Of this number, 31 points are the body's own statements and 9 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionTab.SessionTab (cyclomatic 40) · ×1
  • SessionTab.SessionTab (cyclomatic 40) desktop/src/pages/chat/components/SessionTab.tsx:53 — SessionTab.SessionTab has cyclomatic complexity 40 (threshold 15). Of this number, 37 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · compressDOM · ×1
  • compressDOM::(anonymous)::compress (cyclomatic 40) backend/skills/s_browser-agent/browser-agent.mjs:241 — compressDOM::(anonymous)::compress 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 · addressing._map (cyclomatic 39) · ×1
  • addressing._map (cyclomatic 39) backend/core/addressing.py:325 — addressing._map 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 · RunEngine.create (cyclomatic 39) · ×1
  • RunEngine.create (cyclomatic 39) backend/core/run_protocol/engine.py:465 — RunEngine.create has cyclomatic complexity 39 (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 · lifecycle._land (cyclomatic 39) · ×1
  • lifecycle._land (cyclomatic 39) backend/core/run_protocol/lifecycle.py:544 — lifecycle._land 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 · schemas.validate_contract (cyclomatic 39) · ×1
  • schemas.validate_contract (cyclomatic 39) backend/core/run_protocol/schemas.py:582 — schemas.validate_contract 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 · VirtualizedTree.flattenTree (cyclomatic 39) · ×1
  • VirtualizedTree.flattenTree (cyclomatic 39) desktop/src/components/workspace-explorer/VirtualizedTree.tsx:264 — VirtualizedTree.flattenTree has cyclomatic complexity 39 (threshold 15). Of this number, 38 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · survey._conventions (cyclomatic 38) · ×1
  • survey._conventions (cyclomatic 38) backend/core/brain_bootstrap/survey.py:207 — survey._conventions 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 · parser.parse_repo_with_coverage (cyclomatic 38) · ×1
  • parser.parse_repo_with_coverage (cyclomatic 38) backend/core/code_intel/parser.py:2410 — parser.parse_repo_with_coverage 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 · child_cli.dispatch (cyclomatic 38) · ×1
  • child_cli.dispatch (cyclomatic 38) backend/core/run_protocol/child_cli.py:329 — child_cli.dispatch 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 · usage_report.report (cyclomatic 38) · ×1
  • usage_report.report (cyclomatic 38) backend/core/usage_report.py:148 — usage_report.report 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 · daily_activity_hook._get_session_git_commits (cyclomatic 38) · ×1
  • daily_activity_hook._get_session_git_commits (cyclomatic 38) backend/hooks/daily_activity_hook.py:212 — daily_activity_hook._get_session_git_commits 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 · InlinePermissionRequest.InlinePermissionRequest (cyclomatic 38) · ×1
  • InlinePermissionRequest.InlinePermissionRequest (cyclomatic 38) desktop/src/pages/chat/components/InlinePermissionRequest.tsx:60 — InlinePermissionRequest.InlinePermissionRequest has cyclomatic complexity 38 (threshold 15). Of this number, 21 points are the body's own statements and 17 belong to 6 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · TurnZones.TurnZoneList (cyclomatic 38) · ×1
  • TurnZones.TurnZoneList (cyclomatic 38) desktop/src/pages/chat/components/TurnZones.tsx:972 — TurnZones.TurnZoneList has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 2 of the 38 points are its own statements and the rest belongs to one function literal inside it that branches (line 979). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · HiveFleet.HiveSetupStep (cyclomatic 38) · ×1
  • HiveFleet.HiveSetupStep (cyclomatic 38) desktop/src/components/awsAccount/HiveFleet.tsx:115 — HiveFleet.HiveSetupStep has cyclomatic complexity 38 (threshold 15). Of this number, 28 points are the body's own statements and 10 belong to 6 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · aws_detect.stage1 (cyclomatic 37) · ×1
  • aws_detect.stage1 (cyclomatic 37) backend/core/aws_detect.py:75 — aws_detect.stage1 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 · security_hooks._builtin_session_link (cyclomatic 37) · ×1
  • security_hooks._builtin_session_link (cyclomatic 37) backend/core/security_hooks.py:4731 — security_hooks._builtin_session_link 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 · workspace_api._build_tree (cyclomatic 37) · ×1
  • workspace_api._build_tree (cyclomatic 37) backend/routers/workspace_api.py:389 — workspace_api._build_tree 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 · useChatStreamingLifecycle.useChatStreamingLifecycle.syncQueuedBadges (cyclomatic 37) · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle.syncQueuedBadges (cyclomatic 37) desktop/src/hooks/useChatStreamingLifecycle.ts:1823 — useChatStreamingLifecycle.useChatStreamingLifecycle.syncQueuedBadges has cyclomatic complexity 37 (threshold 15). Of this number, 34 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · aws_account._check_candidate (cyclomatic 36) · ×1
  • aws_account._check_candidate (cyclomatic 36) backend/core/aws_account.py:485 — aws_account._check_candidate 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 · interface.delta (cyclomatic 36) · ×1
  • interface.delta (cyclomatic 36) backend/core/code_intel/interface.py:681 — interface.delta 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 · ddd_format.normalize (cyclomatic 36) · ×1
  • ddd_format.normalize (cyclomatic 36) backend/core/ddd_format.py:268 — ddd_format.normalize 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 · overrides.check (cyclomatic 36) · ×1
  • overrides.check (cyclomatic 36) backend/core/ingestion/overrides.py:190 — overrides.check 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 · security_hooks._store_segment_destroys (cyclomatic 36) · ×1
  • security_hooks._store_segment_destroys (cyclomatic 36) backend/core/security_hooks.py:1114 — security_hooks._store_segment_destroys 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 · chat.chat_stream (cyclomatic 36) · ×1
  • chat.chat_stream (cyclomatic 36) backend/routers/chat.py:390 — chat.chat_stream 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 · TreeNodeRow.TreeNodeRow (cyclomatic 36) · ×1
  • TreeNodeRow.TreeNodeRow (cyclomatic 36) desktop/src/components/workspace-explorer/TreeNodeRow.tsx:190 — TreeNodeRow.TreeNodeRow has cyclomatic complexity 36 (threshold 15). Of this number, 29 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MessageStore._applyMerge (cyclomatic 36) · ×1
  • MessageStore._applyMerge (cyclomatic 36) desktop/src/stores/MessageStore.ts:960 — MessageStore._applyMerge has cyclomatic complexity 36 (threshold 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StarterMaterial.MaterialPicker (cyclomatic 36) · ×1
  • StarterMaterial.MaterialPicker (cyclomatic 36) desktop/src/components/layout/StarterMaterial.tsx:47 — StarterMaterial.MaterialPicker has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 2 of the 36 points are its own statements and the rest belongs to 14 function literals inside it that branch (lines 137, 111, 87, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · PollinateOverlay.AssetDrawer (cyclomatic 36) · ×1
  • PollinateOverlay.AssetDrawer (cyclomatic 36) desktop/src/components/layout/PollinateOverlay.tsx:492 — PollinateOverlay.AssetDrawer has cyclomatic complexity 36 (threshold 15). Of this number, 28 points are the body's own statements and 8 belong to 5 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 · useVoiceConversation.useVoiceConversation (cyclomatic 36) · ×1
  • useVoiceConversation.useVoiceConversation (cyclomatic 36) desktop/src/hooks/useVoiceConversation.ts:75 — useVoiceConversation.useVoiceConversation has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 1 of the 36 points is its own statement and the rest belongs to 8 function literals inside it that branch (lines 179, 264, 149, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · OnboardingPage.OnboardingPage (cyclomatic 36) · ×1
  • OnboardingPage.OnboardingPage (cyclomatic 36) desktop/src/pages/OnboardingPage.tsx:70 — OnboardingPage.OnboardingPage has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 12 of the 36 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 95, 201, 94, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · provenance._lookup_anchor (cyclomatic 35) · ×1
  • provenance._lookup_anchor (cyclomatic 35) backend/core/ingestion/provenance.py:160 — provenance._lookup_anchor has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · answers.parse_answer (cyclomatic 35) · ×1
  • answers.parse_answer (cyclomatic 35) backend/core/run_protocol/answers.py:139 — answers.parse_answer has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RunEngine._incremental_review (cyclomatic 35) · ×1
  • RunEngine._incremental_review (cyclomatic 35) backend/core/run_protocol/engine.py:3189 — RunEngine._incremental_review has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · worktree_write_gate._git_verdict (cyclomatic 35) · ×1
  • worktree_write_gate._git_verdict (cyclomatic 35) backend/core/worktree_write_gate.py:435 — worktree_write_gate._git_verdict has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · eval_runner.eval_trajectory_capture (cyclomatic 35) · ×1
  • eval_runner.eval_trajectory_capture (cyclomatic 35) backend/scripts/eval_runner.py:1549 — eval_runner.eval_trajectory_capture has cyclomatic complexity 35 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SelfLoopsHealthEngine.to_markdown (cyclomatic 35) · ×1
  • SelfLoopsHealthEngine.to_markdown (cyclomatic 35) backend/skills/s_loops-health/scripts/loops_health_check.py:844 — SelfLoopsHealthEngine.to_markdown has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · pollinate_validator.validate_delivery (cyclomatic 35) · ×1
  • pollinate_validator.validate_delivery (cyclomatic 35) backend/skills/s_pollinate/scripts/pollinate_validator.py:198 — pollinate_validator.validate_delivery has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ToDoOverlay.TodoForm (cyclomatic 35) · ×1
  • ToDoOverlay.TodoForm (cyclomatic 35) desktop/src/components/layout/ToDoOverlay.tsx:938 — ToDoOverlay.TodoForm has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 11 of the 35 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 1003, 968, 960, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · PollinateOverlay.PollinateContent (cyclomatic 35) · ×1
  • PollinateOverlay.PollinateContent (cyclomatic 35) desktop/src/components/layout/PollinateOverlay.tsx:114 — PollinateOverlay.PollinateContent has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 15 of the 35 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 165, 145, 210, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ChannelGateway.handle_inbound_message (cyclomatic 34) · ×1
  • ChannelGateway.handle_inbound_message (cyclomatic 34) backend/channels/gateway.py:1283 — ChannelGateway.handle_inbound_message 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 · interface._py_scan (cyclomatic 34) · ×1
  • interface._py_scan (cyclomatic 34) backend/core/code_intel/interface.py:412 — interface._py_scan 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 · FileTypes._scan_class (cyclomatic 34) · ×1
  • FileTypes._scan_class (cyclomatic 34) backend/core/code_intel/receivers.py:706 — FileTypes._scan_class 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 · RunEngine.review_start (cyclomatic 34) · ×1
  • RunEngine.review_start (cyclomatic 34) backend/core/run_protocol/engine.py:2908 — RunEngine.review_start 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 · RunEngine._normal_land (cyclomatic 34) · ×1
  • RunEngine._normal_land (cyclomatic 34) backend/core/run_protocol/engine.py:3885 — RunEngine._normal_land has cyclomatic complexity 34 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · swarm_out.answer (cyclomatic 34) · ×1
  • swarm_out.answer (cyclomatic 34) backend/core/swarm_out.py:2184 — swarm_out.answer 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 · generate_app_execution_releases.verify_attestation (cyclomatic 34) · ×1
  • generate_app_execution_releases.verify_attestation (cyclomatic 34) backend/scripts/generate_app_execution_releases.py:103 — generate_app_execution_releases.verify_attestation 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 · TurnZones.ToolStripV6 (cyclomatic 34) · ×1
  • TurnZones.ToolStripV6 (cyclomatic 34) desktop/src/pages/chat/components/TurnZones.tsx:352 — TurnZones.ToolStripV6 has cyclomatic complexity 34 (threshold 15). Of this number, 32 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 · PipelineMetrics.PipelineMetrics (cyclomatic 34) · ×1
  • PipelineMetrics.PipelineMetrics (cyclomatic 34) desktop/src/components/layout/PipelineMetrics.tsx:82 — PipelineMetrics.PipelineMetrics has cyclomatic complexity 34 (threshold 15). Of this number, 27 points are the body's own statements and 7 belong to 4 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 · ReviewModeGutter.ReviewModeGutter (cyclomatic 34) · ×1
  • ReviewModeGutter.ReviewModeGutter (cyclomatic 34) desktop/src/components/common/ReviewModeGutter.tsx:43 — ReviewModeGutter.ReviewModeGutter has cyclomatic complexity 34 (threshold 15). Of this number, 17 points are the body's own statements and 17 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · brain-demo.html.act (cyclomatic 34) · ×1
  • brain-demo.html.act (cyclomatic 34) docs/design/brain-demo.html:697 — brain-demo.html.act has cyclomatic complexity 34 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CliStreamReader._route (cyclomatic 33) · ×1
  • CliStreamReader._route (cyclomatic 33) backend/core/cli_stream_reader.py:486 — CliStreamReader._route 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 · interface.bound_names (cyclomatic 33) · ×1
  • interface.bound_names (cyclomatic 33) backend/core/code_intel/interface.py:479 — interface.bound_names 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 · interface._ts_scan (cyclomatic 33) · ×1
  • interface._ts_scan (cyclomatic 33) backend/core/code_intel/interface.py:566 — interface._ts_scan 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 · interface.call_sites (cyclomatic 33) · ×1
  • interface.call_sites (cyclomatic 33) backend/core/code_intel/interface.py:760 — interface.call_sites 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 · ProjectionLayer.project_skills (cyclomatic 33) · ×1
  • ProjectionLayer.project_skills (cyclomatic 33) backend/core/projection_layer.py:290 — ProjectionLayer.project_skills 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 · SessionUnit._emit_post_stream_metadata (cyclomatic 33) · ×1
  • SessionUnit._emit_post_stream_metadata (cyclomatic 33) backend/core/session_unit.py:3546 — SessionUnit._emit_post_stream_metadata 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 · swarm_out_card._text_of (cyclomatic 33) · ×1
  • swarm_out_card._text_of (cyclomatic 33) backend/core/swarm_out_card.py:340 — swarm_out_card._text_of 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 · migrate_followups_to_todos.da_items (cyclomatic 33) · ×1
  • migrate_followups_to_todos.da_items (cyclomatic 33) backend/scripts/migrate_followups_to_todos.py:157 — migrate_followups_to_todos.da_items 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 · MultiSelect.MultiSelect (cyclomatic 33) · ×1
  • MultiSelect.MultiSelect (cyclomatic 33) desktop/src/components/common/MultiSelect.tsx:26 — MultiSelect.MultiSelect has cyclomatic complexity 33 (threshold 15). Of this number, 19 points are the body's own statements and 14 belong to 7 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AskUserQuestion.AskUserQuestion (cyclomatic 33) · ×1
  • AskUserQuestion.AskUserQuestion (cyclomatic 33) desktop/src/components/common/AskUserQuestion.tsx:35 — AskUserQuestion.AskUserQuestion has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 9 of the 33 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 134, a function literal at line 58, a function literal at line 83, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · FileContextMenu.FileContextMenu (cyclomatic 33) · ×1
  • FileContextMenu.FileContextMenu (cyclomatic 33) desktop/src/components/workspace-explorer/FileContextMenu.tsx:61 — FileContextMenu.FileContextMenu has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 10 of the 33 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 105, 425, 143, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · VirtualizedTree.VirtualizedTree (cyclomatic 33) · ×1
  • VirtualizedTree.VirtualizedTree (cyclomatic 33) desktop/src/components/workspace-explorer/VirtualizedTree.tsx:697 — VirtualizedTree.VirtualizedTree has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 3 of the 33 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 891, 935, 823, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ExplorerToolbar.ExplorerToolbar (cyclomatic 33) · ×1
  • ExplorerToolbar.ExplorerToolbar (cyclomatic 33) desktop/src/components/workspace-explorer/ExplorerToolbar.tsx:36 — ExplorerToolbar.ExplorerToolbar has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 11 of the 33 points are its own statements and the rest belongs to 9 function items inside it that branch (handleUpload, handleConfirm, validateName, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · turnZones.pipelineZones (cyclomatic 33) · ×1
  • turnZones.pipelineZones (cyclomatic 33) desktop/src/pages/chat/turnZones.ts:308 — turnZones.pipelineZones has cyclomatic complexity 33 (threshold 15). Of this number, 24 points are the body's own statements and 9 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · hiveComponents.InstanceCard (cyclomatic 33) · ×1
  • hiveComponents.InstanceCard (cyclomatic 33) REDACTED:164 — hiveComponents.InstanceCard has cyclomatic complexity 33 (threshold 15). Of this number, 27 points are the body's own statements and 6 belong to 6 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · events._event_contract (cyclomatic 32) · ×1
  • events._event_contract (cyclomatic 32) backend/core/run_protocol/events.py:394 — events._event_contract 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 · run_worktree.land (cyclomatic 32) · ×1
  • run_worktree.land (cyclomatic 32) backend/core/run_worktree.py:1045 — run_worktree.land 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 · swarm_out_results._checks (cyclomatic 32) · ×1
  • swarm_out_results._checks (cyclomatic 32) backend/core/swarm_out_results.py:208 — swarm_out_results._checks 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 · backfill_cjk_escapes.backfill (cyclomatic 32) · ×1
  • backfill_cjk_escapes.backfill (cyclomatic 32) backend/scripts/backfill_cjk_escapes.py:579 — backfill_cjk_escapes.backfill 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 · cdf_move_misrouted.run (cyclomatic 32) · ×1
  • cdf_move_misrouted.run (cyclomatic 32) backend/scripts/cdf_move_misrouted.py:97 — cdf_move_misrouted.run 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 · cdf_write_scan.scan_tree (cyclomatic 32) · ×1
  • cdf_write_scan.scan_tree (cyclomatic 32) backend/scripts/cdf_write_scan.py:202 — cdf_write_scan.scan_tree 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 · style-extract.extract_shapes_summary (cyclomatic 32) · ×1
  • style-extract.extract_shapes_summary (cyclomatic 32) backend/skills/s_pptx/scripts/style-extract.py:81 — style-extract.extract_shapes_summary 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 · useLayer.useLayerFocus (cyclomatic 32) · ×1
  • useLayer.useLayerFocus (cyclomatic 32) desktop/src/hooks/useLayer.ts:46 — useLayer.useLayerFocus has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 7 of the 32 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 77, 60, 94, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · useChatStreamingLifecycle.useChatStreamingLifecycle.beginSubscriptionTurn (cyclomatic 32) · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle.beginSubscriptionTurn (cyclomatic 32) desktop/src/hooks/useChatStreamingLifecycle.ts:4659 — useChatStreamingLifecycle.useChatStreamingLifecycle.beginSubscriptionTurn has cyclomatic complexity 32 (threshold 15). Of this number, 21 points are the body's own statements and 11 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CdfUnitFeed.Trace (cyclomatic 32) · ×1
  • CdfUnitFeed.Trace (cyclomatic 32) desktop/src/components/layout/CdfUnitFeed.tsx:200 — CdfUnitFeed.Trace 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · OverviewTab.Dimensions (cyclomatic 32) · ×1
  • OverviewTab.Dimensions (cyclomatic 32) desktop/src/pages/eval/OverviewTab.tsx:253 — OverviewTab.Dimensions has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 4 of the 32 points are its own statements and the rest belongs to 6 function items inside it that branch (caseCol, metricCol, a function literal at line 315, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · CasesTab.CaseForm (cyclomatic 32) · ×1
  • CasesTab.CaseForm (cyclomatic 32) desktop/src/pages/eval/CasesTab.tsx:537 — CasesTab.CaseForm has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 14 of the 32 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 656, payload, a function literal at line 604, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · OnlineTab.OnlineTab (cyclomatic 32) · ×1
  • OnlineTab.OnlineTab (cyclomatic 32) desktop/src/pages/eval/OnlineTab.tsx:21 — OnlineTab.OnlineTab 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BackupTab.BackupTab (cyclomatic 32) · ×1
  • BackupTab.BackupTab (cyclomatic 32) desktop/src/components/settings/BackupTab.tsx:15 — BackupTab.BackupTab has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 15 of the 32 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 176, handleSaveConfig, a function literal at line 206, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · OverlayHost.OverlayHost (cyclomatic 32) · ×1
  • OverlayHost.OverlayHost (cyclomatic 32) desktop/src/components/layout/OverlayHost.tsx:69 — OverlayHost.OverlayHost has cyclomatic complexity 32 (threshold 15). Of this number, 16 points are the body's own statements and 16 belong to 7 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · apply.apply_entries (cyclomatic 31) · ×1
  • apply.apply_entries (cyclomatic 31) backend/core/brain_bootstrap/apply.py:474 — apply.apply_entries 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 · prompt_builder._render_ui_context_section (cyclomatic 31) · ×1
  • prompt_builder._render_ui_context_section (cyclomatic 31) REDACTED:395 — prompt_builder._render_ui_context_section 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 · repo_guidance._judge (cyclomatic 31) · ×1
  • repo_guidance._judge (cyclomatic 31) backend/core/repo_guidance.py:401 — repo_guidance._judge 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 · runtime_hooks._segment_runs_tests (cyclomatic 31) · ×1
  • runtime_hooks._segment_runs_tests (cyclomatic 31) backend/core/runtime_hooks.py:219 — runtime_hooks._segment_runs_tests 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 · security_hooks._audit_inline_code (cyclomatic 31) · ×1
  • security_hooks._audit_inline_code (cyclomatic 31) backend/core/security_hooks.py:5706 — security_hooks._audit_inline_code 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 · task_repos._one (cyclomatic 31) · ×1
  • task_repos._one (cyclomatic 31) backend/core/task_repos.py:330 — task_repos._one 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 · ChannelsTab.ChannelsTab (cyclomatic 31) · ×1
  • ChannelsTab.ChannelsTab (cyclomatic 31) desktop/src/components/settings/ChannelsTab.tsx:14 — ChannelsTab.ChannelsTab has cyclomatic complexity 31 (threshold 15). Of this number, 26 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · FileEditorCore.DiffView (cyclomatic 31) · ×1
  • FileEditorCore.DiffView (cyclomatic 31) desktop/src/components/common/FileEditorCore.tsx:457 — FileEditorCore.DiffView has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 11 of the 31 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 495, 478, 560). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · turnControls.sendWhileBusy (cyclomatic 31) · ×1
  • turnControls.sendWhileBusy (cyclomatic 31) desktop/src/pages/chat/turnControls.ts:113 — turnControls.sendWhileBusy has cyclomatic complexity 31 (threshold 15). Of this number, 19 points are the body's own statements and 12 belong to 4 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 · clustering.compute_graph_clusters (cyclomatic 30) · ×1
  • clustering.compute_graph_clusters (cyclomatic 30) backend/core/code_intel/clustering.py:74 — clustering.compute_graph_clusters 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 · parser.scan_imports (cyclomatic 30) · ×1
  • parser.scan_imports (cyclomatic 30) backend/core/code_intel/parser.py:906 — parser.scan_imports 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 · ContextDirectoryLoader.ensure_directory (cyclomatic 30) · ×1
  • ContextDirectoryLoader.ensure_directory (cyclomatic 30) backend/core/context_directory_loader.py:625 — ContextDirectoryLoader.ensure_directory 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 · PluginManager.install_plugin (cyclomatic 30) · ×1
  • PluginManager.install_plugin (cyclomatic 30) backend/core/plugin_manager.py:696 — PluginManager.install_plugin 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 · SessionEventHub.subscribe (cyclomatic 30) · ×1
  • SessionEventHub.subscribe (cyclomatic 30) backend/core/session_events.py:392 — SessionEventHub.subscribe 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 · swarm_out_wait_card.card (cyclomatic 30) · ×1
  • swarm_out_wait_card.card (cyclomatic 30) backend/core/swarm_out_wait_card.py:148 — swarm_out_wait_card.card 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 · bash_misuse_report.scan (cyclomatic 30) · ×1
  • bash_misuse_report.scan (cyclomatic 30) backend/scripts/bash_misuse_report.py:125 — bash_misuse_report.scan 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 · eval_runner.cmd_run (cyclomatic 30) · ×1
  • eval_runner.cmd_run (cyclomatic 30) backend/scripts/eval_runner.py:3199 — eval_runner.cmd_run 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 · LibraryTree.LibraryTree (cyclomatic 30) · ×1
  • LibraryTree.LibraryTree (cyclomatic 30) desktop/src/components/layout/LibraryTree.tsx:219 — LibraryTree.LibraryTree has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 12 of the 30 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 238, 280, 299, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · FilePreviewModal.FilePreviewModal (cyclomatic 30) · ×1
  • FilePreviewModal.FilePreviewModal (cyclomatic 30) desktop/src/components/workspace/FilePreviewModal.tsx:50 — FilePreviewModal.FilePreviewModal has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 12 of the 30 points are its own statements and the rest belongs to 2 function items inside it that branch (renderContent, a function literal at line 82). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · status.north_star (cyclomatic 29) · ×1
  • status.north_star (cyclomatic 29) backend/core/ingestion/status.py:94 — status.north_star 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 · PluginManager._install_from_marketplace_json (cyclomatic 29) · ×1
  • PluginManager._install_from_marketplace_json (cyclomatic 29) backend/core/plugin_manager.py:522 — PluginManager._install_from_marketplace_json 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 · RetryManager._retry_loop (cyclomatic 29) · ×1
  • RetryManager._retry_loop (cyclomatic 29) backend/core/retry_manager.py:340 — RetryManager._retry_loop 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 · RunEngine._review_facts (cyclomatic 29) · ×1
  • RunEngine._review_facts (cyclomatic 29) backend/core/run_protocol/engine.py:956 — RunEngine._review_facts 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 · provenance.sync_run_evidence (cyclomatic 29) · ×1
  • provenance.sync_run_evidence (cyclomatic 29) backend/core/run_protocol/provenance.py:52 — provenance.sync_run_evidence 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 · subagent_transcript.spawn_evidence (cyclomatic 29) · ×1
  • subagent_transcript.spawn_evidence (cyclomatic 29) backend/core/subagent_transcript.py:135 — subagent_transcript.spawn_evidence 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 · swarm_out._open_asks (cyclomatic 29) · ×1
  • swarm_out._open_asks (cyclomatic 29) backend/core/swarm_out.py:1286 — swarm_out._open_asks 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 · swarm_out_actor.row_blocker (cyclomatic 29) · ×1
  • swarm_out_actor.row_blocker (cyclomatic 29) backend/core/swarm_out_actor.py:111 — swarm_out_actor.row_blocker 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 · SQLiteDatabase._run_legacy_migrations (cyclomatic 29) · ×1
  • SQLiteDatabase._run_legacy_migrations (cyclomatic 29) backend/database/sqlite.py:3607 — SQLiteDatabase._run_legacy_migrations 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 · memory_health.run_memory_health (cyclomatic 29) · ×1
  • memory_health.run_memory_health (cyclomatic 29) backend/jobs/handlers/memory_health.py:137 — memory_health.run_memory_health 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 · settings.update_app_configuration (cyclomatic 29) · ×1
  • settings.update_app_configuration (cyclomatic 29) backend/routers/settings.py:299 — settings.update_app_configuration 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 · memory_relocate.run (cyclomatic 29) · ×1
  • memory_relocate.run (cyclomatic 29) backend/scripts/memory_relocate.py:196 — memory_relocate.run 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 · migrate_followups_to_todos.checked (cyclomatic 29) · ×1
  • migrate_followups_to_todos.checked (cyclomatic 29) backend/scripts/migrate_followups_to_todos.py:376 — migrate_followups_to_todos.checked has cyclomatic complexity 29 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · recalc.recalc (cyclomatic 29) · ×1
  • recalc.recalc (cyclomatic 29) backend/skills/s_xlsx/recalc.py:53 — recalc.recalc 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 · UpdateNotification.UpdateNotification (cyclomatic 29) · ×1
  • UpdateNotification.UpdateNotification (cyclomatic 29) desktop/src/components/common/UpdateNotification.tsx:17 — UpdateNotification.UpdateNotification has cyclomatic complexity 29 (threshold 15). Of this number, 22 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodeGraph.CodeGraph (cyclomatic 29) · ×1
  • CodeGraph.CodeGraph (cyclomatic 29) desktop/src/components/code-intel/CodeGraph.tsx:81 — CodeGraph.CodeGraph has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 10 of the 29 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 174, 162, 106, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ToDoOverlay.ToDoContent (cyclomatic 29) · ×1
  • ToDoOverlay.ToDoContent (cyclomatic 29) desktop/src/components/layout/ToDoOverlay.tsx:195 — ToDoOverlay.ToDoContent has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 12 of the 29 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 287, 234, 250, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · HiveBrains.HiveBrains (cyclomatic 29) · ×1
  • HiveBrains.HiveBrains (cyclomatic 29) desktop/src/components/settings/HiveBrains.tsx:58 — HiveBrains.HiveBrains has cyclomatic complexity 29 (threshold 15). Of this number, 18 points are the body's own statements and 11 belong to 4 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · FileTypes._scan_method (cyclomatic 28) · ×1
  • FileTypes._scan_method (cyclomatic 28) backend/core/code_intel/receivers.py:759 — FileTypes._scan_method 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 · ContextDirectoryLoader._assemble_from_sources (cyclomatic 28) · ×1
  • ContextDirectoryLoader._assemble_from_sources (cyclomatic 28) backend/core/context_directory_loader.py:951 — ContextDirectoryLoader._assemble_from_sources 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 · ReviewOrchestrator.render_fixing_passes (cyclomatic 28) · ×1
  • ReviewOrchestrator.render_fixing_passes (cyclomatic 28) backend/core/run_protocol/review.py:1051 — ReviewOrchestrator.render_fixing_passes 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 · SessionRouter._persist_stream_event (cyclomatic 28) · ×1
  • SessionRouter._persist_stream_event (cyclomatic 28) backend/core/session_router.py:2598 — SessionRouter._persist_stream_event 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 · session_router._maybe_inject_recall_inner (cyclomatic 28) · ×1
  • session_router._maybe_inject_recall_inner (cyclomatic 28) backend/core/session_router.py:1400 — session_router._maybe_inject_recall_inner 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 · Bridge._valid (cyclomatic 28) · ×1
  • Bridge._valid (cyclomatic 28) REDACTED:277 — Bridge._valid 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 · ddd_weekly_report._generate_report (cyclomatic 28) · ×1
  • ddd_weekly_report._generate_report (cyclomatic 28) backend/jobs/handlers/ddd_weekly_report.py:182 — ddd_weekly_report._generate_report 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 · channels.update_channel (cyclomatic 28) · ×1
  • channels.update_channel (cyclomatic 28) backend/routers/channels.py:180 — channels.update_channel 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 · design_system.format_ascii_box (cyclomatic 28) · ×1
  • design_system.format_ascii_box (cyclomatic 28) backend/skills/s_frontend-design/scripts/design_system.py:282 — design_system.format_ascii_box has cyclomatic complexity 28 (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 · ParagraphData.__init__ (cyclomatic 28) · ×1
  • ParagraphData.__init__ (cyclomatic 28) backend/skills/s_pptx/scripts/inventory.py:140 — ParagraphData.__init__ 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 · SlidePreview.SlidePreview (cyclomatic 28) · ×1
  • SlidePreview.SlidePreview (cyclomatic 28) REDACTED:274 — SlidePreview.SlidePreview has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 2 of the 28 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 296, 366, 284, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · sessionTurnRouter.routePostEvent (cyclomatic 28) · ×1
  • sessionTurnRouter.routePostEvent (cyclomatic 28) desktop/src/hooks/sessionTurnRouter.ts:162 — sessionTurnRouter.routePostEvent 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 · ChangesCard.ChangeRow (cyclomatic 28) · ×1
  • ChangesCard.ChangeRow (cyclomatic 28) desktop/src/pages/chat/components/ChangesCard.tsx:84 — ChangesCard.ChangeRow has cyclomatic complexity 28 (threshold 15). Of this number, 18 points are the body's own statements and 10 belong to 5 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · RunList.Row (cyclomatic 28) · ×1
  • RunList.Row (cyclomatic 28) desktop/src/components/swarm-out/RunList.tsx:63 — RunList.Row has cyclomatic complexity 28 (threshold 15). Of this number, 25 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BrainHub.DistributeView (cyclomatic 28) · ×1
  • BrainHub.DistributeView (cyclomatic 28) desktop/src/components/layout/BrainHub.tsx:1082 — BrainHub.DistributeView has cyclomatic complexity 28 (threshold 15). Of this number, 21 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CasesTab.CasesTab (cyclomatic 28) · ×1
  • CasesTab.CasesTab (cyclomatic 28) desktop/src/pages/eval/CasesTab.tsx:39 — CasesTab.CasesTab has cyclomatic complexity 28 (threshold 15). Of this number, 21 points are the body's own statements and 7 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 · useVoiceRecorder.useVoiceRecorder.startRecording (cyclomatic 28) · ×1
  • useVoiceRecorder.useVoiceRecorder.startRecording (cyclomatic 28) desktop/src/hooks/useVoiceRecorder.ts:99 — useVoiceRecorder.useVoiceRecorder.startRecording has cyclomatic complexity 28 (threshold 15). Of this number, 17 points are the body's own statements and 11 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · TSCCModules.SystemPromptModule (cyclomatic 28) · ×1
  • TSCCModules.SystemPromptModule (cyclomatic 28) desktop/src/pages/chat/components/TSCCModules.tsx:653 — TSCCModules.SystemPromptModule has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 10 of the 28 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 712, 662, 725, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · attention_authority._collect_swarm_out (cyclomatic 27) · ×1
  • attention_authority._collect_swarm_out (cyclomatic 27) backend/core/attention_authority.py:781 — attention_authority._collect_swarm_out 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 · context_injector.build_resume_context (cyclomatic 27) · ×1
  • context_injector.build_resume_context (cyclomatic 27) backend/core/context_injector.py:1233 — context_injector.build_resume_context 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 · ddd_packager.package_ddd (cyclomatic 27) · ×1
  • ddd_packager.package_ddd (cyclomatic 27) backend/core/ddd_packager.py:1867 — ddd_packager.package_ddd 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 · flow_view.list_units (cyclomatic 27) · ×1
  • flow_view.list_units (cyclomatic 27) backend/core/ingestion/flow_view.py:351 — flow_view.list_units 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 · governed_edit.apply_sync (cyclomatic 27) · ×1
  • governed_edit.apply_sync (cyclomatic 27) backend/core/ingestion/governed_edit.py:753 — governed_edit.apply_sync 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 · north_star._cdf (cyclomatic 27) · ×1
  • north_star._cdf (cyclomatic 27) backend/core/north_star.py:105 — north_star._cdf has cyclomatic complexity 27 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · checks._report_check (cyclomatic 27) · ×1
  • checks._report_check (cyclomatic 27) backend/core/run_protocol/checks.py:321 — checks._report_check 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 · RunEngine.review_proof (cyclomatic 27) · ×1
  • RunEngine.review_proof (cyclomatic 27) backend/core/run_protocol/engine.py:1697 — RunEngine.review_proof 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 · run_worktree.sweep (cyclomatic 27) · ×1
  • run_worktree.sweep (cyclomatic 27) backend/core/run_worktree.py:1782 — run_worktree.sweep 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 · security_hooks._reads_script_from_stdin (cyclomatic 27) · ×1
  • security_hooks._reads_script_from_stdin (cyclomatic 27) backend/core/security_hooks.py:1337 — security_hooks._reads_script_from_stdin 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 · security_hooks._single_commit_only_paths (cyclomatic 27) · ×1
  • security_hooks._single_commit_only_paths (cyclomatic 27) backend/core/security_hooks.py:3246 — security_hooks._single_commit_only_paths 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 · swarm_out_results.public (cyclomatic 27) · ×1
  • swarm_out_results.public (cyclomatic 27) backend/core/swarm_out_results.py:1234 — swarm_out_results.public 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 · executor._handle_agent_task (cyclomatic 27) · ×1
  • executor._handle_agent_task (cyclomatic 27) REDACTED:760 — executor._handle_agent_task 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 · session_quality.run_session_quality (cyclomatic 27) · ×1
  • session_quality.run_session_quality (cyclomatic 27) backend/jobs/handlers/session_quality.py:414 — session_quality.run_session_quality has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · eval_runner.bootstrap_counts (cyclomatic 27) · ×1
  • eval_runner.bootstrap_counts (cyclomatic 27) backend/scripts/eval_runner.py:1795 — eval_runner.bootstrap_counts 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 · turnView.isReadOnlySegment (cyclomatic 27) · ×1
  • turnView.isReadOnlySegment (cyclomatic 27) REDACTED:814 — turnView.isReadOnlySegment 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 · canvas_surface.is_canvas_surfaceable (cyclomatic 26) · ×1
  • canvas_surface.is_canvas_surfaceable (cyclomatic 26) backend/core/canvas_surface.py:111 — canvas_surface.is_canvas_surfaceable 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 · impact.render (cyclomatic 26) · ×1
  • impact.render (cyclomatic 26) backend/core/code_intel/impact.py:211 — impact.render 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 · context_injector._extract_key_tool_results (cyclomatic 26) · ×1
  • context_injector._extract_key_tool_results (cyclomatic 26) backend/core/context_injector.py:713 — context_injector._extract_key_tool_results 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 · file_change_classifier.parse_bash_delete_targets (cyclomatic 26) · ×1
  • file_change_classifier.parse_bash_delete_targets (cyclomatic 26) backend/core/file_change_classifier.py:268 — file_change_classifier.parse_bash_delete_targets 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 · hook_builder.build_hooks (cyclomatic 26) · ×1
  • hook_builder.build_hooks (cyclomatic 26) backend/core/hook_builder.py:309 — hook_builder.build_hooks 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 · flow_view.landed_overview (cyclomatic 26) · ×1
  • flow_view.landed_overview (cyclomatic 26) backend/core/ingestion/flow_view.py:201 — flow_view.landed_overview 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 · s7_review.knowledge_view (cyclomatic 26) · ×1
  • s7_review.knowledge_view (cyclomatic 26) backend/core/ingestion/sources/s7_review.py:213 — s7_review.knowledge_view 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 · usage._observe_bash_read (cyclomatic 26) · ×1
  • usage._observe_bash_read (cyclomatic 26) backend/core/ingestion/usage.py:350 — usage._observe_bash_read 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 · recall_filter.filter_recall (cyclomatic 26) · ×1
  • recall_filter.filter_recall (cyclomatic 26) backend/core/recall_filter.py:398 — recall_filter.filter_recall 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 · run_owner_gate._decide (cyclomatic 26) · ×1
  • run_owner_gate._decide (cyclomatic 26) backend/core/run_owner_gate.py:512 — run_owner_gate._decide 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 · child_cli._clean_plan (cyclomatic 26) · ×1
  • child_cli._clean_plan (cyclomatic 26) backend/core/run_protocol/child_cli.py:115 — child_cli._clean_plan 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 · decision.validate (cyclomatic 26) · ×1
  • decision.validate (cyclomatic 26) backend/core/run_protocol/decision.py:41 — decision.validate has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RunEngine.review_address (cyclomatic 26) · ×1
  • RunEngine.review_address (cyclomatic 26) backend/core/run_protocol/engine.py:1334 — RunEngine.review_address 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 · schemas.validate_design_spec (cyclomatic 26) · ×1
  • schemas.validate_design_spec (cyclomatic 26) backend/core/run_protocol/schemas.py:505 — schemas.validate_design_spec 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 · run_worktree._signed_view (cyclomatic 26) · ×1
  • run_worktree._signed_view (cyclomatic 26) backend/core/run_worktree.py:1431 — run_worktree._signed_view 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 · security_hooks._dangerous_rm_segment (cyclomatic 26) · ×1
  • security_hooks._dangerous_rm_segment (cyclomatic 26) backend/core/security_hooks.py:225 — security_hooks._dangerous_rm_segment 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 · security_hooks._segment_reserved (cyclomatic 26) · ×1
  • security_hooks._segment_reserved (cyclomatic 26) backend/core/security_hooks.py:726 — security_hooks._segment_reserved 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 · security_hooks._unwrap_program (cyclomatic 26) · ×1
  • security_hooks._unwrap_program (cyclomatic 26) backend/core/security_hooks.py:4108 — security_hooks._unwrap_program 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 · security_hooks._env_session_link (cyclomatic 26) · ×1
  • security_hooks._env_session_link (cyclomatic 26) backend/core/security_hooks.py:4592 — security_hooks._env_session_link 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 · SessionRouter._published_events (cyclomatic 26) · ×1
  • SessionRouter._published_events (cyclomatic 26) backend/core/session_router.py:4163 — SessionRouter._published_events 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 · swarm_out_follow.digest (cyclomatic 26) · ×1
  • swarm_out_follow.digest (cyclomatic 26) backend/core/swarm_out_follow.py:274 — swarm_out_follow.digest 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 · swarm_out_results._fetch (cyclomatic 26) · ×1
  • swarm_out_results._fetch (cyclomatic 26) backend/core/swarm_out_results.py:700 — swarm_out_results._fetch 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 · task_repos.parse (cyclomatic 26) · ×1
  • task_repos.parse (cyclomatic 26) backend/core/task_repos.py:112 — task_repos.parse 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 · CliResults.rows (cyclomatic 26) · ×1
  • CliResults.rows (cyclomatic 26) backend/core/usage_accounting.py:174 — CliResults.rows 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 · worktree_write_gate.judge (cyclomatic 26) · ×1
  • worktree_write_gate.judge (cyclomatic 26) backend/core/worktree_write_gate.py:526 — worktree_write_gate.judge 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 · brain_mistake_audit.run_brain_mistake_audit (cyclomatic 26) · ×1
  • brain_mistake_audit.run_brain_mistake_audit (cyclomatic 26) backend/jobs/handlers/brain_mistake_audit.py:625 — brain_mistake_audit.run_brain_mistake_audit 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 · context_recall_cli.main (cyclomatic 26) · ×1
  • context_recall_cli.main (cyclomatic 26) backend/scripts/context_recall_cli.py:57 — context_recall_cli.main 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 · recall_replay.cmd_score (cyclomatic 26) · ×1
  • recall_replay.cmd_score (cyclomatic 26) backend/scripts/recall_replay.py:331 — recall_replay.cmd_score 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 · polly.synthesize (cyclomatic 26) · ×1
  • polly.synthesize (cyclomatic 26) backend/skills/s_pollinate/scripts/tts/backends/polly.py:246 — polly.synthesize 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 · compaction.applyCompactionEvent (cyclomatic 26) · ×1
  • compaction.applyCompactionEvent (cyclomatic 26) desktop/src/pages/chat/compaction.ts:115 — compaction.applyCompactionEvent has cyclomatic complexity 26 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · uiCommands.dispatchUiCommand (cyclomatic 26) · ×1
  • uiCommands.dispatchUiCommand (cyclomatic 26) desktop/src/utils/uiCommands.ts:127 — uiCommands.dispatchUiCommand 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 · live.workLines (cyclomatic 26) · ×1
  • live.workLines (cyclomatic 26) desktop/src/components/swarm-out/live.ts:258 — live.workLines 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 · PdfRenderer.PdfRenderer (cyclomatic 26) · ×1
  • PdfRenderer.PdfRenderer (cyclomatic 26) desktop/src/components/file-viewer/renderers/PdfRenderer.tsx:45 — PdfRenderer.PdfRenderer has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 9 of the 26 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 169, 61, 94, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · parser._extract_from_tree (cyclomatic 25) · ×1
  • parser._extract_from_tree (cyclomatic 25) backend/core/code_intel/parser.py:1168 — parser._extract_from_tree 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 · eval_followups._online (cyclomatic 25) · ×1
  • eval_followups._online (cyclomatic 25) backend/core/eval_followups.py:281 — eval_followups._online 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 · queries.brain_changes (cyclomatic 25) · ×1
  • queries.brain_changes (cyclomatic 25) backend/core/ingestion/queries.py:567 — queries.brain_changes 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 · leak_transcript._clean_line (cyclomatic 25) · ×1
  • leak_transcript._clean_line (cyclomatic 25) backend/core/leak_transcript.py:124 — leak_transcript._clean_line 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 · RunEngine.execute_authorized_action (cyclomatic 25) · ×1
  • RunEngine.execute_authorized_action (cyclomatic 25) backend/core/run_protocol/engine.py:2278 — RunEngine.execute_authorized_action 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 · security_hooks._rm_segment_is_dangerous (cyclomatic 25) · ×1
  • security_hooks._rm_segment_is_dangerous (cyclomatic 25) backend/core/security_hooks.py:309 — security_hooks._rm_segment_is_dangerous 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 · security_hooks.v1_land_card (cyclomatic 25) · ×1
  • security_hooks.v1_land_card (cyclomatic 25) backend/core/security_hooks.py:467 — security_hooks.v1_land_card 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 · security_hooks._discard_dirs (cyclomatic 25) · ×1
  • security_hooks._discard_dirs (cyclomatic 25) backend/core/security_hooks.py:1449 — security_hooks._discard_dirs 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 · session_health_probe.session_health_probe (cyclomatic 25) · ×1
  • session_health_probe.session_health_probe (cyclomatic 25) backend/core/session_health_probe.py:197 — session_health_probe.session_health_probe has cyclomatic complexity 25 (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 · SummarizationPipeline._extract_files_modified (cyclomatic 25) · ×1
  • SummarizationPipeline._extract_files_modified (cyclomatic 25) backend/core/summarization.py:457 — SummarizationPipeline._extract_files_modified 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 · skill_metrics_hook._detect_skill_invocations (cyclomatic 25) · ×1
  • skill_metrics_hook._detect_skill_invocations (cyclomatic 25) backend/hooks/skill_metrics_hook.py:108 — skill_metrics_hook._detect_skill_invocations 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 · chat.get_session_messages (cyclomatic 25) · ×1
  • chat.get_session_messages (cyclomatic 25) backend/routers/chat.py:1185 — chat.get_session_messages 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 · pptx_to_deck.extract (cyclomatic 25) · ×1
  • pptx_to_deck.extract (cyclomatic 25) backend/skills/s_pollinate/scripts/pptx_to_deck.py:36 — pptx_to_deck.extract 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 · sections.match_section_times (cyclomatic 25) · ×1
  • sections.match_section_times (cyclomatic 25) backend/skills/s_pollinate/scripts/tts/sections.py:86 — sections.match_section_times 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 · sessionTurnRouter.routeSubEvent (cyclomatic 25) · ×1
  • sessionTurnRouter.routeSubEvent (cyclomatic 25) desktop/src/hooks/sessionTurnRouter.ts:217 — sessionTurnRouter.routeSubEvent 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 · turnZones.layOut (cyclomatic 25) · ×1
  • turnZones.layOut (cyclomatic 25) desktop/src/pages/chat/turnZones.ts:138 — turnZones.layOut 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 · UserMessageView.UserMessageView (cyclomatic 25) · ×1
  • UserMessageView.UserMessageView (cyclomatic 25) desktop/src/pages/chat/components/UserMessageView.tsx:55 — UserMessageView.UserMessageView has cyclomatic complexity 25 (threshold 15). Of this number, 21 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · BrainHubHome.BrainHubHome (cyclomatic 25) · ×1
  • BrainHubHome.BrainHubHome (cyclomatic 25) desktop/src/components/layout/BrainHubHome.tsx:169 — BrainHubHome.BrainHubHome has cyclomatic complexity 25 (threshold 15). Of this number, 19 points are the body's own statements and 6 belong to 4 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · BrainLearnedView.Entry (cyclomatic 25) · ×1
  • BrainLearnedView.Entry (cyclomatic 25) desktop/src/components/layout/BrainLearnedView.tsx:199 — BrainLearnedView.Entry has cyclomatic complexity 25 (threshold 15). Of this number, 19 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 · apply.validate (cyclomatic 24) · ×1
  • apply.validate (cyclomatic 24) backend/core/brain_bootstrap/apply.py:206 — apply.validate 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 · docs.rank (cyclomatic 24) · ×1
  • docs.rank (cyclomatic 24) backend/core/brain_bootstrap/docs.py:217 — docs.rank 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 · docs._api_summary (cyclomatic 24) · ×1
  • docs._api_summary (cyclomatic 24) backend/core/brain_bootstrap/docs.py:380 — docs._api_summary 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 · _ClaudeClientWrapper._extract_pid (cyclomatic 24) · ×1
  • _ClaudeClientWrapper._extract_pid (cyclomatic 24) backend/core/claude_environment.py:78 — _ClaudeClientWrapper._extract_pid 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 · local_roots.migrate_once (cyclomatic 24) · ×1
  • local_roots.migrate_once (cyclomatic 24) backend/core/code_intel/local_roots.py:379 — local_roots.migrate_once 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 · ddd_entry_lifecycle.parse_entries (cyclomatic 24) · ×1
  • ddd_entry_lifecycle.parse_entries (cyclomatic 24) backend/core/ddd_entry_lifecycle.py:728 — ddd_entry_lifecycle.parse_entries 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 · eval_release.decide_release (cyclomatic 24) · ×1
  • eval_release.decide_release (cyclomatic 24) backend/core/eval_release.py:120 — eval_release.decide_release 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 · eval_log.export (cyclomatic 24) · ×1
  • eval_log.export (cyclomatic 24) backend/core/ingestion/eval_log.py:98 — eval_log.export 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 · writer._execute_plan (cyclomatic 24) · ×1
  • writer._execute_plan (cyclomatic 24) backend/core/ingestion/writer.py:842 — writer._execute_plan 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 · cli_main._localize (cyclomatic 24) · ×1
  • cli_main._localize (cyclomatic 24) backend/core/run_protocol/cli_main.py:28 — cli_main._localize 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 · findings._proof (cyclomatic 24) · ×1
  • findings._proof (cyclomatic 24) backend/core/run_protocol/findings.py:229 — findings._proof 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 · ReviewOrchestrator.render_review (cyclomatic 24) · ×1
  • ReviewOrchestrator.render_review (cyclomatic 24) backend/core/run_protocol/review.py:1000 — ReviewOrchestrator.render_review 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 · review.r2_ledger (cyclomatic 24) · ×1
  • review.r2_ledger (cyclomatic 24) backend/core/run_protocol/review.py:40 — review.r2_ledger 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 · trace.matrix (cyclomatic 24) · ×1
  • trace.matrix (cyclomatic 24) backend/core/run_protocol/trace.py:19 — trace.matrix 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 · session_router._inject_ddd_for_active_project (cyclomatic 24) · ×1
  • session_router._inject_ddd_for_active_project (cyclomatic 24) backend/core/session_router.py:1914 — session_router._inject_ddd_for_active_project 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 · SessionUnit._spawn (cyclomatic 24) · ×1
  • SessionUnit._spawn (cyclomatic 24) backend/core/session_unit.py:3896 — SessionUnit._spawn 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 · chat.sse_with_heartbeat (cyclomatic 24) · ×1
  • chat.sse_with_heartbeat (cyclomatic 24) backend/routers/chat.py:173 — chat.sse_with_heartbeat 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 · tscc.get_security_scan (cyclomatic 24) · ×1
  • tscc.get_security_scan (cyclomatic 24) backend/routers/tscc.py:159 — tscc.get_security_scan 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 · clean_daily_activity._merge_entries (cyclomatic 24) · ×1
  • clean_daily_activity._merge_entries (cyclomatic 24) backend/scripts/clean_daily_activity.py:134 — clean_daily_activity._merge_entries 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 · replace.apply_replacements (cyclomatic 24) · ×1
  • replace.apply_replacements (cyclomatic 24) backend/skills/s_pptx/scripts/replace.py:214 — replace.apply_replacements 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 · ai_ready_helpers.compute_business_rules_dimension (cyclomatic 24) · ×1
  • ai_ready_helpers.compute_business_rules_dimension (cyclomatic 24) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2090 — ai_ready_helpers.compute_business_rules_dimension 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 · html2pptx.addElements (cyclomatic 24) · ×1
  • html2pptx.addElements (cyclomatic 24) backend/skills/s_pptx/scripts/html2pptx.js:133 — html2pptx.addElements 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 · useChatStreamingLifecycle.useChatStreamingLifecycle.surfacePendingPermission (cyclomatic 24) · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle.surfacePendingPermission (cyclomatic 24) desktop/src/hooks/useChatStreamingLifecycle.ts:2196 — useChatStreamingLifecycle.useChatStreamingLifecycle.surfacePendingPermission has cyclomatic complexity 24 (threshold 15). Of this number, 19 points are the body's own statements and 5 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 · useChatStreamingLifecycle.useChatStreamingLifecycle.applySteerRead (cyclomatic 24) · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle.applySteerRead (cyclomatic 24) desktop/src/hooks/useChatStreamingLifecycle.ts:2538 — useChatStreamingLifecycle.useChatStreamingLifecycle.applySteerRead 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · turnView.deriveTurnView · ×1
  • turnView.deriveTurnView::pushToolStep (cyclomatic 24) REDACTED:431 — turnView.deriveTurnView::pushToolStep has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (turnView.deriveTurnView) 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 · pipelineRows.fromLocal (cyclomatic 24) · ×1
  • pipelineRows.fromLocal (cyclomatic 24) desktop/src/components/layout/pipelineRows.ts:70 — pipelineRows.fromLocal 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 · ConnectAccount.SsoPick (cyclomatic 24) · ×1
  • ConnectAccount.SsoPick (cyclomatic 24) desktop/src/components/awsAccount/ConnectAccount.tsx:783 — ConnectAccount.SsoPick has cyclomatic complexity 24 (threshold 15). Of this number, 15 points are the body's own statements and 9 belong to 4 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AboutTab.AboutTab (cyclomatic 24) · ×1
  • AboutTab.AboutTab (cyclomatic 24) desktop/src/components/settings/AboutTab.tsx:25 — AboutTab.AboutTab has cyclomatic complexity 24 (threshold 15). Of this number, 15 points are the body's own statements and 9 belong to 4 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · FileViewer.FileViewerImpl · ×1
  • FileViewer.FileViewerImpl::renderActiveContent (cyclomatic 24) desktop/src/components/file-viewer/FileViewer.tsx:760 — FileViewer.FileViewerImpl::renderActiveContent 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 · SlackChannelAdapter._text_to_blocks (cyclomatic 23) · ×1
  • SlackChannelAdapter._text_to_blocks (cyclomatic 23) REDACTED:1945 — SlackChannelAdapter._text_to_blocks 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 · aws_permissions.run_hive_checks (cyclomatic 23) · ×1
  • aws_permissions.run_hive_checks (cyclomatic 23) backend/core/aws_permissions.py:277 — aws_permissions.run_hive_checks 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 · survey._guard_parts (cyclomatic 23) · ×1
  • survey._guard_parts (cyclomatic 23) backend/core/brain_bootstrap/survey.py:302 — survey._guard_parts 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 · interface._java_scan_types (cyclomatic 23) · ×1
  • interface._java_scan_types (cyclomatic 23) backend/core/code_intel/interface.py:347 — interface._java_scan_types 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 · interface.breaks (cyclomatic 23) · ×1
  • interface.breaks (cyclomatic 23) backend/core/code_intel/interface.py:842 — interface.breaks 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 · context_injector._extract_tool_summary (cyclomatic 23) · ×1
  • context_injector._extract_tool_summary (cyclomatic 23) backend/core/context_injector.py:259 — context_injector._extract_tool_summary 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 · file_change_classifier.parse_bash_write_targets (cyclomatic 23) · ×1
  • file_change_classifier.parse_bash_write_targets (cyclomatic 23) backend/core/file_change_classifier.py:99 — file_change_classifier.parse_bash_write_targets 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 · health.run_checks (cyclomatic 23) · ×1
  • health.run_checks (cyclomatic 23) backend/core/ingestion/health.py:653 — health.run_checks 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 · LifecycleManager._check_streaming_timeout (cyclomatic 23) · ×1
  • LifecycleManager._check_streaming_timeout (cyclomatic 23) backend/core/lifecycle_manager.py:643 — LifecycleManager._check_streaming_timeout 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 · LifecycleManager._check_memory_pressure (cyclomatic 23) · ×1
  • LifecycleManager._check_memory_pressure (cyclomatic 23) backend/core/lifecycle_manager.py:1571 — LifecycleManager._check_memory_pressure 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 · recall_multi.render_recall_body (cyclomatic 23) · ×1
  • recall_multi.render_recall_body (cyclomatic 23) backend/core/recall_multi.py:675 — recall_multi.render_recall_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 · recall_multi._render_domain_hits (cyclomatic 23) · ×1
  • recall_multi._render_domain_hits (cyclomatic 23) backend/core/recall_multi.py:747 — recall_multi._render_domain_hits 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 · security_hooks._audit_segment_hit (cyclomatic 23) · ×1
  • security_hooks._audit_segment_hit (cyclomatic 23) backend/core/security_hooks.py:5844 — security_hooks._audit_segment_hit 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 · SessionUnit.begin_stop_receipt (cyclomatic 23) · ×1
  • SessionUnit.begin_stop_receipt (cyclomatic 23) backend/core/session_unit.py:4408 — SessionUnit.begin_stop_receipt 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 · session_utils.classify_failure (cyclomatic 23) · ×1
  • session_utils.classify_failure (cyclomatic 23) backend/core/session_utils.py:75 — session_utils.classify_failure 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 · swarm_out._compute_runs (cyclomatic 23) · ×1
  • swarm_out._compute_runs (cyclomatic 23) backend/core/swarm_out.py:1801 — swarm_out._compute_runs 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 · swarm_out_results._repo_fact (cyclomatic 23) · ×1
  • swarm_out_results._repo_fact (cyclomatic 23) backend/core/swarm_out_results.py:104 — swarm_out_results._repo_fact 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 · swarm_out_results.spend_of (cyclomatic 23) · ×1
  • swarm_out_results.spend_of (cyclomatic 23) backend/core/swarm_out_results.py:1144 — swarm_out_results.spend_of 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 · swarm_run.child_report (cyclomatic 23) · ×1
  • swarm_run.child_report (cyclomatic 23) backend/core/swarm_run.py:306 — swarm_run.child_report 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 · bedrock._validate (cyclomatic 23) · ×1
  • bedrock._validate (cyclomatic 23) backend/jobs/bedrock.py:605 — bedrock._validate 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 · artifact_cli.cmd_release_gate (cyclomatic 23) · ×1
  • artifact_cli.cmd_release_gate (cyclomatic 23) backend/scripts/artifact_cli.py:178 — artifact_cli.cmd_release_gate 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 · ci_eval_gate.check_gate (cyclomatic 23) · ×1
  • ci_eval_gate.check_gate (cyclomatic 23) backend/scripts/ci_eval_gate.py:76 — ci_eval_gate.check_gate 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 · eval_runner.evaluate_case (cyclomatic 23) · ×1
  • eval_runner.evaluate_case (cyclomatic 23) backend/scripts/eval_runner.py:1990 — eval_runner.evaluate_case 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 · golden_case_validator._bootstrap_check_errors (cyclomatic 23) · ×1
  • golden_case_validator._bootstrap_check_errors (cyclomatic 23) backend/scripts/golden_case_validator.py:337 — golden_case_validator._bootstrap_check_errors 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 · DocxXMLEditor.suggest_deletion (cyclomatic 23) · ×1
  • DocxXMLEditor.suggest_deletion (cyclomatic 23) backend/skills/s_docx/scripts/document.py:482 — DocxXMLEditor.suggest_deletion 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 · verify_ddd_complete._check_project_agent (cyclomatic 23) · ×1
  • verify_ddd_complete._check_project_agent (cyclomatic 23) backend/skills/s_project-manager/scripts/verify_ddd_complete.py:546 — verify_ddd_complete._check_project_agent 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 · ai_ready_helpers.select_verification_tasks (cyclomatic 23) · ×1
  • ai_ready_helpers.select_verification_tasks (cyclomatic 23) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1443 — ai_ready_helpers.select_verification_tasks 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 · backendIssue.describeBackendIssue (cyclomatic 23) · ×1
  • backendIssue.describeBackendIssue (cyclomatic 23) desktop/src/hooks/backendIssue.ts:108 — backendIssue.describeBackendIssue 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 · TurnZones.stopSummary (cyclomatic 23) · ×1
  • TurnZones.stopSummary (cyclomatic 23) desktop/src/pages/chat/components/TurnZones.tsx:425 — TurnZones.stopSummary has cyclomatic complexity 23 (threshold 15). Of this number, 20 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 · LiveDispatches.LiveDispatches (cyclomatic 23) · ×1
  • LiveDispatches.LiveDispatches (cyclomatic 23) desktop/src/components/swarm-out/LiveDispatches.tsx:330 — LiveDispatches.LiveDispatches has cyclomatic complexity 23 (threshold 15). Of this number, 19 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 · CdfFlowDetails.CdfFlowDetails (cyclomatic 23) · ×1
  • CdfFlowDetails.CdfFlowDetails (cyclomatic 23) desktop/src/components/layout/CdfFlowDetails.tsx:29 — CdfFlowDetails.CdfFlowDetails has cyclomatic complexity 23 (threshold 15). Of this number, 16 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · pipelineRows.fromHive (cyclomatic 23) · ×1
  • pipelineRows.fromHive (cyclomatic 23) desktop/src/components/layout/pipelineRows.ts:96 — pipelineRows.fromHive 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 · BrainMapView.EvalPanel (cyclomatic 23) · ×1
  • BrainMapView.EvalPanel (cyclomatic 23) desktop/src/components/layout/BrainMapView.tsx:459 — BrainMapView.EvalPanel has cyclomatic complexity 23 (threshold 15). Of this number, 19 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SystemTab.SystemTab (cyclomatic 23) · ×1
  • SystemTab.SystemTab (cyclomatic 23) desktop/src/components/settings/SystemTab.tsx:15 — SystemTab.SystemTab has cyclomatic complexity 23 (threshold 15). Of this number, 14 points are the body's own statements and 9 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · useCanvasAutoSurface.useCanvasAutoSurface (cyclomatic 23) · ×1
  • useCanvasAutoSurface.useCanvasAutoSurface (cyclomatic 23) desktop/src/hooks/useCanvasAutoSurface.ts:90 — useCanvasAutoSurface.useCanvasAutoSurface has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 1 of the 23 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 125, 181, 217). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · brain-demo.html.tick (cyclomatic 23) · ×1
  • brain-demo.html.tick (cyclomatic 23) docs/design/brain-demo.html:287 — brain-demo.html.tick 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 · brain-demo.html.renderWiz (cyclomatic 23) · ×1
  • brain-demo.html.renderWiz (cyclomatic 23) docs/design/brain-demo.html:471 — brain-demo.html.renderWiz has cyclomatic complexity 23 (threshold 15). Of this number, 15 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ddd_format.check (cyclomatic 22) · ×1
  • ddd_format.check (cyclomatic 22) backend/core/ddd_format.py:177 — ddd_format.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 · hive_lessons.ingest (cyclomatic 22) · ×1
  • hive_lessons.ingest (cyclomatic 22) backend/core/hive_lessons.py:142 — hive_lessons.ingest 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 · knowledge_cli._find_stores (cyclomatic 22) · ×1
  • knowledge_cli._find_stores (cyclomatic 22) backend/core/knowledge_cli.py:262 — knowledge_cli._find_stores 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 · knowledge_store.sync_knowledge_index (cyclomatic 22) · ×1
  • knowledge_store.sync_knowledge_index (cyclomatic 22) backend/core/knowledge_store.py:861 — knowledge_store.sync_knowledge_index 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 · library_health.scan_library_health (cyclomatic 22) · ×1
  • library_health.scan_library_health (cyclomatic 22) backend/core/library_health.py:102 — library_health.scan_library_health 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 · north_star._cognition (cyclomatic 22) · ×1
  • north_star._cognition (cyclomatic 22) backend/core/north_star.py:49 — north_star._cognition 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 · recall_multi._recall_ddd (cyclomatic 22) · ×1
  • recall_multi._recall_ddd (cyclomatic 22) backend/core/recall_multi.py:1260 — recall_multi._recall_ddd 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 · cli_commands.execute (cyclomatic 22) · ×1
  • cli_commands.execute (cyclomatic 22) backend/core/run_protocol/cli_commands.py:277 — cli_commands.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 · RunEngine._landed_as_check (cyclomatic 22) · ×1
  • RunEngine._landed_as_check (cyclomatic 22) backend/core/run_protocol/engine.py:1976 — RunEngine._landed_as_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 · lifecycle._failed_stage (cyclomatic 22) · ×1
  • lifecycle._failed_stage (cyclomatic 22) backend/core/run_protocol/lifecycle.py:325 — lifecycle._failed_stage 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 · security_hooks._commit_only_mode_pathspecs (cyclomatic 22) · ×1
  • security_hooks._commit_only_mode_pathspecs (cyclomatic 22) backend/core/security_hooks.py:3191 — security_hooks._commit_only_mode_pathspecs 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 · security_hooks._js_pm_shell_c_command (cyclomatic 22) · ×1
  • security_hooks._js_pm_shell_c_command (cyclomatic 22) backend/core/security_hooks.py:4310 — security_hooks._js_pm_shell_c_command 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 · session_router._maybe_followup_recall (cyclomatic 22) · ×1
  • session_router._maybe_followup_recall (cyclomatic 22) backend/core/session_router.py:1264 — session_router._maybe_followup_recall 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 · SessionUnit.compact (cyclomatic 22) · ×1
  • SessionUnit.compact (cyclomatic 22) backend/core/session_unit.py:4918 — SessionUnit.compact 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 · skill_migration.migrate_skill_ids_to_allowed_skills (cyclomatic 22) · ×1
  • skill_migration.migrate_skill_ids_to_allowed_skills (cyclomatic 22) backend/core/skill_migration.py:25 — skill_migration.migrate_skill_ids_to_allowed_skills 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 · swarm_out._prepare_work (cyclomatic 22) · ×1
  • swarm_out._prepare_work (cyclomatic 22) backend/core/swarm_out.py:365 — swarm_out._prepare_work 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 · swarm_out.dispatch (cyclomatic 22) · ×1
  • swarm_out.dispatch (cyclomatic 22) backend/core/swarm_out.py:455 — swarm_out.dispatch 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 · swarm_out_wait_card.answer_as_host (cyclomatic 22) · ×1
  • swarm_out_wait_card.answer_as_host (cyclomatic 22) backend/core/swarm_out_wait_card.py:346 — swarm_out_wait_card.answer_as_host 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 · swarm_run.check_child_dispatch (cyclomatic 22) · ×1
  • swarm_run.check_child_dispatch (cyclomatic 22) backend/core/swarm_run.py:142 — swarm_run.check_child_dispatch 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 · worktree_write_gate._git_segments (cyclomatic 22) · ×1
  • worktree_write_gate._git_segments (cyclomatic 22) backend/core/worktree_write_gate.py:359 — worktree_write_gate._git_segments 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 · ContextHealthHook._deep_check (cyclomatic 22) · ×1
  • ContextHealthHook._deep_check (cyclomatic 22) backend/hooks/context_health_hook.py:771 — ContextHealthHook._deep_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 · aws_account._connect_locked (cyclomatic 22) · ×1
  • aws_account._connect_locked (cyclomatic 22) backend/routers/aws_account.py:229 — aws_account._connect_locked 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 · chat._merge_consecutive_assistant_messages (cyclomatic 22) · ×1
  • chat._merge_consecutive_assistant_messages (cyclomatic 22) backend/routers/chat.py:1102 — chat._merge_consecutive_assistant_messages 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 · workspace_api._get_git_status (cyclomatic 22) · ×1
  • workspace_api._get_git_status (cyclomatic 22) backend/routers/workspace_api.py:300 — workspace_api._get_git_status 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 · backfill_cjk_escapes._populate_seg_columns (cyclomatic 22) · ×1
  • backfill_cjk_escapes._populate_seg_columns (cyclomatic 22) backend/scripts/backfill_cjk_escapes.py:447 — backfill_cjk_escapes._populate_seg_columns 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 · scenario_runner.run_scenario_raw (cyclomatic 22) · ×1
  • scenario_runner.run_scenario_raw (cyclomatic 22) backend/scripts/scenario_runner.py:325 — scenario_runner.run_scenario_raw 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 · publish_dashboard.scan_deliver (cyclomatic 22) · ×1
  • publish_dashboard.scan_deliver (cyclomatic 22) backend/skills/s_pollinate/scripts/publish_dashboard.py:44 — publish_dashboard.scan_deliver 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 · todo_db._build_linked_context (cyclomatic 22) · ×1
  • todo_db._build_linked_context (cyclomatic 22) backend/skills/s_radar-todo/scripts/todo_db.py:74 — todo_db._build_linked_context 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 · useChatStreamingLifecycle.updateMessages (cyclomatic 22) · ×1
  • useChatStreamingLifecycle.updateMessages (cyclomatic 22) desktop/src/hooks/useChatStreamingLifecycle.ts:386 — useChatStreamingLifecycle.updateMessages has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 393, 423). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ContentBlockRenderer.ContentBlockRenderer (cyclomatic 22) · ×1
  • ContentBlockRenderer.ContentBlockRenderer (cyclomatic 22) desktop/src/pages/chat/components/ContentBlockRenderer.tsx:166 — ContentBlockRenderer.ContentBlockRenderer 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 · CMBrainOverlay.CMBrainContent (cyclomatic 22) · ×1
  • CMBrainOverlay.CMBrainContent (cyclomatic 22) desktop/src/components/layout/CMBrainOverlay.tsx:161 — CMBrainOverlay.CMBrainContent 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 · hiveComponents.AuthDisplay (cyclomatic 22) · ×1
  • hiveComponents.AuthDisplay (cyclomatic 22) REDACTED:341 — hiveComponents.AuthDisplay has cyclomatic complexity 22 (threshold 15). Of this number, 11 points are the body's own statements and 11 belong to 5 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · UsageView.Top (cyclomatic 22) · ×1
  • UsageView.Top (cyclomatic 22) desktop/src/components/usage/UsageView.tsx:244 — UsageView.Top has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 5 of the 22 points are its own statements and the rest belongs to 4 function items inside it that branch (open, label, a function literal at line 253, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · OverviewTab.OverviewTab (cyclomatic 22) · ×1
  • OverviewTab.OverviewTab (cyclomatic 22) desktop/src/pages/eval/OverviewTab.tsx:32 — OverviewTab.OverviewTab 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 · HiveFleet.HiveFleetSection (cyclomatic 22) · ×1
  • HiveFleet.HiveFleetSection (cyclomatic 22) desktop/src/components/awsAccount/HiveFleet.tsx:279 — HiveFleet.HiveFleetSection has cyclomatic complexity 22 (threshold 15). Of this number, 20 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 · useUnifiedAttachments.useUnifiedAttachments.addFiles (cyclomatic 22) · ×1
  • useUnifiedAttachments.useUnifiedAttachments.addFiles (cyclomatic 22) desktop/src/hooks/useUnifiedAttachments.ts:179 — useUnifiedAttachments.useUnifiedAttachments.addFiles 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 · TSCCPopoverButton.TSCCPopoverButton (cyclomatic 22) · ×1
  • TSCCPopoverButton.TSCCPopoverButton (cyclomatic 22) desktop/src/pages/chat/components/TSCCPopoverButton.tsx:64 — TSCCPopoverButton.TSCCPopoverButton has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 7 of the 22 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 106, 83, 73, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · OnboardingPage.StepRestore (cyclomatic 22) · ×1
  • OnboardingPage.StepRestore (cyclomatic 22) desktop/src/pages/OnboardingPage.tsx:512 — OnboardingPage.StepRestore has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 10 of the 22 points are its own statements and the rest belongs to 3 function items inside it that branch (handleRestore, a function literal at line 622, a function literal at line 531). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · FolderPickerModal.FolderPickerModal (cyclomatic 22) · ×1
  • FolderPickerModal.FolderPickerModal (cyclomatic 22) desktop/src/components/workspace/FolderPickerModal.tsx:22 — FolderPickerModal.FolderPickerModal has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 9 of the 22 points are its own statements and the rest belongs to 8 function items inside it that branch (getBreadcrumbParts, a function literal at line 35, getSelectedPath, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · _Breaks.of (cyclomatic 21) · ×1
  • _Breaks.of (cyclomatic 21) backend/core/code_intel/changed.py:485 — _Breaks.of 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 · interface._py_params (cyclomatic 21) · ×1
  • interface._py_params (cyclomatic 21) backend/core/code_intel/interface.py:185 — interface._py_params 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 · receivers.patch_reference (cyclomatic 21) · ×1
  • receivers.patch_reference (cyclomatic 21) backend/core/code_intel/receivers.py:1157 — receivers.patch_reference 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 · cognition.locate (cyclomatic 21) · ×1
  • cognition.locate (cyclomatic 21) backend/core/cognition.py:407 — cognition.locate 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 · hive_records.append (cyclomatic 21) · ×1
  • hive_records.append (cyclomatic 21) backend/core/hive_records.py:209 — hive_records.append 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 · hive_records.turn_projection (cyclomatic 21) · ×1
  • hive_records.turn_projection (cyclomatic 21) backend/core/hive_records.py:373 — hive_records.turn_projection 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 · hive_records.turn_rows (cyclomatic 21) · ×1
  • hive_records.turn_rows (cyclomatic 21) backend/core/hive_records.py:679 — hive_records.turn_rows 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 · hive_return.verify_revert (cyclomatic 21) · ×1
  • hive_return.verify_revert (cyclomatic 21) backend/core/hive_return.py:651 — hive_return.verify_revert 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 · worker._defer_or_poison (cyclomatic 21) · ×1
  • worker._defer_or_poison (cyclomatic 21) backend/core/ingestion/worker.py:145 — worker._defer_or_poison 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 · writer._build_plan (cyclomatic 21) · ×1
  • writer._build_plan (cyclomatic 21) backend/core/ingestion/writer.py:554 — writer._build_plan 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 · mcp_config_loader.merge_catalog_template (cyclomatic 21) · ×1
  • mcp_config_loader.merge_catalog_template (cyclomatic 21) backend/core/mcp_config_loader.py:149 — mcp_config_loader.merge_catalog_template 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 · mcp_migration.migrate_if_needed (cyclomatic 21) · ×1
  • mcp_migration.migrate_if_needed (cyclomatic 21) backend/core/mcp_migration.py:28 — mcp_migration.migrate_if_needed 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 · project_agent.validate (cyclomatic 21) · ×1
  • project_agent.validate (cyclomatic 21) backend/core/project_agent.py:294 — project_agent.validate 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 · answers._finding (cyclomatic 21) · ×1
  • answers._finding (cyclomatic 21) backend/core/run_protocol/answers.py:82 — answers._finding 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 · audit.select_untracked (cyclomatic 21) · ×1
  • audit.select_untracked (cyclomatic 21) backend/core/run_protocol/audit.py:291 — audit.select_untracked 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 · RunEngine._read_model (cyclomatic 21) · ×1
  • RunEngine._read_model (cyclomatic 21) backend/core/run_protocol/engine.py:1073 — RunEngine._read_model 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 · RunEngine._handoff_problems (cyclomatic 21) · ×1
  • RunEngine._handoff_problems (cyclomatic 21) backend/core/run_protocol/engine.py:1563 — RunEngine._handoff_problems 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 · next_step._review_action (cyclomatic 21) · ×1
  • next_step._review_action (cyclomatic 21) backend/core/run_protocol/next_step.py:104 — next_step._review_action 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 · security_hooks._syntax_cannot_be_incomplete (cyclomatic 21) · ×1
  • security_hooks._syntax_cannot_be_incomplete (cyclomatic 21) backend/core/security_hooks.py:6175 — security_hooks._syntax_cannot_be_incomplete 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 · session_changes.row_facts (cyclomatic 21) · ×1
  • session_changes.row_facts (cyclomatic 21) backend/core/session_changes.py:69 — session_changes.row_facts 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 · SessionUnit._ensure_spawned (cyclomatic 21) · ×1
  • SessionUnit._ensure_spawned (cyclomatic 21) backend/core/session_unit.py:3080 — SessionUnit._ensure_spawned 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 · SummarizationPipeline._enrich_with_llm (cyclomatic 21) · ×1
  • SummarizationPipeline._enrich_with_llm (cyclomatic 21) backend/core/summarization.py:608 — SummarizationPipeline._enrich_with_llm 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 · swarm_out_results._usage (cyclomatic 21) · ×1
  • swarm_out_results._usage (cyclomatic 21) backend/core/swarm_out_results.py:1199 — swarm_out_results._usage 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 · SwarmWorkspaceManager._cleanup_legacy_content (cyclomatic 21) · ×1
  • SwarmWorkspaceManager._cleanup_legacy_content (cyclomatic 21) backend/core/swarm_workspace_manager.py:1945 — SwarmWorkspaceManager._cleanup_legacy_content 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 · tool_summarizer.summarize_tool_result (cyclomatic 21) · ×1
  • tool_summarizer.summarize_tool_result (cyclomatic 21) backend/core/tool_summarizer.py:589 — tool_summarizer.summarize_tool_result 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 · turn_stop.build (cyclomatic 21) · ×1
  • turn_stop.build (cyclomatic 21) backend/core/turn_stop.py:103 — turn_stop.build 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 · pollinate._walk_assets (cyclomatic 21) · ×1
  • pollinate._walk_assets (cyclomatic 21) backend/routers/pollinate.py:327 — pollinate._walk_assets 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 · artifact_cli._bind_into_workspace (cyclomatic 21) · ×1
  • artifact_cli._bind_into_workspace (cyclomatic 21) backend/scripts/artifact_cli.py:403 — artifact_cli._bind_into_workspace 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 · cdf_batch_eval.score (cyclomatic 21) · ×1
  • cdf_batch_eval.score (cyclomatic 21) backend/scripts/cdf_batch_eval.py:373 — cdf_batch_eval.score 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 · generate_app_registry._validate_binding_sources (cyclomatic 21) · ×1
  • generate_app_registry._validate_binding_sources (cyclomatic 21) backend/scripts/generate_app_registry.py:137 — generate_app_registry._validate_binding_sources 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 · swarm_out.main (cyclomatic 21) · ×1
  • swarm_out.main (cyclomatic 21) backend/scripts/swarm_out.py:422 — swarm_out.main 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 · SelfLoopsHealthEngine._check_infrastructure (cyclomatic 21) · ×1
  • SelfLoopsHealthEngine._check_infrastructure (cyclomatic 21) backend/skills/s_loops-health/scripts/loops_health_check.py:529 — SelfLoopsHealthEngine._check_infrastructure 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 · generate_shorts.main (cyclomatic 21) · ×1
  • generate_shorts.main (cyclomatic 21) backend/skills/s_pollinate/scripts/generate_shorts.py:534 — generate_shorts.main 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 · ShapeData._estimate_frame_overflow (cyclomatic 21) · ×1
  • ShapeData._estimate_frame_overflow (cyclomatic 21) backend/skills/s_pptx/scripts/inventory.py:562 — ShapeData._estimate_frame_overflow 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 · rearrange.rearrange_presentation (cyclomatic 21) · ×1
  • rearrange.rearrange_presentation (cyclomatic 21) backend/skills/s_pptx/scripts/rearrange.py:149 — rearrange.rearrange_presentation 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 · mcp_validation.validate_config_entry (cyclomatic 21) · ×1
  • mcp_validation.validate_config_entry (cyclomatic 21) backend/utils/mcp_validation.py:105 — mcp_validation.validate_config_entry 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 · Dropdown.Dropdown (cyclomatic 21) · ×1
  • Dropdown.Dropdown (cyclomatic 21) desktop/src/components/common/Dropdown.tsx:23 — Dropdown.Dropdown has cyclomatic complexity 21 (threshold 15). Of this number, 17 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · useChatStreamingLifecycle.useChatStreamingLifecycle.surfacePendingQuestion (cyclomatic 21) · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle.surfacePendingQuestion (cyclomatic 21) desktop/src/hooks/useChatStreamingLifecycle.ts:2091 — useChatStreamingLifecycle.useChatStreamingLifecycle.surfacePendingQuestion has cyclomatic complexity 21 (threshold 15). Of this number, 16 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · useChatStreamingLifecycle.useChatStreamingLifecycle.createDisconnectHandler.<returned closure> (cyclomatic 21) · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle.createDisconnectHandler.<returned closure> (cyclomatic 21) desktop/src/hooks/useChatStreamingLifecycle.ts:4525 — useChatStreamingLifecycle.useChatStreamingLifecycle.createDisconnectHandler.<returned closure> has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 10 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 4563). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · TurnCards.RunLine (cyclomatic 21) · ×1
  • TurnCards.RunLine (cyclomatic 21) desktop/src/pages/chat/components/TurnCards.tsx:175 — TurnCards.RunLine 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 · TurnZones.AgentsPanel (cyclomatic 21) · ×1
  • TurnZones.AgentsPanel (cyclomatic 21) desktop/src/pages/chat/components/TurnZones.tsx:612 — TurnZones.AgentsPanel has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to 4 function items inside it that branch (isStopped, isRunning, a function literal at line 622, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · TurnZones.StageGroup (cyclomatic 21) · ×1
  • TurnZones.StageGroup (cyclomatic 21) desktop/src/pages/chat/components/TurnZones.tsx:898 — TurnZones.StageGroup 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 · LiveDispatches.Fleet (cyclomatic 21) · ×1
  • LiveDispatches.Fleet (cyclomatic 21) desktop/src/components/swarm-out/LiveDispatches.tsx:100 — LiveDispatches.Fleet has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 6 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 125). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · hiveComponents.AccountCard (cyclomatic 21) · ×1
  • hiveComponents.AccountCard (cyclomatic 21) REDACTED:461 — hiveComponents.AccountCard 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 · OverviewTab.releaseLede (cyclomatic 21) · ×1
  • OverviewTab.releaseLede (cyclomatic 21) desktop/src/pages/eval/OverviewTab.tsx:108 — OverviewTab.releaseLede has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · JudgesTab.JudgesTab (cyclomatic 21) · ×1
  • JudgesTab.JudgesTab (cyclomatic 21) desktop/src/pages/eval/JudgesTab.tsx:10 — JudgesTab.JudgesTab 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 · ConnectAccount.DetectedRow (cyclomatic 21) · ×1
  • ConnectAccount.DetectedRow (cyclomatic 21) desktop/src/components/awsAccount/ConnectAccount.tsx:734 — ConnectAccount.DetectedRow has cyclomatic complexity 21 (threshold 15). Of this number, 16 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · turnControls.decidePermission (cyclomatic 21) · ×1
  • turnControls.decidePermission (cyclomatic 21) desktop/src/pages/chat/turnControls.ts:485 — turnControls.decidePermission has cyclomatic complexity 21 (threshold 15). Of this number, 16 points are the body's own statements and 5 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · pipeline-conductor-ui-mock.html.show (cyclomatic 21) · ×1
  • pipeline-conductor-ui-mock.html.show (cyclomatic 21) docs/design/pipeline-conductor-ui-mock.html:111 — pipeline-conductor-ui-mock.html.show has cyclomatic complexity 21 (threshold 15). Of this number, 17 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · addressing.matches (cyclomatic 20) · ×1
  • addressing.matches (cyclomatic 20) backend/core/addressing.py:456 — addressing.matches 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 · attention_authority._collect_aws_account (cyclomatic 20) · ×1
  • attention_authority._collect_aws_account (cyclomatic 20) backend/core/attention_authority.py:1019 — attention_authority._collect_aws_account 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 · GraphStore.store_file_nodes_edges (cyclomatic 20) · ×1
  • GraphStore.store_file_nodes_edges (cyclomatic 20) backend/core/code_intel/graph_store.py:718 — GraphStore.store_file_nodes_edges 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 · impact._callers (cyclomatic 20) · ×1
  • impact._callers (cyclomatic 20) backend/core/code_intel/impact.py:103 — impact._callers 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 · FileTypes._name_type (cyclomatic 20) · ×1
  • FileTypes._name_type (cyclomatic 20) backend/core/code_intel/receivers.py:636 — FileTypes._name_type 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 · receivers.value_reference (cyclomatic 20) · ×1
  • receivers.value_reference (cyclomatic 20) backend/core/code_intel/receivers.py:1099 — receivers.value_reference 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 · cognition.find_store (cyclomatic 20) · ×1
  • cognition.find_store (cyclomatic 20) backend/core/cognition.py:233 — cognition.find_store 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 · EvalService.get_session_quality (cyclomatic 20) · ×1
  • EvalService.get_session_quality (cyclomatic 20) backend/core/eval_service.py:452 — EvalService.get_session_quality 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 · hive_diagnostics._target (cyclomatic 20) · ×1
  • hive_diagnostics._target (cyclomatic 20) backend/core/hive_diagnostics.py:181 — hive_diagnostics._target 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 · queries.item_detail (cyclomatic 20) · ×1
  • queries.item_detail (cyclomatic 20) backend/core/ingestion/queries.py:255 — queries.item_detail 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 · s7_review.review_session (cyclomatic 20) · ×1
  • s7_review.review_session (cyclomatic 20) backend/core/ingestion/sources/s7_review.py:927 — s7_review.review_session 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 · usage.record_recalled_result (cyclomatic 20) · ×1
  • usage.record_recalled_result (cyclomatic 20) backend/core/ingestion/usage.py:192 — usage.record_recalled_result 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 · knowledge_cli._find (cyclomatic 20) · ×1
  • knowledge_cli._find (cyclomatic 20) backend/core/knowledge_cli.py:96 — knowledge_cli._find 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 · facts.stale_closures (cyclomatic 20) · ×1
  • facts.stale_closures (cyclomatic 20) backend/core/run_protocol/facts.py:109 — facts.stale_closures 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 · hook_bridge._repo_paths (cyclomatic 20) · ×1
  • hook_bridge._repo_paths (cyclomatic 20) backend/core/run_protocol/hook_bridge.py:231 — hook_bridge._repo_paths 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 · schemas._design_rows (cyclomatic 20) · ×1
  • schemas._design_rows (cyclomatic 20) backend/core/run_protocol/schemas.py:425 — schemas._design_rows 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 · runtime_hooks._handout_attribution (cyclomatic 20) · ×1
  • runtime_hooks._handout_attribution (cyclomatic 20) backend/core/runtime_hooks.py:1015 — runtime_hooks._handout_attribution 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 · SessionRouter.drain_pending (cyclomatic 20) · ×1
  • SessionRouter.drain_pending (cyclomatic 20) backend/core/session_router.py:3794 — SessionRouter.drain_pending 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 · skill_manager.parse_skill_md (cyclomatic 20) · ×1
  • skill_manager.parse_skill_md (cyclomatic 20) backend/core/skill_manager.py:213 — skill_manager.parse_skill_md 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 · swarm_out.run_state (cyclomatic 20) · ×1
  • swarm_out.run_state (cyclomatic 20) backend/core/swarm_out.py:1450 — swarm_out.run_state 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 · swarm_out_follow.watch (cyclomatic 20) · ×1
  • swarm_out_follow.watch (cyclomatic 20) backend/core/swarm_out_follow.py:206 — swarm_out_follow.watch 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 · swarm_out_results.execution_check (cyclomatic 20) · ×1
  • swarm_out_results.execution_check (cyclomatic 20) backend/core/swarm_out_results.py:1061 — swarm_out_results.execution_check 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 · swarm_out_settle._actions (cyclomatic 20) · ×1
  • swarm_out_settle._actions (cyclomatic 20) backend/core/swarm_out_settle.py:404 — swarm_out_settle._actions 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 · turn_stop.continuation_note (cyclomatic 20) · ×1
  • turn_stop.continuation_note (cyclomatic 20) backend/core/turn_stop.py:174 — turn_stop.continuation_note 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 · fleet.reconcile (cyclomatic 20) · ×1
  • fleet.reconcile (cyclomatic 20) backend/hive/fleet.py:307 — fleet.reconcile 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 · brain_mistake_audit._open_conflicts (cyclomatic 20) · ×1
  • brain_mistake_audit._open_conflicts (cyclomatic 20) backend/jobs/handlers/brain_mistake_audit.py:456 — brain_mistake_audit._open_conflicts 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 · log_patrol.run_log_patrol (cyclomatic 20) · ×1
  • log_patrol.run_log_patrol (cyclomatic 20) backend/jobs/handlers/log_patrol.py:56 — log_patrol.run_log_patrol 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 · memory_health._compress_evolution_entries (cyclomatic 20) · ×1
  • memory_health._compress_evolution_entries (cyclomatic 20) backend/jobs/handlers/memory_health.py:503 — memory_health._compress_evolution_entries 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 · agents.update_agent (cyclomatic 20) · ×1
  • agents.update_agent (cyclomatic 20) backend/routers/agents.py:168 — agents.update_agent 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 · tasks.create_task (cyclomatic 20) · ×1
  • tasks.create_task (cyclomatic 20) backend/routers/tasks.py:66 — tasks.create_task 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 · cdf_write_scan.sink_kind (cyclomatic 20) · ×1
  • cdf_write_scan.sink_kind (cyclomatic 20) backend/scripts/cdf_write_scan.py:77 — cdf_write_scan.sink_kind 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 · da_resummarize.rebuild_day (cyclomatic 20) · ×1
  • da_resummarize.rebuild_day (cyclomatic 20) backend/scripts/da_resummarize.py:357 — da_resummarize.rebuild_day 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 · da_resummarize.recount_commits (cyclomatic 20) · ×1
  • da_resummarize.recount_commits (cyclomatic 20) backend/scripts/da_resummarize.py:584 — da_resummarize.recount_commits 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 · eval_runner.compare_repeats (cyclomatic 20) · ×1
  • eval_runner.compare_repeats (cyclomatic 20) backend/scripts/eval_runner.py:2498 — eval_runner.compare_repeats 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 · meta_shape_migrate.rewrite (cyclomatic 20) · ×1
  • meta_shape_migrate.rewrite (cyclomatic 20) backend/scripts/meta_shape_migrate.py:77 — meta_shape_migrate.rewrite 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 · XMLEditor.get_node (cyclomatic 20) · ×1
  • XMLEditor.get_node (cyclomatic 20) backend/skills/s_docx/scripts/utilities.py:76 — XMLEditor.get_node 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 · generate_tts.main (cyclomatic 20) · ×1
  • generate_tts.main (cyclomatic 20) backend/skills/s_pollinate/scripts/generate_tts.py:109 — generate_tts.main 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 · publish_dashboard.generate_markdown (cyclomatic 20) · ×1
  • publish_dashboard.generate_markdown (cyclomatic 20) backend/skills/s_pollinate/scripts/publish_dashboard.py:114 — publish_dashboard.generate_markdown 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 · BaseSchemaValidator.validate_unique_ids (cyclomatic 20) · ×1
  • BaseSchemaValidator.validate_unique_ids (cyclomatic 20) backend/skills/s_pptx/ooxml/scripts/validation/base.py:186 — BaseSchemaValidator.validate_unique_ids 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 · todo_db._print_work_packet (cyclomatic 20) · ×1
  • todo_db._print_work_packet (cyclomatic 20) backend/skills/s_radar-todo/scripts/todo_db.py:145 — todo_db._print_work_packet 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 · MarkdownRenderer.MermaidDiagram (cyclomatic 20) · ×1
  • MarkdownRenderer.MermaidDiagram (cyclomatic 20) REDACTED:284 — MarkdownRenderer.MermaidDiagram has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 4 of the 20 points are its own statements and the rest belongs to 5 function items inside it that branch (handleDownloadPng, a function literal at line 336, a function literal at line 297, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · HistoryView.HistoryView (cyclomatic 20) · ×1
  • HistoryView.HistoryView (cyclomatic 20) desktop/src/pages/chat/components/RightSidebar/HistoryView.tsx:34 — HistoryView.HistoryView has cyclomatic complexity 20 (threshold 15). Of this number, 13 points are the body's own statements and 7 belong to 5 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 · TurnZones.PhaseBody (cyclomatic 20) · ×1
  • TurnZones.PhaseBody (cyclomatic 20) desktop/src/pages/chat/components/TurnZones.tsx:771 — TurnZones.PhaseBody has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 5 of the 20 points are its own statements and the rest belongs to 7 function items inside it that branch (renderItems, a function literal at line 796, renderItems::columnRow, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · CompactNotice.CompactChipImpl (cyclomatic 20) · ×1
  • CompactNotice.CompactChipImpl (cyclomatic 20) desktop/src/pages/chat/components/CompactNotice.tsx:125 — CompactNotice.CompactChipImpl 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 · ProjectAgentView.ProjectAgentView (cyclomatic 20) · ×1
  • ProjectAgentView.ProjectAgentView (cyclomatic 20) desktop/src/components/layout/ProjectAgentView.tsx:43 — ProjectAgentView.ProjectAgentView has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 73, 103, 89). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · HiveFleetOverlay.HiveFleetContent (cyclomatic 20) · ×1
  • HiveFleetOverlay.HiveFleetContent (cyclomatic 20) desktop/src/components/layout/HiveFleetOverlay.tsx:46 — HiveFleetOverlay.HiveFleetContent has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 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 · WorkspaceOverlay.WorkspaceOverlay (cyclomatic 20) · ×1
  • WorkspaceOverlay.WorkspaceOverlay (cyclomatic 20) desktop/src/components/workspace-explorer/WorkspaceOverlay.tsx:93 — WorkspaceOverlay.WorkspaceOverlay has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 7 of the 20 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 122, 117, 108, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · CanvasOutputRail.OutputRow (cyclomatic 20) · ×1
  • CanvasOutputRail.OutputRow (cyclomatic 20) desktop/src/components/file-viewer/CanvasOutputRail.tsx:72 — CanvasOutputRail.OutputRow has cyclomatic complexity 20 (threshold 15). Of this number, 18 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · useVoiceRecorder.useVoiceRecorder.stopRecording (cyclomatic 20) · ×1
  • useVoiceRecorder.useVoiceRecorder.stopRecording (cyclomatic 20) desktop/src/hooks/useVoiceRecorder.ts:245 — useVoiceRecorder.useVoiceRecorder.stopRecording 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 · turnControls.answerQuestion (cyclomatic 20) · ×1
  • turnControls.answerQuestion (cyclomatic 20) desktop/src/pages/chat/turnControls.ts:402 — turnControls.answerQuestion has cyclomatic complexity 20 (threshold 15). Of this number, 16 points are the body's own statements and 4 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 · turnControls.stopTurn (cyclomatic 20) · ×1
  • turnControls.stopTurn (cyclomatic 20) desktop/src/pages/chat/turnControls.ts:561 — turnControls.stopTurn has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · HistoryView.HistoryRow (cyclomatic 20) · ×1
  • HistoryView.HistoryRow (cyclomatic 20) desktop/src/components/swarm-out/HistoryView.tsx:248 — HistoryView.HistoryRow has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · pdftoppm_shim.main (cyclomatic 19) · ×1
  • pdftoppm_shim.main (cyclomatic 19) backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/pdftoppm_shim.py:95 — pdftoppm_shim.main 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 · app_provenance.load_verified_provenance (cyclomatic 19) · ×1
  • app_provenance.load_verified_provenance (cyclomatic 19) backend/core/app_provenance.py:122 — app_provenance.load_verified_provenance 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 · domain_rules.compute_domain_rules (cyclomatic 19) · ×1
  • domain_rules.compute_domain_rules (cyclomatic 19) backend/core/code_intel/domain_rules.py:157 — domain_rules.compute_domain_rules 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 · local_roots.hive_task_clones (cyclomatic 19) · ×1
  • local_roots.hive_task_clones (cyclomatic 19) backend/core/code_intel/local_roots.py:472 — local_roots.hive_task_clones 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 · context_usage._scan_transcript_usage (cyclomatic 19) · ×1
  • context_usage._scan_transcript_usage (cyclomatic 19) backend/core/context_usage.py:171 — context_usage._scan_transcript_usage 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 · daily_activity_writer.upsert_session_block (cyclomatic 19) · ×1
  • daily_activity_writer.upsert_session_block (cyclomatic 19) backend/core/daily_activity_writer.py:283 — daily_activity_writer.upsert_session_block 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 · DddCultivationOrchestrator._ch_ddd_staleness (cyclomatic 19) · ×1
  • DddCultivationOrchestrator._ch_ddd_staleness (cyclomatic 19) backend/core/ddd_orchestrator.py:292 — DddCultivationOrchestrator._ch_ddd_staleness 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 · EvalService.get_lines (cyclomatic 19) · ×1
  • EvalService.get_lines (cyclomatic 19) backend/core/eval_service.py:350 — EvalService.get_lines 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 · file_change_classifier.parse_bash_heredoc_write_candidates (cyclomatic 19) · ×1
  • file_change_classifier.parse_bash_heredoc_write_candidates (cyclomatic 19) backend/core/file_change_classifier.py:190 — file_change_classifier.parse_bash_heredoc_write_candidates 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 · history_page.page_by_turns (cyclomatic 19) · ×1
  • history_page.page_by_turns (cyclomatic 19) backend/core/history_page.py:35 — history_page.page_by_turns 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 · governed_edit.withdraw (cyclomatic 19) · ×1
  • governed_edit.withdraw (cyclomatic 19) backend/core/ingestion/governed_edit.py:619 — governed_edit.withdraw 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 · overrides.check_session_own (cyclomatic 19) · ×1
  • overrides.check_session_own (cyclomatic 19) backend/core/ingestion/overrides.py:313 — overrides.check_session_own 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 · worker._process_v2_candidate (cyclomatic 19) · ×1
  • worker._process_v2_candidate (cyclomatic 19) backend/core/ingestion/worker.py:345 — worker._process_v2_candidate 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 · mcp_config_loader.add_mcp_server_to_dict (cyclomatic 19) · ×1
  • mcp_config_loader.add_mcp_server_to_dict (cyclomatic 19) backend/core/mcp_config_loader.py:303 — mcp_config_loader.add_mcp_server_to_dict 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 · ProductRegistry.scan_product_dirs (cyclomatic 19) · ×1
  • ProductRegistry.scan_product_dirs (cyclomatic 19) backend/core/product_registry.py:958 — ProductRegistry.scan_product_dirs 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 · recall_filter._omitted_rows (cyclomatic 19) · ×1
  • recall_filter._omitted_rows (cyclomatic 19) backend/core/recall_filter.py:574 — recall_filter._omitted_rows 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 · repo_placement.normalize_url (cyclomatic 19) · ×1
  • repo_placement.normalize_url (cyclomatic 19) backend/core/repo_placement.py:203 — repo_placement.normalize_url 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 · lifecycle._partial_land (cyclomatic 19) · ×1
  • lifecycle._partial_land (cyclomatic 19) backend/core/run_protocol/lifecycle.py:654 — lifecycle._partial_land 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 · lifecycle._authorization (cyclomatic 19) · ×1
  • lifecycle._authorization (cyclomatic 19) backend/core/run_protocol/lifecycle.py:699 — lifecycle._authorization 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 · run_worktree.own_isolated_run (cyclomatic 19) · ×1
  • run_worktree.own_isolated_run (cyclomatic 19) backend/core/run_worktree.py:1590 — run_worktree.own_isolated_run 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 · runtime_hooks._expert_answer (cyclomatic 19) · ×1
  • runtime_hooks._expert_answer (cyclomatic 19) backend/core/runtime_hooks.py:1141 — runtime_hooks._expert_answer 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 · security_hooks._gh_api_writes (cyclomatic 19) · ×1
  • security_hooks._gh_api_writes (cyclomatic 19) backend/core/security_hooks.py:673 — security_hooks._gh_api_writes 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 · SessionRouter._evict_idle (cyclomatic 19) · ×1
  • SessionRouter._evict_idle (cyclomatic 19) backend/core/session_router.py:3352 — SessionRouter._evict_idle 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 · SummarizationPipeline._extract_topics (cyclomatic 19) · ×1
  • SummarizationPipeline._extract_topics (cyclomatic 19) backend/core/summarization.py:347 — SummarizationPipeline._extract_topics 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 · swarm_out._clean_ask (cyclomatic 19) · ×1
  • swarm_out._clean_ask (cyclomatic 19) backend/core/swarm_out.py:1099 — swarm_out._clean_ask 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 · swarm_out_actor.discard_blocker (cyclomatic 19) · ×1
  • swarm_out_actor.discard_blocker (cyclomatic 19) backend/core/swarm_out_actor.py:288 — swarm_out_actor.discard_blocker 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 · task_repos._pulled_upstream (cyclomatic 19) · ×1
  • task_repos._pulled_upstream (cyclomatic 19) backend/core/task_repos.py:220 — task_repos._pulled_upstream 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 · ToDoManager.update (cyclomatic 19) · ×1
  • ToDoManager.update (cyclomatic 19) backend/core/todo_manager.py:338 — ToDoManager.update 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 · turn_changes.session_trees (cyclomatic 19) · ×1
  • turn_changes.session_trees (cyclomatic 19) backend/core/turn_changes.py:194 — turn_changes.session_trees 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 · SQLiteDatabase._migrate_existing_task_data (cyclomatic 19) · ×1
  • SQLiteDatabase._migrate_existing_task_data (cyclomatic 19) backend/database/sqlite.py:4052 — SQLiteDatabase._migrate_existing_task_data 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 · DailyActivityExtractionHook._capture_git_activity (cyclomatic 19) · ×1
  • DailyActivityExtractionHook._capture_git_activity (cyclomatic 19) backend/hooks/daily_activity_hook.py:752 — DailyActivityExtractionHook._capture_git_activity 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 · executor._send_slack_dm (cyclomatic 19) · ×1
  • executor._send_slack_dm (cyclomatic 19) REDACTED:1528 — executor._send_slack_dm 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 · brain_mistake_audit._candidates (cyclomatic 19) · ×1
  • brain_mistake_audit._candidates (cyclomatic 19) backend/jobs/handlers/brain_mistake_audit.py:199 — brain_mistake_audit._candidates 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 · cdf_batch_eval._failures (cyclomatic 19) · ×1
  • cdf_batch_eval._failures (cyclomatic 19) backend/scripts/cdf_batch_eval.py:424 — cdf_batch_eval._failures 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 · migrate_followups_to_todos.run (cyclomatic 19) · ×1
  • migrate_followups_to_todos.run (cyclomatic 19) backend/scripts/migrate_followups_to_todos.py:554 — migrate_followups_to_todos.run 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 · migrate_skills.generate_manifest (cyclomatic 19) · ×1
  • migrate_skills.generate_manifest (cyclomatic 19) backend/scripts/migrate_skills.py:235 — migrate_skills.generate_manifest 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 · BaseSchemaValidator.validate_unique_ids (cyclomatic 19) · ×1
  • BaseSchemaValidator.validate_unique_ids (cyclomatic 19) backend/skills/s_docx/ooxml/scripts/validation/base.py:186 — BaseSchemaValidator.validate_unique_ids 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 · design_system.format_markdown (cyclomatic 19) · ×1
  • design_system.format_markdown (cyclomatic 19) backend/skills/s_frontend-design/scripts/design_system.py:422 — design_system.format_markdown 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 · font_link_backfill.main (cyclomatic 19) · ×1
  • font_link_backfill.main (cyclomatic 19) backend/skills/s_pollinate/scripts/font_link_backfill.py:94 — font_link_backfill.main 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 · ai_ready_helpers.incremental_update (cyclomatic 19) · ×1
  • ai_ready_helpers.incremental_update (cyclomatic 19) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:937 — ai_ready_helpers.incremental_update 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 · ai_ready_helpers.prioritized_file_list (cyclomatic 19) · ×1
  • ai_ready_helpers.prioritized_file_list (cyclomatic 19) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1364 — ai_ready_helpers.prioritized_file_list 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 · MessageStore._mergePreservingInteractive (cyclomatic 19) · ×1
  • MessageStore._mergePreservingInteractive (cyclomatic 19) desktop/src/stores/MessageStore.ts:869 — MessageStore._mergePreservingInteractive has cyclomatic complexity 19 (threshold 15). Of this number, 13 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · turnZones.mergeColumn (cyclomatic 19) · ×1
  • turnZones.mergeColumn (cyclomatic 19) desktop/src/pages/chat/turnZones.ts:621 — turnZones.mergeColumn has cyclomatic complexity 19 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CompactNotice.CompactNoticeImpl (cyclomatic 19) · ×1
  • CompactNotice.CompactNoticeImpl (cyclomatic 19) desktop/src/pages/chat/components/CompactNotice.tsx:34 — CompactNotice.CompactNoticeImpl 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 · live.tallyRuns (cyclomatic 19) · ×1
  • live.tallyRuns (cyclomatic 19) desktop/src/components/swarm-out/live.ts:573 — live.tallyRuns 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 · CdfHealth.CdfHealth (cyclomatic 19) · ×1
  • CdfHealth.CdfHealth (cyclomatic 19) desktop/src/components/layout/CdfHealth.tsx:85 — CdfHealth.CdfHealth has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CommunityOverlay.SourcesTab (cyclomatic 19) · ×1
  • CommunityOverlay.SourcesTab (cyclomatic 19) desktop/src/components/layout/CommunityOverlay.tsx:230 — CommunityOverlay.SourcesTab has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 4 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 280, 243, 248, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · JobsRunsOverlay.JobDetailDrawer (cyclomatic 19) · ×1
  • JobsRunsOverlay.JobDetailDrawer (cyclomatic 19) desktop/src/components/layout/JobsRunsOverlay.tsx:296 — JobsRunsOverlay.JobDetailDrawer has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ui.Spark (cyclomatic 19) · ×1
  • ui.Spark (cyclomatic 19) desktop/src/pages/eval/ui.tsx:205 — ui.Spark has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 217, 235, 225, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · SkillsPage.SkillsPage (cyclomatic 19) · ×1
  • SkillsPage.SkillsPage (cyclomatic 19) desktop/src/pages/SkillsPage.tsx:78 — SkillsPage.SkillsPage has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 206, a function literal at line 111, handleDeleteConfirm, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · waitForReplyComplete (cyclomatic 19) · ×1
  • waitForReplyComplete (cyclomatic 19) backend/skills/s_browser-agent/wait-engine.mjs:144 — waitForReplyComplete has cyclomatic complexity 19 (threshold 15). Of this number, 13 points are the body's own statements and 6 belong to 15 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 · decks.deck_detail (cyclomatic 18) · ×1
  • decks.deck_detail (cyclomatic 18) backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/decks.py:429 — decks.deck_detail 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 · ChannelGateway._should_reply (cyclomatic 18) · ×1
  • ChannelGateway._should_reply (cyclomatic 18) backend/channels/gateway.py:1199 — ChannelGateway._should_reply 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 · attention_authority._host_wait_items (cyclomatic 18) · ×1
  • attention_authority._host_wait_items (cyclomatic 18) backend/core/attention_authority.py:726 — attention_authority._host_wait_items 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 · attention_authority._collect_ingestion (cyclomatic 18) · ×1
  • attention_authority._collect_ingestion (cyclomatic 18) backend/core/attention_authority.py:925 — attention_authority._collect_ingestion 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 · aws_account._ada_creds (cyclomatic 18) · ×1
  • aws_account._ada_creds (cyclomatic 18) backend/core/aws_account.py:287 — aws_account._ada_creds 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 · bedrock_thinking_gateway.verify_sigv4 (cyclomatic 18) · ×1
  • bedrock_thinking_gateway.verify_sigv4 (cyclomatic 18) REDACTED:148 — bedrock_thinking_gateway.verify_sigv4 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 · GraphStore.incremental_update (cyclomatic 18) · ×1
  • GraphStore.incremental_update (cyclomatic 18) backend/core/code_intel/graph_store.py:1638 — GraphStore.incremental_update 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 · cognition.library_get (cyclomatic 18) · ×1
  • cognition.library_get (cyclomatic 18) backend/core/cognition.py:461 — cognition.library_get 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 · ddd_entry_lifecycle.render_ddd_unit (cyclomatic 18) · ×1
  • ddd_entry_lifecycle.render_ddd_unit (cyclomatic 18) backend/core/ddd_entry_lifecycle.py:329 — ddd_entry_lifecycle.render_ddd_unit 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 · hive_workspace._ensure_mirror_from (cyclomatic 18) · ×1
  • hive_workspace._ensure_mirror_from (cyclomatic 18) backend/core/hive_workspace.py:265 — hive_workspace._ensure_mirror_from 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 · governed_edit.recover_redact_plan (cyclomatic 18) · ×1
  • governed_edit.recover_redact_plan (cyclomatic 18) backend/core/ingestion/governed_edit.py:554 — governed_edit.recover_redact_plan 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 · overrides._apply (cyclomatic 18) · ×1
  • overrides._apply (cyclomatic 18) backend/core/ingestion/overrides.py:397 — overrides._apply 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 · usage._observe_tool_read (cyclomatic 18) · ×1
  • usage._observe_tool_read (cyclomatic 18) backend/core/ingestion/usage.py:248 — usage._observe_tool_read 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 · needs_human_review.needs_human_review_batch (cyclomatic 18) · ×1
  • needs_human_review.needs_human_review_batch (cyclomatic 18) backend/core/needs_human_review.py:495 — needs_human_review.needs_human_review_batch 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 · pipeline_stage_events.read_stage_state (cyclomatic 18) · ×1
  • pipeline_stage_events.read_stage_state (cyclomatic 18) backend/core/pipeline_stage_events.py:165 — pipeline_stage_events.read_stage_state 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 · PluginManager.sync_git_marketplace (cyclomatic 18) · ×1
  • PluginManager.sync_git_marketplace (cyclomatic 18) backend/core/plugin_manager.py:118 — PluginManager.sync_git_marketplace 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 · prompt_metrics.daily (cyclomatic 18) · ×1
  • prompt_metrics.daily (cyclomatic 18) backend/core/prompt_metrics.py:165 — prompt_metrics.daily 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 · run_owner_gate._v1_mutation_check (cyclomatic 18) · ×1
  • run_owner_gate._v1_mutation_check (cyclomatic 18) backend/core/run_owner_gate.py:347 — run_owner_gate._v1_mutation_check 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 · base_tree.extract (cyclomatic 18) · ×1
  • base_tree.extract (cyclomatic 18) backend/core/run_protocol/base_tree.py:50 — base_tree.extract 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 · child_cli._run (cyclomatic 18) · ×1
  • child_cli._run (cyclomatic 18) backend/core/run_protocol/child_cli.py:523 — child_cli._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 · lifecycle._attempt (cyclomatic 18) · ×1
  • lifecycle._attempt (cyclomatic 18) backend/core/run_protocol/lifecycle.py:263 — lifecycle._attempt 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 · run_knowledge.build (cyclomatic 18) · ×1
  • run_knowledge.build (cyclomatic 18) backend/core/run_protocol/run_knowledge.py:217 — run_knowledge.build 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 · validation_report._one (cyclomatic 18) · ×1
  • validation_report._one (cyclomatic 18) backend/core/run_protocol/validation_report.py:57 — validation_report._one 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 · run_worktree.repo_for_write (cyclomatic 18) · ×1
  • run_worktree.repo_for_write (cyclomatic 18) backend/core/run_worktree.py:1687 — run_worktree.repo_for_write 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 · run_worktree.landed_path (cyclomatic 18) · ×1
  • run_worktree.landed_path (cyclomatic 18) backend/core/run_worktree.py:1964 — run_worktree.landed_path 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 · security_hooks._checkout_discards (cyclomatic 18) · ×1
  • security_hooks._checkout_discards (cyclomatic 18) backend/core/security_hooks.py:1586 — security_hooks._checkout_discards 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 · security_hooks._audit_code_hit (cyclomatic 18) · ×1
  • security_hooks._audit_code_hit (cyclomatic 18) backend/core/security_hooks.py:5812 — security_hooks._audit_code_hit 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 · SessionEventHub.publish (cyclomatic 18) · ×1
  • SessionEventHub.publish (cyclomatic 18) backend/core/session_events.py:209 — SessionEventHub.publish 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 · SessionRouter._acquire_chat_slot (cyclomatic 18) · ×1
  • SessionRouter._acquire_chat_slot (cyclomatic 18) backend/core/session_router.py:3192 — SessionRouter._acquire_chat_slot 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 · SkillManager._scan_tier (cyclomatic 18) · ×1
  • SkillManager._scan_tier (cyclomatic 18) backend/core/skill_manager.py:772 — SkillManager._scan_tier 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 · swarm_out._start_session (cyclomatic 18) · ×1
  • swarm_out._start_session (cyclomatic 18) backend/core/swarm_out.py:1029 — swarm_out._start_session 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 · swarm_out_actor.commits_here (cyclomatic 18) · ×1
  • swarm_out_actor.commits_here (cyclomatic 18) backend/core/swarm_out_actor.py:322 — swarm_out_actor.commits_here 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 · swarm_out_model.align (cyclomatic 18) · ×1
  • swarm_out_model.align (cyclomatic 18) backend/core/swarm_out_model.py:68 — swarm_out_model.align 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 · RelayManager._handle (cyclomatic 18) · ×1
  • RelayManager._handle (cyclomatic 18) backend/core/swarm_out_relay.py:223 — RelayManager._handle 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 · transcript_usage._scan (cyclomatic 18) · ×1
  • transcript_usage._scan (cyclomatic 18) backend/core/transcript_usage.py:92 — transcript_usage._scan has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · turn_changes._group (cyclomatic 18) · ×1
  • turn_changes._group (cyclomatic 18) backend/core/turn_changes.py:549 — turn_changes._group 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 · worktree_write_gate._ref_writes (cyclomatic 18) · ×1
  • worktree_write_gate._ref_writes (cyclomatic 18) backend/core/worktree_write_gate.py:403 — worktree_write_gate._ref_writes 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 · ContextHealthHook._detect_stale_memory_claims (cyclomatic 18) · ×1
  • ContextHealthHook._detect_stale_memory_claims (cyclomatic 18) backend/hooks/context_health_hook.py:1205 — ContextHealthHook._detect_stale_memory_claims 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 · data_point_folding._fold_one_family (cyclomatic 18) · ×1
  • data_point_folding._fold_one_family (cyclomatic 18) backend/hooks/data_point_folding.py:201 — data_point_folding._fold_one_family 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 · session_quality.score_window (cyclomatic 18) · ×1
  • session_quality.score_window (cyclomatic 18) backend/jobs/handlers/session_quality.py:271 — session_quality.score_window has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · model_resolve.resolve_job_model (cyclomatic 18) · ×1
  • model_resolve.resolve_job_model (cyclomatic 18) backend/jobs/model_resolve.py:33 — model_resolve.resolve_job_model 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 · workspace_api.rename_item (cyclomatic 18) · ×1
  • workspace_api.rename_item (cyclomatic 18) backend/routers/workspace_api.py:2175 — workspace_api.rename_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 · cdf_replay_invalid.candidates (cyclomatic 18) · ×1
  • cdf_replay_invalid.candidates (cyclomatic 18) backend/scripts/cdf_replay_invalid.py:62 — cdf_replay_invalid.candidates 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 · cleanup_message_history.main (cyclomatic 18) · ×1
  • cleanup_message_history.main (cyclomatic 18) backend/scripts/cleanup_message_history.py:107 — cleanup_message_history.main 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 · da_resummarize.plan_days (cyclomatic 18) · ×1
  • da_resummarize.plan_days (cyclomatic 18) backend/scripts/da_resummarize.py:272 — da_resummarize.plan_days 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 · eval_runner.run_eval (cyclomatic 18) · ×1
  • eval_runner.run_eval (cyclomatic 18) backend/scripts/eval_runner.py:2122 — eval_runner.run_eval 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 · knowledge_usage_report.scan_transcript (cyclomatic 18) · ×1
  • knowledge_usage_report.scan_transcript (cyclomatic 18) backend/scripts/knowledge_usage_report.py:80 — knowledge_usage_report.scan_transcript 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 · publish_dashboard.generate_html (cyclomatic 18) · ×1
  • publish_dashboard.generate_html (cyclomatic 18) backend/skills/s_pollinate/scripts/publish_dashboard.py:194 — publish_dashboard.generate_html 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 · ai_ready_helpers.generate_learning_tour (cyclomatic 18) · ×1
  • ai_ready_helpers.generate_learning_tour (cyclomatic 18) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1053 — ai_ready_helpers.generate_learning_tour 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 · ai_ready_helpers.run_multi_package (cyclomatic 18) · ×1
  • ai_ready_helpers.run_multi_package (cyclomatic 18) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1139 — ai_ready_helpers.run_multi_package 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 · ErrorBoundary.ApiError (cyclomatic 18) · ×1
  • ErrorBoundary.ApiError (cyclomatic 18) desktop/src/components/common/ErrorBoundary.tsx:185 — ErrorBoundary.ApiError has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 2 function items inside it that branch (getErrorIcon, getErrorColor). 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 · useChatStreamingLifecycle.useChatStreamingLifecycle.applyActivity (cyclomatic 18) · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle.applyActivity (cyclomatic 18) desktop/src/hooks/useChatStreamingLifecycle.ts:1923 — useChatStreamingLifecycle.useChatStreamingLifecycle.applyActivity has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · useChatStreamingLifecycle.useChatStreamingLifecycle.createCompleteHandler (cyclomatic 18) · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle.createCompleteHandler (cyclomatic 18) desktop/src/hooks/useChatStreamingLifecycle.ts:4399 — useChatStreamingLifecycle.useChatStreamingLifecycle.createCompleteHandler has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to one function item inside it that branches (inner). 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 · chat.consumeSSEStream (cyclomatic 18) · ×1
  • chat.consumeSSEStream (cyclomatic 18) desktop/src/services/chat.ts:319 — chat.consumeSSEStream 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 · AttachedFileChips.AttachedFileChips (cyclomatic 18) · ×1
  • AttachedFileChips.AttachedFileChips (cyclomatic 18) desktop/src/components/chat/AttachedFileChips.tsx:176 — AttachedFileChips.AttachedFileChips has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to 6 function items inside it that branch (handleContainerKeyDown, a function literal at line 200, handleContainerFocus, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · RunList.RunList (cyclomatic 18) · ×1
  • RunList.RunList (cyclomatic 18) desktop/src/components/swarm-out/RunList.tsx:118 — RunList.RunList has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to 4 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 · CdfUnitFeed.CdfUnitFeed (cyclomatic 18) · ×1
  • CdfUnitFeed.CdfUnitFeed (cyclomatic 18) desktop/src/components/layout/CdfUnitFeed.tsx:39 — CdfUnitFeed.CdfUnitFeed has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a 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 · CMBrainOverlay.NorthStarRail (cyclomatic 18) · ×1
  • CMBrainOverlay.NorthStarRail (cyclomatic 18) desktop/src/components/layout/CMBrainOverlay.tsx:307 — CMBrainOverlay.NorthStarRail 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 · BrainLearnedView.BrainLearnedView (cyclomatic 18) · ×1
  • BrainLearnedView.BrainLearnedView (cyclomatic 18) desktop/src/components/layout/BrainLearnedView.tsx:54 — BrainLearnedView.BrainLearnedView has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · BrainHub.BrainBrowse (cyclomatic 18) · ×1
  • BrainHub.BrainBrowse (cyclomatic 18) desktop/src/components/layout/BrainHub.tsx:699 — BrainHub.BrainBrowse has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 belong to 4 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · PipelineOverlay.Row (cyclomatic 18) · ×1
  • PipelineOverlay.Row (cyclomatic 18) desktop/src/components/layout/PipelineOverlay.tsx:88 — PipelineOverlay.Row has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CasesTab.RunMenu (cyclomatic 18) · ×1
  • CasesTab.RunMenu (cyclomatic 18) desktop/src/pages/eval/CasesTab.tsx:133 — CasesTab.RunMenu has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 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 · CanvasChanges.ChangesDetail (cyclomatic 18) · ×1
  • CanvasChanges.ChangesDetail (cyclomatic 18) desktop/src/components/file-viewer/CanvasChanges.tsx:323 — CanvasChanges.ChangesDetail has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · sentenceSplitter.extractSentences (cyclomatic 18) · ×1
  • sentenceSplitter.extractSentences (cyclomatic 18) desktop/src/utils/sentenceSplitter.ts:127 — sentenceSplitter.extractSentences 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 · SessionTabBar.SessionTabBar (cyclomatic 18) · ×1
  • SessionTabBar.SessionTabBar (cyclomatic 18) desktop/src/pages/chat/components/SessionTabBar.tsx:27 — SessionTabBar.SessionTabBar has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 69, 40, 48, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ariaPerceive (cyclomatic 18) · ×1
  • ariaPerceive (cyclomatic 18) backend/skills/s_browser-agent/aria-perceive.mjs:110 — ariaPerceive has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 belong to 3 function literals inside it that branch. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · SlackChannelAdapter._normalize_event (cyclomatic 17) · ×1
  • SlackChannelAdapter._normalize_event (cyclomatic 17) REDACTED:587 — SlackChannelAdapter._normalize_event 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 · addressing._sections (cyclomatic 17) · ×1
  • addressing._sections (cyclomatic 17) backend/core/addressing.py:267 — addressing._sections 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 · attention_authority._collect_paused_runs (cyclomatic 17) · ×1
  • attention_authority._collect_paused_runs (cyclomatic 17) backend/core/attention_authority.py:262 — attention_authority._collect_paused_runs 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 · attention_authority._collect_local_roots (cyclomatic 17) · ×1
  • attention_authority._collect_local_roots (cyclomatic 17) backend/core/attention_authority.py:630 — attention_authority._collect_local_roots 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 · aws_signin.prune (cyclomatic 17) · ×1
  • aws_signin.prune (cyclomatic 17) backend/core/aws_signin.py:366 — aws_signin.prune 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 · Evidence.check (cyclomatic 17) · ×1
  • Evidence.check (cyclomatic 17) backend/core/brain_bootstrap/apply.py:148 — Evidence.check 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 · docs._signals (cyclomatic 17) · ×1
  • docs._signals (cyclomatic 17) backend/core/brain_bootstrap/docs.py:186 — docs._signals 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 · freshness.check_freshness (cyclomatic 17) · ×1
  • freshness.check_freshness (cyclomatic 17) backend/core/code_intel/freshness.py:55 — freshness.check_freshness 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 · parser._build_file_scope_regex (cyclomatic 17) · ×1
  • parser._build_file_scope_regex (cyclomatic 17) backend/core/code_intel/parser.py:966 — parser._build_file_scope_regex 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 · parser._get_name (cyclomatic 17) · ×1
  • parser._get_name (cyclomatic 17) backend/core/code_intel/parser.py:1642 — parser._get_name 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 · FileTypes._java_value (cyclomatic 17) · ×1
  • FileTypes._java_value (cyclomatic 17) backend/core/code_intel/receivers.py:588 — FileTypes._java_value 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 · cognition.find (cyclomatic 17) · ×1
  • cognition.find (cyclomatic 17) backend/core/cognition.py:310 — cognition.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 · CompactionGuard.check (cyclomatic 17) · ×1
  • CompactionGuard.check (cyclomatic 17) backend/core/compaction_guard.py:621 — CompactionGuard.check 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 · hive_boot._open_turn (cyclomatic 17) · ×1
  • hive_boot._open_turn (cyclomatic 17) backend/core/hive_boot.py:68 — hive_boot._open_turn 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 · hive_records._valid_entry (cyclomatic 17) · ×1
  • hive_records._valid_entry (cyclomatic 17) backend/core/hive_records.py:743 — hive_records._valid_entry 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 · hive_return.land (cyclomatic 17) · ×1
  • hive_return.land (cyclomatic 17) backend/core/hive_return.py:560 — hive_return.land 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 · provenance.resolve_evidence (cyclomatic 17) · ×1
  • provenance.resolve_evidence (cyclomatic 17) backend/core/ingestion/provenance.py:282 — provenance.resolve_evidence 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 · queries.list_items (cyclomatic 17) · ×1
  • queries.list_items (cyclomatic 17) backend/core/ingestion/queries.py:185 — queries.list_items 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 · knowledge_store.chunk_markdown (cyclomatic 17) · ×1
  • knowledge_store.chunk_markdown (cyclomatic 17) backend/core/knowledge_store.py:105 — knowledge_store.chunk_markdown 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 · LifecycleManager._scan_unprocessed_sessions (cyclomatic 17) · ×1
  • LifecycleManager._scan_unprocessed_sessions (cyclomatic 17) backend/core/lifecycle_manager.py:1717 — LifecycleManager._scan_unprocessed_sessions 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 · output_degeneration.find_degenerate_run (cyclomatic 17) · ×1
  • output_degeneration.find_degenerate_run (cyclomatic 17) backend/core/output_degeneration.py:188 — output_degeneration.find_degenerate_run has cyclomatic complexity 17 (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 · _Builder.command_row (cyclomatic 17) · ×1
  • _Builder.command_row (cyclomatic 17) backend/core/project_agent_draft.py:311 — _Builder.command_row 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 · prompt_builder._reaches_this_machine (cyclomatic 17) · ×1
  • prompt_builder._reaches_this_machine (cyclomatic 17) REDACTED:590 — prompt_builder._reaches_this_machine 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 · recall_multi.recall_ddd (cyclomatic 17) · ×1
  • recall_multi.recall_ddd (cyclomatic 17) backend/core/recall_multi.py:1206 — recall_multi.recall_ddd 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 · recall_multi.detect_active_project (cyclomatic 17) · ×1
  • recall_multi.detect_active_project (cyclomatic 17) backend/core/recall_multi.py:1400 — recall_multi.detect_active_project 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 · repo_guidance._targets (cyclomatic 17) · ×1
  • repo_guidance._targets (cyclomatic 17) backend/core/repo_guidance.py:288 — repo_guidance._targets 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 · repo_placement.clone_into_workspace (cyclomatic 17) · ×1
  • repo_placement.clone_into_workspace (cyclomatic 17) backend/core/repo_placement.py:309 — repo_placement.clone_into_workspace 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 · RunEngine.write_projection (cyclomatic 17) · ×1
  • RunEngine.write_projection (cyclomatic 17) backend/core/run_protocol/engine.py:1117 — RunEngine.write_projection 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 · RunEngine._resolve_reported_tests (cyclomatic 17) · ×1
  • RunEngine._resolve_reported_tests (cyclomatic 17) backend/core/run_protocol/engine.py:1636 — RunEngine._resolve_reported_tests 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 · RunEngine._knowledge_summary (cyclomatic 17) · ×1
  • RunEngine._knowledge_summary (cyclomatic 17) backend/core/run_protocol/engine.py:3458 — RunEngine._knowledge_summary 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 · run_worktree.sync (cyclomatic 17) · ×1
  • run_worktree.sync (cyclomatic 17) backend/core/run_worktree.py:726 — run_worktree.sync 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 · run_worktree._sweep_branches (cyclomatic 17) · ×1
  • run_worktree._sweep_branches (cyclomatic 17) backend/core/run_worktree.py:1922 — run_worktree._sweep_branches 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 · security_hooks._segment_discards (cyclomatic 17) · ×1
  • security_hooks._segment_discards (cyclomatic 17) backend/core/security_hooks.py:1625 — security_hooks._segment_discards 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 · security_hooks._sudo_session_link (cyclomatic 17) · ×1
  • security_hooks._sudo_session_link (cyclomatic 17) backend/core/security_hooks.py:4652 — security_hooks._sudo_session_link 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 · session_registry.kill_all_claude_processes (cyclomatic 17) · ×1
  • session_registry.kill_all_claude_processes (cyclomatic 17) backend/core/session_registry.py:176 — session_registry.kill_all_claude_processes 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 · SessionRouter._steer_blocker (cyclomatic 17) · ×1
  • SessionRouter._steer_blocker (cyclomatic 17) backend/core/session_router.py:4553 — SessionRouter._steer_blocker 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 · SessionUnit._pid_watchdog_loop (cyclomatic 17) · ×1
  • SessionUnit._pid_watchdog_loop (cyclomatic 17) backend/core/session_unit.py:1842 — SessionUnit._pid_watchdog_loop 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 · SessionUnit._check_mcp_health (cyclomatic 17) · ×1
  • SessionUnit._check_mcp_health (cyclomatic 17) backend/core/session_unit.py:3739 — SessionUnit._check_mcp_health 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 · SessionUnit.continue_with_answer (cyclomatic 17) · ×1
  • SessionUnit.continue_with_answer (cyclomatic 17) backend/core/session_unit.py:4488 — SessionUnit.continue_with_answer 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 · swarm_out._clean_decision (cyclomatic 17) · ×1
  • swarm_out._clean_decision (cyclomatic 17) backend/core/swarm_out.py:1156 — swarm_out._clean_decision 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 · swarm_out_settle._code (cyclomatic 17) · ×1
  • swarm_out_settle._code (cyclomatic 17) backend/core/swarm_out_settle.py:286 — swarm_out_settle._code 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 · swarm_out_wake.wake_sessions (cyclomatic 17) · ×1
  • swarm_out_wake.wake_sessions (cyclomatic 17) backend/core/swarm_out_wake.py:142 — swarm_out_wake.wake_sessions 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 · SwarmWorkspaceManager._seed_hive_from_package (cyclomatic 17) · ×1
  • SwarmWorkspaceManager._seed_hive_from_package (cyclomatic 17) backend/core/swarm_workspace_manager.py:1267 — SwarmWorkspaceManager._seed_hive_from_package 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 · ui_actions.format_attention_for_agent (cyclomatic 17) · ×1
  • ui_actions.format_attention_for_agent (cyclomatic 17) backend/core/ui_actions.py:296 — ui_actions.format_attention_for_agent 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 · github_trending.fetch_github_trending (cyclomatic 17) · ×1
  • github_trending.fetch_github_trending (cyclomatic 17) backend/jobs/adapters/github_trending.py:47 — github_trending.fetch_github_trending 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 · executor._handle_script (cyclomatic 17) · ×1
  • executor._handle_script (cyclomatic 17) REDACTED:1027 — executor._handle_script 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 · code_intel_reindex.reindex_projects (cyclomatic 17) · ×1
  • code_intel_reindex.reindex_projects (cyclomatic 17) backend/jobs/handlers/code_intel_reindex.py:61 — code_intel_reindex.reindex_projects 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 · pipelines._card_facts (cyclomatic 17) · ×1
  • pipelines._card_facts (cyclomatic 17) backend/routers/pipelines.py:351 — pipelines._card_facts 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 · pollinate._build_card (cyclomatic 17) · ×1
  • pollinate._build_card (cyclomatic 17) backend/routers/pollinate.py:490 — pollinate._build_card 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 · system.get_system_status (cyclomatic 17) · ×1
  • system.get_system_status (cyclomatic 17) backend/routers/system.py:164 — system.get_system_status 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 · system._probe_ada_details (cyclomatic 17) · ×1
  • system._probe_ada_details (cyclomatic 17) backend/routers/system.py:680 — system._probe_ada_details 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 · workspace.upload_file (cyclomatic 17) · ×1
  • workspace.upload_file (cyclomatic 17) backend/routers/workspace.py:643 — workspace.upload_file 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 · workspace_api.put_workspace_file (cyclomatic 17) · ×1
  • workspace_api.put_workspace_file (cyclomatic 17) backend/routers/workspace_api.py:1822 — workspace_api.put_workspace_file 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 · migrate_skills.migrate_skill (cyclomatic 17) · ×1
  • migrate_skills.migrate_skill (cyclomatic 17) backend/scripts/migrate_skills.py:400 — migrate_skills.migrate_skill 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 · scan.main (cyclomatic 17) · ×1
  • scan.main (cyclomatic 17) backend/skills/s_context-hygiene/scripts/scan.py:213 — scan.main 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 · distribute.main (cyclomatic 17) · ×1
  • distribute.main (cyclomatic 17) backend/skills/s_ddd-distribute/scripts/distribute.py:53 — distribute.main 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 · format_recommend.recommend (cyclomatic 17) · ×1
  • format_recommend.recommend (cyclomatic 17) backend/skills/s_pollinate/scripts/format_recommend.py:158 — format_recommend.recommend 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 · publish_meta.generate_publish_info (cyclomatic 17) · ×1
  • publish_meta.generate_publish_info (cyclomatic 17) backend/skills/s_pollinate/scripts/publish_meta.py:150 — publish_meta.generate_publish_info 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 · style-extract.extract_fonts (cyclomatic 17) · ×1
  • style-extract.extract_fonts (cyclomatic 17) backend/skills/s_pptx/scripts/style-extract.py:53 — style-extract.extract_fonts 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 · sessionEvents.createSessionEventsClient.dispatch (cyclomatic 17) · ×1
  • sessionEvents.createSessionEventsClient.dispatch (cyclomatic 17) desktop/src/services/sessionEvents.ts:104 — sessionEvents.createSessionEventsClient.dispatch 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 · chat.toStreamingStateEntry (cyclomatic 17) · ×1
  • chat.toStreamingStateEntry (cyclomatic 17) desktop/src/services/chat.ts:574 — chat.toStreamingStateEntry has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a 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 · TurnZones.useSettled (cyclomatic 17) · ×1
  • TurnZones.useSettled (cyclomatic 17) desktop/src/pages/chat/components/TurnZones.tsx:160 — TurnZones.useSettled has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 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 · HistoryOverlay.HistoryContent (cyclomatic 17) · ×1
  • HistoryOverlay.HistoryContent (cyclomatic 17) desktop/src/components/layout/HistoryOverlay.tsx:60 — HistoryOverlay.HistoryContent has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 89, a function literal at line 115, a function literal at line 136, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · LibraryHealth.LibraryHealth (cyclomatic 17) · ×1
  • LibraryHealth.LibraryHealth (cyclomatic 17) desktop/src/components/layout/LibraryHealth.tsx:42 — LibraryHealth.LibraryHealth has cyclomatic complexity 17 (threshold 15). Of this number, 9 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · BrainHub.BrainHeader (cyclomatic 17) · ×1
  • BrainHub.BrainHeader (cyclomatic 17) desktop/src/components/layout/BrainHub.tsx:278 — BrainHub.BrainHeader has cyclomatic complexity 17 (threshold 15). Of this number, 13 points are the body's own statements and 4 belong to 4 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ConnectAccount.MoreWays (cyclomatic 17) · ×1
  • ConnectAccount.MoreWays (cyclomatic 17) desktop/src/components/awsAccount/ConnectAccount.tsx:840 — ConnectAccount.MoreWays has cyclomatic complexity 17 (threshold 15). Of this number, 10 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · adversarial_meta.check_adversarial_health (cyclomatic 16) · ×1
  • adversarial_meta.check_adversarial_health (cyclomatic 16) backend/core/adversarial_meta.py:31 — adversarial_meta.check_adversarial_health 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 · attention_authority._collect_db_recovery (cyclomatic 16) · ×1
  • attention_authority._collect_db_recovery (cyclomatic 16) backend/core/attention_authority.py:390 — attention_authority._collect_db_recovery 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 · BackupManager._restore_impl (cyclomatic 16) · ×1
  • BackupManager._restore_impl (cyclomatic 16) backend/core/backup_manager.py:523 — BackupManager._restore_impl 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 · brain_eval.used (cyclomatic 16) · ×1
  • brain_eval.used (cyclomatic 16) backend/core/brain_eval.py:254 — brain_eval.used 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 · brain_knowledge._withdrawn (cyclomatic 16) · ×1
  • brain_knowledge._withdrawn (cyclomatic 16) backend/core/brain_knowledge.py:236 — brain_knowledge._withdrawn 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 · brain_teardown._ownership (cyclomatic 16) · ×1
  • brain_teardown._ownership (cyclomatic 16) backend/core/brain_teardown.py:87 — brain_teardown._ownership 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 · _Breaks.new_calls (cyclomatic 16) · ×1
  • _Breaks.new_calls (cyclomatic 16) backend/core/code_intel/changed.py:535 — _Breaks.new_calls 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 · interface._code_hash (cyclomatic 16) · ×1
  • interface._code_hash (cyclomatic 16) backend/core/code_intel/interface.py:155 — interface._code_hash 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 · interface._self_attrs (cyclomatic 16) · ×1
  • interface._self_attrs (cyclomatic 16) backend/core/code_intel/interface.py:541 — interface._self_attrs 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 · parser._call_parts (cyclomatic 16) · ×1
  • parser._call_parts (cyclomatic 16) backend/core/code_intel/parser.py:1780 — parser._call_parts 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 · cognition.render_hit (cyclomatic 16) · ×1
  • cognition.render_hit (cyclomatic 16) backend/core/cognition.py:644 — cognition.render_hit 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 · community_data.build_feed (cyclomatic 16) · ×1
  • community_data.build_feed (cyclomatic 16) backend/core/community_data.py:274 — community_data.build_feed 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 · ddd_bindings.describe_project_ddd_line (cyclomatic 16) · ×1
  • ddd_bindings.describe_project_ddd_line (cyclomatic 16) backend/core/ddd_bindings.py:860 — ddd_bindings.describe_project_ddd_line 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 · ddd_packager._scan_text (cyclomatic 16) · ×1
  • ddd_packager._scan_text (cyclomatic 16) backend/core/ddd_packager.py:254 — ddd_packager._scan_text 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 · ddd_packager.emit_target_aim (cyclomatic 16) · ×1
  • ddd_packager.emit_target_aim (cyclomatic 16) backend/core/ddd_packager.py:1525 — ddd_packager.emit_target_aim 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 · heartbeat._pending_c_wait (cyclomatic 16) · ×1
  • heartbeat._pending_c_wait (cyclomatic 16) backend/core/heartbeat.py:203 — heartbeat._pending_c_wait 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 · hive_bundle.make (cyclomatic 16) · ×1
  • hive_bundle.make (cyclomatic 16) backend/core/hive_bundle.py:66 — hive_bundle.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 · hive_return.file_versions (cyclomatic 16) · ×1
  • hive_return.file_versions (cyclomatic 16) backend/core/hive_return.py:496 — hive_return.file_versions 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 · hive_workspace._parse_checks (cyclomatic 16) · ×1
  • hive_workspace._parse_checks (cyclomatic 16) backend/core/hive_workspace.py:435 — hive_workspace._parse_checks 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 · cognition_level.audit (cyclomatic 16) · ×1
  • cognition_level.audit (cyclomatic 16) backend/core/ingestion/cognition_level.py:292 — cognition_level.audit 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 · governed_edit.recover_tree_plan (cyclomatic 16) · ×1
  • governed_edit.recover_tree_plan (cyclomatic 16) backend/core/ingestion/governed_edit.py:381 — governed_edit.recover_tree_plan 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 · s1_user.submit_units (cyclomatic 16) · ×1
  • s1_user.submit_units (cyclomatic 16) backend/core/ingestion/sources/s1_user.py:46 — s1_user.submit_units 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 · s7_review.apply_relations (cyclomatic 16) · ×1
  • s7_review.apply_relations (cyclomatic 16) backend/core/ingestion/sources/s7_review.py:556 — s7_review.apply_relations 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 · usage._bash_paths (cyclomatic 16) · ×1
  • usage._bash_paths (cyclomatic 16) backend/core/ingestion/usage.py:292 — usage._bash_paths 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 · writer._recover_plan (cyclomatic 16) · ×1
  • writer._recover_plan (cyclomatic 16) backend/core/ingestion/writer.py:956 — writer._recover_plan 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 · LifecycleManager._get_mcp_server_patterns (cyclomatic 16) · ×1
  • LifecycleManager._get_mcp_server_patterns (cyclomatic 16) backend/core/lifecycle_manager.py:1991 — LifecycleManager._get_mcp_server_patterns 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 · project_agent_session.advance_pipeline_pin (cyclomatic 16) · ×1
  • project_agent_session.advance_pipeline_pin (cyclomatic 16) backend/core/project_agent_session.py:156 — project_agent_session.advance_pipeline_pin 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 · auth.normalize_bindings (cyclomatic 16) · ×1
  • auth.normalize_bindings (cyclomatic 16) backend/core/run_protocol/auth.py:59 — auth.normalize_bindings 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 · RunEngine._gate0_disposition (cyclomatic 16) · ×1
  • RunEngine._gate0_disposition (cyclomatic 16) backend/core/run_protocol/engine.py:1306 — RunEngine._gate0_disposition 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 · RunEngine._answered_decisions (cyclomatic 16) · ×1
  • RunEngine._answered_decisions (cyclomatic 16) backend/core/run_protocol/engine.py:1809 — RunEngine._answered_decisions 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 · RunEngine._prepare_land_request (cyclomatic 16) · ×1
  • RunEngine._prepare_land_request (cyclomatic 16) backend/core/run_protocol/engine.py:2102 — RunEngine._prepare_land_request 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 · RunEngine._resume_normal_landing (cyclomatic 16) · ×1
  • RunEngine._resume_normal_landing (cyclomatic 16) backend/core/run_protocol/engine.py:3657 — RunEngine._resume_normal_landing 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 · engine._comment_only_diff (cyclomatic 16) · ×1
  • engine._comment_only_diff (cyclomatic 16) backend/core/run_protocol/engine.py:198 — engine._comment_only_diff 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 · landing.prepare_request (cyclomatic 16) · ×1
  • landing.prepare_request (cyclomatic 16) backend/core/run_protocol/landing.py:90 — landing.prepare_request 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 · landing.execute_request (cyclomatic 16) · ×1
  • landing.execute_request (cyclomatic 16) backend/core/run_protocol/landing.py:686 — landing.execute_request 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 · ReviewOrchestrator.handout_spec (cyclomatic 16) · ×1
  • ReviewOrchestrator.handout_spec (cyclomatic 16) backend/core/run_protocol/review.py:704 — ReviewOrchestrator.handout_spec 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 · run_knowledge._render (cyclomatic 16) · ×1
  • run_knowledge._render (cyclomatic 16) backend/core/run_protocol/run_knowledge.py:284 — run_knowledge._render 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 · runtime_hooks._runner_runs_tests (cyclomatic 16) · ×1
  • runtime_hooks._runner_runs_tests (cyclomatic 16) backend/core/runtime_hooks.py:191 — runtime_hooks._runner_runs_tests 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 · runtime_hooks._extract_pipeline_id (cyclomatic 16) · ×1
  • runtime_hooks._extract_pipeline_id (cyclomatic 16) backend/core/runtime_hooks.py:578 — runtime_hooks._extract_pipeline_id 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 · _LinkScan.stdin_hit (cyclomatic 16) · ×1
  • _LinkScan.stdin_hit (cyclomatic 16) backend/core/security_hooks.py:4921 — _LinkScan.stdin_hit 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 · security_hooks._cd_segment_target (cyclomatic 16) · ×1
  • security_hooks._cd_segment_target (cyclomatic 16) backend/core/security_hooks.py:4356 — security_hooks._cd_segment_target 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 · security_hooks._audit_bash_hit (cyclomatic 16) · ×1
  • security_hooks._audit_bash_hit (cyclomatic 16) backend/core/security_hooks.py:5561 — security_hooks._audit_bash_hit has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · session_landings._scan (cyclomatic 16) · ×1
  • session_landings._scan (cyclomatic 16) backend/core/session_landings.py:131 — session_landings._scan has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · session_landings.landed_path (cyclomatic 16) · ×1
  • session_landings.landed_path (cyclomatic 16) backend/core/session_landings.py:287 — session_landings.landed_path 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 · StreamingOrchestrator._pipeline_stage_events (cyclomatic 16) · ×1
  • StreamingOrchestrator._pipeline_stage_events (cyclomatic 16) backend/core/streaming_orchestrator.py:433 — StreamingOrchestrator._pipeline_stage_events 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 · StreamingOrchestrator._subagent_progress_event (cyclomatic 16) · ×1
  • StreamingOrchestrator._subagent_progress_event (cyclomatic 16) backend/core/streaming_orchestrator.py:1047 — StreamingOrchestrator._subagent_progress_event 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 · Bridge.tick (cyclomatic 16) · ×1
  • Bridge.tick (cyclomatic 16) REDACTED:402 — Bridge.tick 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 · swarm_out_record.observed (cyclomatic 16) · ×1
  • swarm_out_record.observed (cyclomatic 16) backend/core/swarm_out_record.py:116 — swarm_out_record.observed 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 · swarm_out_record.actionable (cyclomatic 16) · ×1
  • swarm_out_record.actionable (cyclomatic 16) backend/core/swarm_out_record.py:490 — swarm_out_record.actionable 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 · swarm_out_results._take_check_records (cyclomatic 16) · ×1
  • swarm_out_results._take_check_records (cyclomatic 16) backend/core/swarm_out_results.py:795 — swarm_out_results._take_check_records 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 · swarm_out_results._public_agent (cyclomatic 16) · ×1
  • swarm_out_results._public_agent (cyclomatic 16) backend/core/swarm_out_results.py:1093 — swarm_out_results._public_agent 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 · swarm_out_settle.annotate (cyclomatic 16) · ×1
  • swarm_out_settle.annotate (cyclomatic 16) backend/core/swarm_out_settle.py:693 — swarm_out_settle.annotate 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 · swarm_out_wait_card._forward (cyclomatic 16) · ×1
  • swarm_out_wait_card._forward (cyclomatic 16) backend/core/swarm_out_wait_card.py:280 — swarm_out_wait_card._forward 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 · swarm_out_wait_card._mapped (cyclomatic 16) · ×1
  • swarm_out_wait_card._mapped (cyclomatic 16) backend/core/swarm_out_wait_card.py:315 — swarm_out_wait_card._mapped 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 · swarm_run_conductor._children_to_close (cyclomatic 16) · ×1
  • swarm_run_conductor._children_to_close (cyclomatic 16) backend/core/swarm_run_conductor.py:55 — swarm_run_conductor._children_to_close 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 · SQLiteDatabase._run_data_cleanups (cyclomatic 16) · ×1
  • SQLiteDatabase._run_data_cleanups (cyclomatic 16) backend/database/sqlite.py:3970 — SQLiteDatabase._run_data_cleanups 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 · desktop_main.main (cyclomatic 16) · ×1
  • desktop_main.main (cyclomatic 16) REDACTED:490 — desktop_main.main 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 · HiveProvisioner.update (cyclomatic 16) · ×1
  • HiveProvisioner.update (cyclomatic 16) backend/hive/provisioner.py:1425 — HiveProvisioner.update 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 · ContextHealthHook._check_governance_budgets (cyclomatic 16) · ×1
  • ContextHealthHook._check_governance_budgets (cyclomatic 16) backend/hooks/context_health_hook.py:1530 — ContextHealthHook._check_governance_budgets 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 · brain_mistake_audit._render (cyclomatic 16) · ×1
  • brain_mistake_audit._render (cyclomatic 16) backend/jobs/handlers/brain_mistake_audit.py:573 — brain_mistake_audit._render has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · session_health_probe.run_session_health_probe (cyclomatic 16) · ×1
  • session_health_probe.run_session_health_probe (cyclomatic 16) REDACTED:201 — session_health_probe.run_session_health_probe 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 · scheduler.load_user_context (cyclomatic 16) · ×1
  • scheduler.load_user_context (cyclomatic 16) backend/jobs/scheduler.py:252 — scheduler.load_user_context 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 · self_tune.track_signal_usage (cyclomatic 16) · ×1
  • self_tune.track_signal_usage (cyclomatic 16) backend/jobs/self_tune.py:203 — self_tune.track_signal_usage has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · self_tune.suggest_new_feeds (cyclomatic 16) · ×1
  • self_tune.suggest_new_feeds (cyclomatic 16) backend/jobs/self_tune.py:376 — self_tune.suggest_new_feeds 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 · eval._build_learning_dashboard (cyclomatic 16) · ×1
  • eval._build_learning_dashboard (cyclomatic 16) backend/routers/eval.py:434 — eval._build_learning_dashboard 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 · check_migration_class.check_migration_class (cyclomatic 16) · ×1
  • check_migration_class.check_migration_class (cyclomatic 16) backend/scripts/check_migration_class.py:197 — check_migration_class.check_migration_class 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 · da_resummarize.shorten_sentences (cyclomatic 16) · ×1
  • da_resummarize.shorten_sentences (cyclomatic 16) backend/scripts/da_resummarize.py:535 — da_resummarize.shorten_sentences 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 · degeneration_dataset_eval.main (cyclomatic 16) · ×1
  • degeneration_dataset_eval.main (cyclomatic 16) backend/scripts/degeneration_dataset_eval.py:97 — degeneration_dataset_eval.main 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 · eval_runner.eval_trajectory (cyclomatic 16) · ×1
  • eval_runner.eval_trajectory (cyclomatic 16) backend/scripts/eval_runner.py:525 — eval_runner.eval_trajectory 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 · eval_runner._load_rules_context (cyclomatic 16) · ×1
  • eval_runner._load_rules_context (cyclomatic 16) backend/scripts/eval_runner.py:916 — eval_runner._load_rules_context 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 · scenario_runner.parse_steps (cyclomatic 16) · ×1
  • scenario_runner.parse_steps (cyclomatic 16) backend/scripts/scenario_runner.py:183 — scenario_runner.parse_steps 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 · DocxXMLEditor._inject_attributes_to_nodes (cyclomatic 16) · ×1
  • DocxXMLEditor._inject_attributes_to_nodes (cyclomatic 16) backend/skills/s_docx/scripts/document.py:116 — DocxXMLEditor._inject_attributes_to_nodes has cyclomatic complexity 16 (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 · ShapeData.__init__ (cyclomatic 16) · ×1
  • ShapeData.__init__ (cyclomatic 16) backend/skills/s_pptx/scripts/inventory.py:388 — ShapeData.__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 · ai_ready_helpers.render_agents_md (cyclomatic 16) · ×1
  • ai_ready_helpers.render_agents_md (cyclomatic 16) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:463 — ai_ready_helpers.render_agents_md 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 · DeckViewer.DeckViewer (cyclomatic 16) · ×1
  • DeckViewer.DeckViewer (cyclomatic 16) backend/apps/pptx-maker/package/upstream/kirocrew/website/src/apps/pptx-maker/DeckViewer.tsx:119 — DeckViewer.DeckViewer has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · api.fromStatus (cyclomatic 16) · ×1
  • api.fromStatus (cyclomatic 16) desktop/src/services/api.ts:88 — api.fromStatus 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 · BottomBar.BottomBar (cyclomatic 16) · ×1
  • BottomBar.BottomBar (cyclomatic 16) desktop/src/components/layout/BottomBar.tsx:24 — BottomBar.BottomBar has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 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 · todos.toSnakeCase (cyclomatic 16) · ×1
  • todos.toSnakeCase (cyclomatic 16) desktop/src/services/todos.ts:53 — todos.toSnakeCase 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 · useChatStreamingLifecycle.useChatStreamingLifecycle.applyContextUsage (cyclomatic 16) · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle.applyContextUsage (cyclomatic 16) desktop/src/hooks/useChatStreamingLifecycle.ts:1628 — useChatStreamingLifecycle.useChatStreamingLifecycle.applyContextUsage 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 · useChatStreamingLifecycle.useChatStreamingLifecycle.setLocalSending (cyclomatic 16) · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle.setLocalSending (cyclomatic 16) desktop/src/hooks/useChatStreamingLifecycle.ts:1710 — useChatStreamingLifecycle.useChatStreamingLifecycle.setLocalSending 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 · agents.toSnakeCase (cyclomatic 16) · ×1
  • agents.toSnakeCase (cyclomatic 16) desktop/src/services/agents.ts:5 — agents.toSnakeCase 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 · AttachmentPreviewCard.AttachmentPreviewCard (cyclomatic 16) · ×1
  • AttachmentPreviewCard.AttachmentPreviewCard (cyclomatic 16) desktop/src/components/chat/AttachmentPreviewCard.tsx:40 — AttachmentPreviewCard.AttachmentPreviewCard 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 · runReview.sections (cyclomatic 16) · ×1
  • runReview.sections (cyclomatic 16) desktop/src/components/swarm-out/runReview.ts:154 — runReview.sections has cyclomatic complexity 16 (threshold 15). Of this number, 14 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 · RunOverlay.CommandPanel · ×1
  • RunOverlay.CommandPanel::cmd (cyclomatic 16) desktop/src/components/swarm-out/RunOverlay.tsx:537 — RunOverlay.CommandPanel::cmd 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 (RunOverlay.CommandPanel) 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 · CdfUnitFeed.DecisionLine (cyclomatic 16) · ×1
  • CdfUnitFeed.DecisionLine (cyclomatic 16) desktop/src/components/layout/CdfUnitFeed.tsx:148 — CdfUnitFeed.DecisionLine 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 · DddCard.FullBody (cyclomatic 16) · ×1
  • DddCard.FullBody (cyclomatic 16) desktop/src/components/layout/DddCard.tsx:296 — DddCard.FullBody 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 · BrainMap.BrainMap (cyclomatic 16) · ×1
  • BrainMap.BrainMap (cyclomatic 16) desktop/src/components/layout/BrainMap.tsx:156 — BrainMap.BrainMap has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CasesTab.ReleaseRecord (cyclomatic 16) · ×1
  • CasesTab.ReleaseRecord (cyclomatic 16) desktop/src/pages/eval/CasesTab.tsx:314 — CasesTab.ReleaseRecord has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 3 function items inside it that branch (cell, a function literal at line 343, a function literal at line 317). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · EvalOverlay.EvalOverlay (cyclomatic 16) · ×1
  • EvalOverlay.EvalOverlay (cyclomatic 16) desktop/src/pages/eval/EvalOverlay.tsx:33 — EvalOverlay.EvalOverlay has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 47, 64, 59, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ConnectAccount.Verified (cyclomatic 16) · ×1
  • ConnectAccount.Verified (cyclomatic 16) desktop/src/components/awsAccount/ConnectAccount.tsx:976 — ConnectAccount.Verified has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · HtmlRenderer.HtmlRenderer (cyclomatic 16) · ×1
  • HtmlRenderer.HtmlRenderer (cyclomatic 16) REDACTED:96 — HtmlRenderer.HtmlRenderer has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CanvasOutputRail.CanvasOutputRail (cyclomatic 16) · ×1
  • CanvasOutputRail.CanvasOutputRail (cyclomatic 16) desktop/src/components/file-viewer/CanvasOutputRail.tsx:223 — CanvasOutputRail.CanvasOutputRail has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · fileClassification.determineDeliveryStrategy (cyclomatic 16) · ×1
  • fileClassification.determineDeliveryStrategy (cyclomatic 16) desktop/src/utils/fileClassification.ts:177 — fileClassification.determineDeliveryStrategy 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 · TSCCModules.RecallTab (cyclomatic 16) · ×1
  • TSCCModules.RecallTab (cyclomatic 16) desktop/src/pages/chat/components/TSCCModules.tsx:364 — TSCCModules.RecallTab has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ChatInput.ChatInput · ×1
  • ChatInput.ChatInput::handleKeyDown (cyclomatic 16) desktop/src/pages/chat/components/ChatInput.tsx:696 — ChatInput.ChatInput::handleKeyDown 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 (ChatInput.ChatInput) 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 · steerChain.steerChain (cyclomatic 16) · ×1
  • steerChain.steerChain (cyclomatic 16) desktop/src/pages/chat/steerChain.ts:33 — steerChain.steerChain 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 · SwarmOutDashboard.SwarmOutDashboard (cyclomatic 16) · ×1
  • SwarmOutDashboard.SwarmOutDashboard (cyclomatic 16) desktop/src/components/swarm-out/SwarmOutDashboard.tsx:48 — SwarmOutDashboard.SwarmOutDashboard 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 · FileBrowser.FileBrowser (cyclomatic 16) · ×1
  • FileBrowser.FileBrowser (cyclomatic 16) desktop/src/components/workspace/FileBrowser.tsx:100 — FileBrowser.FileBrowser has cyclomatic complexity 16 (threshold 15). Of this number, 9 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. This is NOT this file's highest cyclomatic complexity: FileBrowser.getFileIcon (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · pipeline-conductor-ui-mock.html.answer (cyclomatic 16) · ×1
  • pipeline-conductor-ui-mock.html.answer (cyclomatic 16) docs/design/pipeline-conductor-ui-mock.html:100 — pipeline-conductor-ui-mock.html.answer 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.
D10 · Test Quality · No assertions · ×1
  • No assertions: A: a turn on session S ends desktop/src/__tests__/streamingTestIsolation.test.ts:60 — 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.
D10 · Test Quality · Fixed-sleep synchronisation · ×1
  • Fixed-sleep synchronisation: a stale answer after a reset is dropped desktop/src/services/__tests__/canvasSession.test.ts:86 — This test starts work it did not wait for (`p`, still running when the sleep starts) and then orders itself against it with `wait(0)` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
D17 · Explicit Debt · HackComment · ×1
  • HackComment desktop/src/components/layout/__tests__/NewBrainOverlay.interaction.test.tsx:250 — // hack existed because the legacy overlay stayed mounted and `open` didn't observably — 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 · StreamingOrchestrator._read_formatted_response_body (cognitive 886) · ×1
  • StreamingOrchestrator._read_formatted_response_body (cognitive 886) backend/core/streaming_orchestrator.py:1422 — StreamingOrchestrator._read_formatted_response_body has cognitive complexity 886 (threshold 15). Drivers by points: if/else 153 (623 pts), loops 18 (84 pts), ternaries 21 (76 pts), boolean chains 70, error handling 10 (33 pts) (nesting depth added 614). 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 · ChatPage.ChatPage (cognitive 636) · ×1
  • ChatPage.ChatPage (cognitive 636) desktop/src/pages/ChatPage.tsx:160 — ChatPage.ChatPage has cognitive complexity 636 (threshold 15). Drivers by points: if/else 234 (372 pts), ternaries 55 (126 pts), boolean chains 94, error handling 13 (20 pts), loops 9 (19 pts), match/switch 3 (5 pts) (nesting depth added 228). Of this number, 40 points are the body's own statements and 596 belong to 78 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 · useChatStreamingLifecycle.useChatStreamingLifecycle.createStreamHandler · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle.createStreamHandler::inner (cognitive 493) desktop/src/hooks/useChatStreamingLifecycle.ts:2688 — useChatStreamingLifecycle.useChatStreamingLifecycle.createStreamHandler::inner has cognitive complexity 493 (threshold 15). Drivers by points: if/else 164 (348 pts), boolean chains 70, ternaries 26 (65 pts), error handling 3 (10 pts) (nesting depth added 230). 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 · ChannelGateway._handle_conversation (cognitive 355) · ×1
  • ChannelGateway._handle_conversation (cognitive 355) backend/channels/gateway.py:1676 — ChannelGateway._handle_conversation has cognitive complexity 355 (threshold 15). Drivers by points: if/else 80 (221 pts), boolean chains 47, error handling 19 (46 pts), ternaries 13 (22 pts), loops 7 (19 pts) (nesting depth added 189). 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 · useChatStreamingLifecycle.useChatStreamingLifecycle (cognitive 280) · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle (cognitive 280) desktop/src/hooks/useChatStreamingLifecycle.ts:1084 — useChatStreamingLifecycle.useChatStreamingLifecycle has cognitive complexity 280 (threshold 15). Drivers by points: if/else 103 (215 pts), boolean chains 28, loops 10 (18 pts), ternaries 10 (17 pts), error handling 2 (nesting depth added 127). Most of this is not in the body itself: 6 of the 280 points are its own statements and the rest belongs to 24 function literals inside it that branch (lines 1265, 4823, 2419, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · html2pptx.extractSlideData (cognitive 246) · ×1
  • html2pptx.extractSlideData (cognitive 246) backend/skills/s_pptx/scripts/html2pptx.js:244 — html2pptx.extractSlideData has cognitive complexity 246 (threshold 15). Drivers by points: if/else 82 (160 pts), boolean chains 56, ternaries 11 (28 pts), loops 1 (2 pts) (nesting depth added 96). None of this is in the body itself: all 246 points belong to 15 function literals inside it that branch (lines 534, 422, 365, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · FileEditorCore.FileEditorCore (cognitive 244) · ×1
  • FileEditorCore.FileEditorCore (cognitive 244) desktop/src/components/common/FileEditorCore.tsx:688 — FileEditorCore.FileEditorCore has cognitive complexity 244 (threshold 15). Drivers by points: if/else 85 (97 pts), boolean chains 82, ternaries 34 (54 pts), error handling 7 (8 pts), loops 2 (3 pts) (nesting depth added 34). Of this number, 85 points are the body's own statements and 159 belong to 56 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 · SessionRouter._run_conversation_impl (cognitive 232) · ×1
  • SessionRouter._run_conversation_impl (cognitive 232) backend/core/session_router.py:4751 — SessionRouter._run_conversation_impl has cognitive complexity 232 (threshold 15). Drivers by points: if/else 69 (127 pts), boolean chains 41, ternaries 15 (29 pts), error handling 12 (28 pts), loops 3 (7 pts) (nesting depth added 92). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · swarm_out_results.summarize (cognitive 194) · ×1
  • swarm_out_results.summarize (cognitive 194) backend/core/swarm_out_results.py:308 — swarm_out_results.summarize has cognitive complexity 194 (threshold 15). Drivers by points: if/else 47 (83 pts), boolean chains 49, ternaries 23 (41 pts), loops 14 (21 pts) (nesting depth added 61). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConnectAccount.ConnectAccount (cognitive 176) · ×1
  • ConnectAccount.ConnectAccount (cognitive 176) desktop/src/components/awsAccount/ConnectAccount.tsx:110 — ConnectAccount.ConnectAccount has cognitive complexity 176 (threshold 15). Drivers by points: if/else 58 (76 pts), boolean chains 56, ternaries 20 (34 pts), error handling 6 (7 pts), loops 3 (nesting depth added 33). Of this number, 76 points are the body's own statements and 100 belong to 31 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 · main (cognitive 168) · ×1
  • main (cognitive 168) backend/skills/s_browser-agent/browser-agent.mjs:393 — main has cognitive complexity 168 (threshold 15). Drivers by points: if/else 46 (91 pts), ternaries 12 (27 pts), boolean chains 26, error handling 9 (23 pts), match/switch 1 (nesting depth added 74). Of this number, 152 points are the body's own statements and 16 belong to 12 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 · TabView.TabViewImpl (cognitive 160) · ×1
  • TabView.TabViewImpl (cognitive 160) desktop/src/pages/chat/components/TabView.tsx:268 — TabView.TabViewImpl has cognitive complexity 160 (threshold 15). Drivers by points: ternaries 23 (57 pts), if/else 36 (56 pts), boolean chains 47 (nesting depth added 54). Of this number, 28 points are the body's own statements and 132 belong to 20 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 · security_hooks._pending_commit_paths (cognitive 136) · ×1
  • security_hooks._pending_commit_paths (cognitive 136) backend/core/security_hooks.py:3379 — security_hooks._pending_commit_paths has cognitive complexity 136 (threshold 15). Drivers by points: if/else 35 (102 pts), loops 10 (17 pts), boolean chains 8, error handling 3 (5 pts), ternaries 2 (4 pts) (nesting depth added 78). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · project_agent_draft.build (cognitive 133) · ×1
  • project_agent_draft.build (cognitive 133) backend/core/project_agent_draft.py:432 — project_agent_draft.build has cognitive complexity 133 (threshold 15). Drivers by points: if/else 37 (81 pts), loops 12 (19 pts), boolean chains 18, ternaries 9 (15 pts) (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · eval_runner.generate_html_report (cognitive 131) · ×1
  • eval_runner.generate_html_report (cognitive 131) backend/scripts/eval_runner.py:2612 — eval_runner.generate_html_report has cognitive complexity 131 (threshold 15). Drivers by points: if/else 36 (58 pts), ternaries 29 (47 pts), loops 13 (19 pts), boolean chains 7 (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionUnit.send (cognitive 128) · ×1
  • SessionUnit.send (cognitive 128) backend/core/session_unit.py:2420 — SessionUnit.send has cognitive complexity 128 (threshold 15). Drivers by points: if/else 44 (93 pts), loops 7 (18 pts), ternaries 4 (7 pts), boolean chains 6, error handling 2 (4 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 · receivers.scope_of (cognitive 127) · ×1
  • receivers.scope_of (cognitive 127) backend/core/code_intel/receivers.py:839 — receivers.scope_of has cognitive complexity 127 (threshold 15). Drivers by points: if/else 27 (74 pts), boolean chains 24, ternaries 9 (20 pts), loops 6 (9 pts) (nesting depth added 61). 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 · SkillsPage.GenerateSkillForm (cognitive 127) · ×1
  • SkillsPage.GenerateSkillForm (cognitive 127) desktop/src/pages/SkillsPage.tsx:328 — SkillsPage.GenerateSkillForm has cognitive complexity 127 (threshold 15). Drivers by points: ternaries 28 (49 pts), if/else 36 (44 pts), boolean chains 32, error handling 2 (nesting depth added 29). Of this number, 37 points are the body's own statements and 90 belong to 20 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 · security_hooks._segment_is_irreversible (cognitive 124) · ×1
  • security_hooks._segment_is_irreversible (cognitive 124) backend/core/security_hooks.py:828 — security_hooks._segment_is_irreversible has cognitive complexity 124 (threshold 15). Drivers by points: if/else 32 (102 pts), boolean chains 12, loops 4 (10 pts) (nesting depth added 76). 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 · checks._evaluate_check (cognitive 119) · ×1
  • checks._evaluate_check (cognitive 119) backend/core/run_protocol/checks.py:418 — checks._evaluate_check has cognitive complexity 119 (threshold 15). Drivers by points: if/else 40 (64 pts), ternaries 15 (31 pts), boolean chains 18, error handling 2 (4 pts), loops 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 · style-extract.extract_shapes_summary (cognitive 114) · ×1
  • style-extract.extract_shapes_summary (cognitive 114) backend/skills/s_pptx/scripts/style-extract.py:81 — style-extract.extract_shapes_summary has cognitive complexity 114 (threshold 15). Drivers by points: if/else 13 (53 pts), ternaries 8 (32 pts), loops 9 (29 pts) (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 · changed._report (cognitive 112) · ×1
  • changed._report (cognitive 112) backend/core/code_intel/changed.py:649 — changed._report has cognitive complexity 112 (threshold 15). Drivers by points: if/else 38 (72 pts), boolean chains 22, ternaries 7 (12 pts), loops 5 (6 pts) (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · audit.render (cognitive 109) · ×1
  • audit.render (cognitive 109) backend/core/run_protocol/audit.py:781 — audit.render has cognitive complexity 109 (threshold 15). Drivers by points: if/else 32 (44 pts), boolean chains 35, ternaries 11 (24 pts), loops 4 (6 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 · security_hooks._normalize_newlines_quote_aware (cognitive 107) · ×1
  • security_hooks._normalize_newlines_quote_aware (cognitive 107) backend/core/security_hooks.py:2840 — security_hooks._normalize_newlines_quote_aware has cognitive complexity 107 (threshold 15). Drivers by points: if/else 22 (61 pts), ternaries 5 (22 pts), loops 4 (13 pts), boolean chains 11 (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 · FileTypes.value_type (cognitive 103) · ×1
  • FileTypes.value_type (cognitive 103) backend/core/code_intel/receivers.py:466 — FileTypes.value_type has cognitive complexity 103 (threshold 15). Drivers by points: if/else 33 (69 pts), boolean chains 24, ternaries 4 (10 pts) (nesting depth added 42). 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 · SQLiteDatabase._run_versioned_migrations (cognitive 99) · ×1
  • SQLiteDatabase._run_versioned_migrations (cognitive 99) backend/database/sqlite.py:2888 — SQLiteDatabase._run_versioned_migrations has cognitive complexity 99 (threshold 15). Drivers by points: if/else 34 (50 pts), error handling 13 (28 pts), loops 4 (8 pts), ternaries 3 (8 pts), boolean chains 5 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workspace_api.resolve_path_to_physical (cognitive 97) · ×1
  • workspace_api.resolve_path_to_physical (cognitive 97) backend/routers/workspace_api.py:1205 — workspace_api.resolve_path_to_physical has cognitive complexity 97 (threshold 15). Drivers by points: if/else 23 (62 pts), loops 6 (16 pts), error handling 3 (12 pts), boolean chains 7 (nesting depth added 58). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RunOverlay.CommandPanel (cognitive 95) · ×1
  • RunOverlay.CommandPanel (cognitive 95) desktop/src/components/swarm-out/RunOverlay.tsx:337 — RunOverlay.CommandPanel has cognitive complexity 95 (threshold 15). Drivers by points: boolean chains 37, ternaries 19 (35 pts), if/else 17 (21 pts), error handling 1, match/switch 1 (nesting depth added 20). Of this number, 47 points are the body's own statements and 48 belong to 14 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 · interface._ts_scan (cognitive 94) · ×1
  • interface._ts_scan (cognitive 94) backend/core/code_intel/interface.py:566 — interface._ts_scan has cognitive complexity 94 (threshold 15). Drivers by points: if/else 16 (60 pts), ternaries 4 (15 pts), loops 4 (13 pts), boolean chains 6 (nesting depth added 64). 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 · polly.synthesize (cognitive 94) · ×1
  • polly.synthesize (cognitive 94) backend/skills/s_pollinate/scripts/tts/backends/polly.py:246 — polly.synthesize has cognitive complexity 94 (threshold 15). Drivers by points: if/else 19 (66 pts), loops 6 (21 pts), error handling 1 (3 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 66). 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 · security_hooks._segment_session_link (cognitive 91) · ×1
  • security_hooks._segment_session_link (cognitive 91) backend/core/security_hooks.py:4988 — security_hooks._segment_session_link has cognitive complexity 91 (threshold 15). Drivers by points: if/else 25 (63 pts), ternaries 4 (15 pts), boolean chains 8, loops 3 (5 pts) (nesting depth added 51). 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 · security_hooks._audit_tool_hit (cognitive 90) · ×1
  • security_hooks._audit_tool_hit (cognitive 90) backend/core/security_hooks.py:5893 — security_hooks._audit_tool_hit has cognitive complexity 90 (threshold 15). Drivers by points: if/else 27 (48 pts), boolean chains 27, ternaries 4 (9 pts), loops 3 (6 pts) (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 · main.lifespan (cognitive 90) · ×1
  • main.lifespan (cognitive 90) backend/main.py:1014 — main.lifespan has cognitive complexity 90 (threshold 15). Drivers by points: if/else 46 (55 pts), error handling 18 (26 pts), boolean chains 9 (nesting depth added 17). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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 · pipeline_v2.run_unit_v2 (cognitive 88) · ×1
  • pipeline_v2.run_unit_v2 (cognitive 88) backend/core/ingestion/pipeline_v2.py:701 — pipeline_v2.run_unit_v2 has cognitive complexity 88 (threshold 15). Drivers by points: if/else 43 (59 pts), boolean chains 21, ternaries 4 (5 pts), loops 2, 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 · interface._py_scan (cognitive 87) · ×1
  • interface._py_scan (cognitive 87) backend/core/code_intel/interface.py:412 — interface._py_scan has cognitive complexity 87 (threshold 15). Drivers by points: if/else 12 (45 pts), ternaries 8 (29 pts), boolean chains 9, loops 2 (4 pts) (nesting depth added 56). 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 · ai_ready_helpers.extract_import_graph (cognitive 86) · ×1
  • ai_ready_helpers.extract_import_graph (cognitive 86) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:579 — ai_ready_helpers.extract_import_graph has cognitive complexity 86 (threshold 15). Drivers by points: if/else 22 (54 pts), ternaries 5 (14 pts), loops 9 (13 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · turnView.labelBash (cognitive 84) · ×1
  • turnView.labelBash (cognitive 84) REDACTED:872 — turnView.labelBash has cognitive complexity 84 (threshold 15). Drivers by points: ternaries 13 (37 pts), if/else 16 (29 pts), boolean chains 18 (nesting depth added 37). Of this number, 78 points are the body's own statements and 6 belong to 4 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · FileTypes.ann_type (cognitive 83) · ×1
  • FileTypes.ann_type (cognitive 83) backend/core/code_intel/receivers.py:384 — FileTypes.ann_type has cognitive complexity 83 (threshold 15). Drivers by points: if/else 24 (41 pts), ternaries 13 (29 pts), boolean chains 12, loops 1 (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 · runtime_hooks._prompt_reads (cognitive 83) · ×1
  • runtime_hooks._prompt_reads (cognitive 83) backend/core/runtime_hooks.py:917 — runtime_hooks._prompt_reads has cognitive complexity 83 (threshold 15). Drivers by points: if/else 11 (30 pts), ternaries 7 (21 pts), loops 5 (13 pts), boolean chains 11, error handling 4 (8 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 · scheduler.run_scheduler (cognitive 81) · ×1
  • scheduler.run_scheduler (cognitive 81) backend/jobs/scheduler.py:521 — scheduler.run_scheduler has cognitive complexity 81 (threshold 15). Drivers by points: if/else 26 (52 pts), loops 10 (17 pts), boolean chains 7, ternaries 1 (5 pts) (nesting depth added 37). 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 · AwsAccountTab.AwsAccountTab (cognitive 81) · ×1
  • AwsAccountTab.AwsAccountTab (cognitive 81) desktop/src/components/settings/AwsAccountTab.tsx:41 — AwsAccountTab.AwsAccountTab has cognitive complexity 81 (threshold 15). Drivers by points: boolean chains 35, ternaries 19 (35 pts), if/else 6 (7 pts), error handling 4 (nesting depth added 17). Of this number, 67 points are the body's own statements and 14 belong to 9 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 · executor.execute_job (cognitive 80) · ×1
  • executor.execute_job (cognitive 80) REDACTED:151 — executor.execute_job has cognitive complexity 80 (threshold 15). Drivers by points: ternaries 17 (36 pts), if/else 14 (26 pts), boolean chains 13, error handling 3 (5 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 · hive_records.pull (cognitive 78) · ×1
  • hive_records.pull (cognitive 78) backend/core/hive_records.py:888 — hive_records.pull has cognitive complexity 78 (threshold 15). Drivers by points: if/else 13 (31 pts), ternaries 9 (25 pts), boolean chains 11, error handling 4 (8 pts), loops 2 (3 pts) (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useCanvasHost.useCanvasHost (cognitive 77) · ×1
  • useCanvasHost.useCanvasHost (cognitive 77) desktop/src/hooks/useCanvasHost.ts:236 — useCanvasHost.useCanvasHost has cognitive complexity 77 (threshold 15). Drivers by points: if/else 32 (41 pts), ternaries 13 (20 pts), boolean chains 15, error handling 1 (nesting depth added 16). Most of this is not in the body itself: 2 of the 77 points are its own statements and the rest belongs to 14 function literals inside it that branch (lines 622, 778, 726, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · audit.build (cognitive 76) · ×1
  • audit.build (cognitive 76) backend/core/run_protocol/audit.py:373 — audit.build has cognitive complexity 76 (threshold 15). Drivers by points: boolean chains 36, ternaries 21 (22 pts), if/else 18 (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 · ReviewOrchestrator.plan_fix_handoff (cognitive 76) · ×1
  • ReviewOrchestrator.plan_fix_handoff (cognitive 76) backend/core/run_protocol/review.py:798 — ReviewOrchestrator.plan_fix_handoff has cognitive complexity 76 (threshold 15). Drivers by points: if/else 29 (61 pts), boolean chains 12, loops 3 (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 · MessageStore._applyMerge (cognitive 76) · ×1
  • MessageStore._applyMerge (cognitive 76) desktop/src/stores/MessageStore.ts:960 — MessageStore._applyMerge has cognitive complexity 76 (threshold 15). Drivers by points: if/else 16 (45 pts), loops 6 (13 pts), boolean chains 10, ternaries 3 (8 pts) (nesting depth added 41). Of this number, 73 points are the body's own statements and 3 belong to 2 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 · addressing._map (cognitive 75) · ×1
  • addressing._map (cognitive 75) backend/core/addressing.py:325 — addressing._map has cognitive complexity 75 (threshold 15). Drivers by points: if/else 19 (41 pts), loops 7 (16 pts), error handling 3 (10 pts), boolean chains 4, ternaries 4 (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 · PromptBuilder.build_system_prompt (cognitive 75) · ×1
  • PromptBuilder.build_system_prompt (cognitive 75) REDACTED:1354 — PromptBuilder.build_system_prompt has cognitive complexity 75 (threshold 15). Drivers by points: if/else 31 (43 pts), boolean chains 13, ternaries 5 (11 pts), error handling 6 (8 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · desktop_main.run_ingest (cognitive 75) · ×1
  • desktop_main.run_ingest (cognitive 75) REDACTED:215 — desktop_main.run_ingest has cognitive complexity 75 (threshold 15). Drivers by points: if/else 17 (24 pts), ternaries 11 (22 pts), error handling 7 (12 pts), boolean chains 10, loops 4 (7 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 · browser-agent.compressDOM (cognitive 75) · ×1
  • browser-agent.compressDOM (cognitive 75) backend/skills/s_browser-agent/browser-agent.mjs:169 — browser-agent.compressDOM has cognitive complexity 75 (threshold 15). Drivers by points: if/else 30 (54 pts), boolean chains 12, loops 3 (4 pts), ternaries 2 (4 pts), error handling 1 (nesting depth added 27). None of this is in the body itself: all 75 points belong to 3 function literals inside it that branch (lines 241, 206, 197). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · BackendStartupOverlay.BackendStartupOverlay (cognitive 75) · ×1
  • BackendStartupOverlay.BackendStartupOverlay (cognitive 75) desktop/src/components/common/BackendStartupOverlay.tsx:243 — BackendStartupOverlay.BackendStartupOverlay has cognitive complexity 75 (threshold 15). Drivers by points: if/else 43 (53 pts), boolean chains 13, ternaries 4 (6 pts), error handling 3 (nesting depth added 12). Most of this is not in the body itself: 9 of the 75 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 442, a function literal at line 407, a function literal at line 533, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · TurnZones.AgentRow (cognitive 75) · ×1
  • TurnZones.AgentRow (cognitive 75) desktop/src/pages/chat/components/TurnZones.tsx:513 — TurnZones.AgentRow has cognitive complexity 75 (threshold 15). Drivers by points: ternaries 19 (47 pts), boolean chains 24, if/else 3, error handling 1 (nesting depth added 28). Of this number, 70 points are the body's own statements and 5 belong to 2 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 · tool_summarizer.summarize_tool_use (cognitive 74) · ×1
  • tool_summarizer.summarize_tool_use (cognitive 74) backend/core/tool_summarizer.py:248 — tool_summarizer.summarize_tool_use has cognitive complexity 74 (threshold 15). Drivers by points: if/else 20 (35 pts), ternaries 12 (25 pts), boolean chains 14 (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 · lifecycle._apply (cognitive 73) · ×1
  • lifecycle._apply (cognitive 73) backend/core/run_protocol/lifecycle.py:751 — lifecycle._apply has cognitive complexity 73 (threshold 15). Drivers by points: if/else 18 (35 pts), boolean chains 31, ternaries 3 (7 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 · useChatStreamingLifecycle.useChatStreamingLifecycle.createErrorHandlerInner.<returned closure> (cognitive 73) · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle.createErrorHandlerInner.<returned closure> (cognitive 73) desktop/src/hooks/useChatStreamingLifecycle.ts:3997 — useChatStreamingLifecycle.useChatStreamingLifecycle.createErrorHandlerInner.<returned closure> has cognitive complexity 73 (threshold 15). Drivers by points: if/else 28 (42 pts), ternaries 11 (16 pts), boolean chains 13, error handling 1 (2 pts) (nesting depth added 20). Of this number, 41 points are the body's own statements and 32 belong to 5 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 · changed.render (cognitive 72) · ×1
  • changed.render (cognitive 72) backend/core/code_intel/changed.py:884 — changed.render has cognitive complexity 72 (threshold 15). Drivers by points: ternaries 15 (34 pts), if/else 20 (32 pts), boolean chains 5, loops 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GraphStore.resolve_bare_targets (cognitive 72) · ×1
  • GraphStore.resolve_bare_targets (cognitive 72) backend/core/code_intel/graph_store.py:1806 — GraphStore.resolve_bare_targets has cognitive complexity 72 (threshold 15). Drivers by points: if/else 21 (49 pts), boolean chains 8, ternaries 3 (8 pts), loops 6 (7 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 · provenance.enqueue_unit (cognitive 72) · ×1
  • provenance.enqueue_unit (cognitive 72) backend/core/ingestion/provenance.py:411 — provenance.enqueue_unit has cognitive complexity 72 (threshold 15). Drivers by points: if/else 20 (42 pts), boolean chains 16, error handling 3 (5 pts), ternaries 3 (5 pts), loops 2 (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 · landing.commit_repos (cognitive 72) · ×1
  • landing.commit_repos (cognitive 72) backend/core/run_protocol/landing.py:538 — landing.commit_repos has cognitive complexity 72 (threshold 15). Drivers by points: if/else 19 (36 pts), error handling 7 (15 pts), boolean chains 12, loops 5, ternaries 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 · skill_metrics_hook._detect_skill_invocations (cognitive 71) · ×1
  • skill_metrics_hook._detect_skill_invocations (cognitive 71) backend/hooks/skill_metrics_hook.py:108 — skill_metrics_hook._detect_skill_invocations has cognitive complexity 71 (threshold 15). Drivers by points: if/else 14 (51 pts), loops 5 (11 pts), ternaries 1 (6 pts), boolean chains 3 (nesting depth added 48). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · project_agent_draft._merge (cognitive 69) · ×1
  • project_agent_draft._merge (cognitive 69) backend/core/project_agent_draft.py:582 — project_agent_draft._merge has cognitive complexity 69 (threshold 15). Drivers by points: if/else 20 (42 pts), boolean chains 18, loops 3 (5 pts), ternaries 3 (4 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ddd_format.normalize (cognitive 68) · ×1
  • ddd_format.normalize (cognitive 68) backend/core/ddd_format.py:268 — ddd_format.normalize has cognitive complexity 68 (threshold 15). Drivers by points: if/else 15 (31 pts), loops 11 (24 pts), boolean chains 8, ternaries 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 · turnView.deriveTurnView (cognitive 68) · ×1
  • turnView.deriveTurnView (cognitive 68) REDACTED:314 — turnView.deriveTurnView has cognitive complexity 68 (threshold 15). Drivers by points: if/else 69 (107 pts), boolean chains 52, ternaries 18 (52 pts), loops 6 (8 pts) (nesting depth added 74). To reduce it, split the body into named stages: move each independent 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 (turnView.deriveTurnView::pushToolStep) 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 · FileViewerPanel.FileViewerPanelImpl (cognitive 68) · ×1
  • FileViewerPanel.FileViewerPanelImpl (cognitive 68) desktop/src/components/file-viewer/FileViewerPanel.tsx:181 — FileViewerPanel.FileViewerPanelImpl has cognitive complexity 68 (threshold 15). Drivers by points: boolean chains 28, if/else 23, ternaries 16 (17 pts) (nesting depth added 1). Of this number, 42 points are the body's own statements and 26 belong to 14 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · writer._render_block (cognitive 67) · ×1
  • writer._render_block (cognitive 67) backend/core/ingestion/writer.py:405 — writer._render_block has cognitive complexity 67 (threshold 15). Drivers by points: if/else 20 (35 pts), boolean chains 15, ternaries 7 (10 pts), loops 3 (7 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 · PromptBuilder.build_options (cognitive 67) · ×1
  • PromptBuilder.build_options (cognitive 67) REDACTED:2306 — PromptBuilder.build_options has cognitive complexity 67 (threshold 15). Drivers by points: if/else 26 (33 pts), boolean chains 20, error handling 3 (7 pts), ternaries 7 (nesting depth added 11). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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 · next_step.next_step (cognitive 67) · ×1
  • next_step.next_step (cognitive 67) backend/core/run_protocol/next_step.py:181 — next_step.next_step has cognitive complexity 67 (threshold 15). Drivers by points: if/else 26 (42 pts), ternaries 7 (17 pts), boolean chains 8 (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 · runtime_hooks._segment_runs_tests (cognitive 67) · ×1
  • runtime_hooks._segment_runs_tests (cognitive 67) backend/core/runtime_hooks.py:219 — runtime_hooks._segment_runs_tests has cognitive complexity 67 (threshold 15). Drivers by points: if/else 11 (28 pts), ternaries 4 (16 pts), loops 5 (13 pts), boolean chains 10 (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 · RunOverlay.RunOverlay (cognitive 67) · ×1
  • RunOverlay.RunOverlay (cognitive 67) desktop/src/components/swarm-out/RunOverlay.tsx:653 — RunOverlay.RunOverlay has cognitive complexity 67 (threshold 15). Drivers by points: boolean chains 32, if/else 22, ternaries 10 (12 pts), error handling 1 (nesting depth added 2). Of this number, 33 points are the body's own statements and 34 belong to 17 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · workspace_api._build_tree (cognitive 66) · ×1
  • workspace_api._build_tree (cognitive 66) backend/routers/workspace_api.py:389 — workspace_api._build_tree has cognitive complexity 66 (threshold 15). Drivers by points: if/else 17 (37 pts), ternaries 4 (10 pts), boolean chains 9, loops 5 (9 pts), error handling 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 · bash_misuse_report.scan (cognitive 66) · ×1
  • bash_misuse_report.scan (cognitive 66) backend/scripts/bash_misuse_report.py:125 — bash_misuse_report.scan has cognitive complexity 66 (threshold 15). Drivers by points: if/else 12 (46 pts), boolean chains 10, loops 3 (6 pts), error handling 1 (2 pts), ternaries 2 (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 · AssistantMessageView.AssistantMessageView (cognitive 66) · ×1
  • AssistantMessageView.AssistantMessageView (cognitive 66) desktop/src/pages/chat/components/AssistantMessageView.tsx:226 — AssistantMessageView.AssistantMessageView has cognitive complexity 66 (threshold 15). Drivers by points: boolean chains 29, ternaries 13 (19 pts), if/else 17, error handling 1 (nesting depth added 6). Of this number, 38 points are the body's own statements and 28 belong to 14 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 · ProductRegistry.scan_product_dirs (cognitive 65) · ×1
  • ProductRegistry.scan_product_dirs (cognitive 65) backend/core/product_registry.py:958 — ProductRegistry.scan_product_dirs has cognitive complexity 65 (threshold 15). Drivers by points: if/else 9 (38 pts), error handling 2 (10 pts), loops 4 (10 pts), ternaries 1 (5 pts), boolean chains 2 (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BaseSchemaValidator.validate_unique_ids (cognitive 65) · ×1
  • BaseSchemaValidator.validate_unique_ids (cognitive 65) backend/skills/s_pptx/ooxml/scripts/validation/base.py:186 — BaseSchemaValidator.validate_unique_ids has cognitive complexity 65 (threshold 15). Drivers by points: if/else 13 (44 pts), loops 5 (11 pts), ternaries 2 (8 pts), error handling 1 (2 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 · parser.scan_imports (cognitive 64) · ×1
  • parser.scan_imports (cognitive 64) backend/core/code_intel/parser.py:906 — parser.scan_imports has cognitive complexity 64 (threshold 15). Drivers by points: loops 11 (28 pts), if/else 7 (24 pts), boolean chains 6, ternaries 2 (6 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 · SummarizationPipeline._extract_files_modified (cognitive 64) · ×1
  • SummarizationPipeline._extract_files_modified (cognitive 64) backend/core/summarization.py:457 — SummarizationPipeline._extract_files_modified has cognitive complexity 64 (threshold 15). Drivers by points: if/else 11 (42 pts), loops 5 (15 pts), boolean chains 7 (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 · cli_commands._execute_loaded (cognitive 63) · ×1
  • cli_commands._execute_loaded (cognitive 63) backend/core/run_protocol/cli_commands.py:424 — cli_commands._execute_loaded has cognitive complexity 63 (threshold 15). Drivers by points: if/else 32 (47 pts), ternaries 3 (7 pts), error handling 2 (5 pts), boolean chains 4 (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 · chat.consumeSSEStream (cognitive 63) · ×1
  • chat.consumeSSEStream (cognitive 63) desktop/src/services/chat.ts:319 — chat.consumeSSEStream has cognitive complexity 63 (threshold 15). Drivers by points: if/else 10 (34 pts), error handling 4 (21 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 45). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · prompt_builder._render_canvas_lines (cognitive 62) · ×1
  • prompt_builder._render_canvas_lines (cognitive 62) REDACTED:330 — prompt_builder._render_canvas_lines has cognitive complexity 62 (threshold 15). Drivers by points: if/else 16 (26 pts), ternaries 10 (21 pts), boolean chains 12, loops 2 (3 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · swarm_out_settle.derive (cognitive 62) · ×1
  • swarm_out_settle.derive (cognitive 62) backend/core/swarm_out_settle.py:468 — swarm_out_settle.derive has cognitive complexity 62 (threshold 15). Drivers by points: boolean chains 37, ternaries 13 (15 pts), if/else 9 (10 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 · BaseSchemaValidator.validate_unique_ids (cognitive 62) · ×1
  • BaseSchemaValidator.validate_unique_ids (cognitive 62) backend/skills/s_docx/ooxml/scripts/validation/base.py:186 — BaseSchemaValidator.validate_unique_ids has cognitive complexity 62 (threshold 15). Drivers by points: if/else 12 (41 pts), loops 5 (11 pts), ternaries 2 (8 pts), error handling 1 (2 pts) (nesting depth added 42). 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 · survey._conventions (cognitive 61) · ×1
  • survey._conventions (cognitive 61) backend/core/brain_bootstrap/survey.py:207 — survey._conventions has cognitive complexity 61 (threshold 15). Drivers by points: if/else 13 (33 pts), boolean chains 15, ternaries 2 (5 pts), error handling 2 (4 pts), loops 3 (4 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 · CliStreamReader._route (cognitive 61) · ×1
  • CliStreamReader._route (cognitive 61) backend/core/cli_stream_reader.py:486 — CliStreamReader._route has cognitive complexity 61 (threshold 15). Drivers by points: if/else 20 (44 pts), boolean chains 9, loops 1 (4 pts), error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · LifecycleManager._check_streaming_timeout (cognitive 61) · ×1
  • LifecycleManager._check_streaming_timeout (cognitive 61) backend/core/lifecycle_manager.py:643 — LifecycleManager._check_streaming_timeout has cognitive complexity 61 (threshold 15). Drivers by points: if/else 16 (49 pts), ternaries 2 (6 pts), boolean chains 5, loops 1 (nesting depth added 37). 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 · RetryManager._retry_loop (cognitive 61) · ×1
  • RetryManager._retry_loop (cognitive 61) backend/core/retry_manager.py:340 — RetryManager._retry_loop has cognitive complexity 61 (threshold 15). Drivers by points: if/else 20 (43 pts), error handling 4 (8 pts), loops 3 (7 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 · RunEngine.stage_complete (cognitive 61) · ×1
  • RunEngine.stage_complete (cognitive 61) backend/core/run_protocol/engine.py:2422 — RunEngine.stage_complete has cognitive complexity 61 (threshold 15). Drivers by points: if/else 24 (42 pts), boolean chains 12, ternaries 3 (5 pts), error handling 1, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · findings.fold (cognitive 61) · ×1
  • findings.fold (cognitive 61) backend/core/run_protocol/findings.py:328 — findings.fold has cognitive complexity 61 (threshold 15). Drivers by points: if/else 15 (43 pts), boolean chains 11, loops 3 (6 pts), ternaries 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · schemas.validate_contract (cognitive 61) · ×1
  • schemas.validate_contract (cognitive 61) backend/core/run_protocol/schemas.py:582 — schemas.validate_contract has cognitive complexity 61 (threshold 15). Drivers by points: if/else 17 (33 pts), boolean chains 12, loops 7 (12 pts), ternaries 2 (4 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sections.match_section_times (cognitive 61) · ×1
  • sections.match_section_times (cognitive 61) backend/skills/s_pollinate/scripts/tts/sections.py:86 — sections.match_section_times has cognitive complexity 61 (threshold 15). Drivers by points: if/else 14 (37 pts), loops 8 (20 pts), boolean chains 4 (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 · CredentialBanner.CredentialBanner (cognitive 61) · ×1
  • CredentialBanner.CredentialBanner (cognitive 61) desktop/src/components/common/CredentialBanner.tsx:49 — CredentialBanner.CredentialBanner has cognitive complexity 61 (threshold 15). Drivers by points: ternaries 15 (26 pts), if/else 23 (24 pts), boolean chains 10, error handling 1 (nesting depth added 12). Of this number, 31 points are the body's own statements and 30 belong to 17 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 · aws_detect.stage1 (cognitive 60) · ×1
  • aws_detect.stage1 (cognitive 60) backend/core/aws_detect.py:75 — aws_detect.stage1 has cognitive complexity 60 (threshold 15). Drivers by points: if/else 13 (24 pts), ternaries 8 (21 pts), boolean chains 13, loops 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ContextDirectoryLoader.ensure_directory (cognitive 60) · ×1
  • ContextDirectoryLoader.ensure_directory (cognitive 60) backend/core/context_directory_loader.py:625 — ContextDirectoryLoader.ensure_directory has cognitive complexity 60 (threshold 15). Drivers by points: if/else 16 (34 pts), error handling 7 (19 pts), boolean chains 4, loops 3 (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 · ddd_entry_lifecycle.parse_entries (cognitive 60) · ×1
  • ddd_entry_lifecycle.parse_entries (cognitive 60) backend/core/ddd_entry_lifecycle.py:728 — ddd_entry_lifecycle.parse_entries has cognitive complexity 60 (threshold 15). Drivers by points: if/else 11 (33 pts), error handling 2 (12 pts), boolean chains 8, ternaries 2 (6 pts), loops 1 (nesting depth added 36). 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 · overrides.check (cognitive 59) · ×1
  • overrides.check (cognitive 59) backend/core/ingestion/overrides.py:190 — overrides.check has cognitive complexity 59 (threshold 15). Drivers by points: if/else 26 (47 pts), boolean chains 7, ternaries 1 (3 pts), loops 2 (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 · security_hooks._env_session_link (cognitive 59) · ×1
  • security_hooks._env_session_link (cognitive 59) backend/core/security_hooks.py:4592 — security_hooks._env_session_link has cognitive complexity 59 (threshold 15). Drivers by points: if/else 15 (42 pts), loops 3 (5 pts), boolean chains 4, error handling 1 (4 pts), ternaries 1 (4 pts) (nesting depth added 35). 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 · subagent_transcript.spawn_evidence (cognitive 59) · ×1
  • subagent_transcript.spawn_evidence (cognitive 59) backend/core/subagent_transcript.py:135 — subagent_transcript.spawn_evidence has cognitive complexity 59 (threshold 15). Drivers by points: if/else 14 (40 pts), ternaries 3 (7 pts), boolean chains 6, error handling 2 (3 pts), loops 2 (3 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentFormModal.AgentFormModal (cognitive 59) · ×1
  • AgentFormModal.AgentFormModal (cognitive 59) desktop/src/components/common/AgentFormModal.tsx:36 — AgentFormModal.AgentFormModal has cognitive complexity 59 (threshold 15). Drivers by points: ternaries 20 (25 pts), boolean chains 23, if/else 9 (10 pts), error handling 1 (nesting depth added 6). Of this number, 27 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 · ArtifactsOverlay.ArtifactsContent (cognitive 59) · ×1
  • ArtifactsOverlay.ArtifactsContent (cognitive 59) desktop/src/components/layout/ArtifactsOverlay.tsx:257 — ArtifactsOverlay.ArtifactsContent has cognitive complexity 59 (threshold 15). Drivers by points: ternaries 20 (35 pts), boolean chains 13, if/else 5 (10 pts), error handling 1 (nesting depth added 20). Of this number, 29 points are the body's own statements and 30 belong to 13 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 · impact.render (cognitive 58) · ×1
  • impact.render (cognitive 58) backend/core/code_intel/impact.py:211 — impact.render has cognitive complexity 58 (threshold 15). Drivers by points: if/else 10 (29 pts), ternaries 6 (15 pts), loops 4 (10 pts), boolean chains 4 (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 · parser.parse_repo_with_coverage (cognitive 58) · ×1
  • parser.parse_repo_with_coverage (cognitive 58) backend/core/code_intel/parser.py:2410 — parser.parse_repo_with_coverage has cognitive complexity 58 (threshold 15). Drivers by points: if/else 22 (35 pts), loops 8 (14 pts), boolean chains 5, error handling 1 (3 pts), 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 · provenance._lookup_anchor (cognitive 58) · ×1
  • provenance._lookup_anchor (cognitive 58) backend/core/ingestion/provenance.py:160 — provenance._lookup_anchor has cognitive complexity 58 (threshold 15). Drivers by points: if/else 16 (36 pts), ternaries 6 (12 pts), boolean chains 8, error handling 1 (2 pts) (nesting depth added 27). 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 · repo_guidance._judge (cognitive 58) · ×1
  • repo_guidance._judge (cognitive 58) backend/core/repo_guidance.py:401 — repo_guidance._judge has cognitive complexity 58 (threshold 15). Drivers by points: if/else 16 (36 pts), loops 5 (10 pts), boolean chains 6, ternaries 3 (6 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 · chat.sse_with_heartbeat (cognitive 58) · ×1
  • chat.sse_with_heartbeat (cognitive 58) backend/routers/chat.py:173 — chat.sse_with_heartbeat has cognitive complexity 58 (threshold 15). Drivers by points: if/else 11 (35 pts), error handling 5 (15 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 2 (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 · interface.call_sites (cognitive 57) · ×1
  • interface.call_sites (cognitive 57) backend/core/code_intel/interface.py:760 — interface.call_sites has cognitive complexity 57 (threshold 15). Drivers by points: if/else 11 (30 pts), boolean chains 14, ternaries 2 (8 pts), loops 2 (5 pts) (nesting depth added 28). 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 · RunEngine._incremental_review (cognitive 57) · ×1
  • RunEngine._incremental_review (cognitive 57) backend/core/run_protocol/engine.py:3189 — RunEngine._incremental_review has cognitive complexity 57 (threshold 15). Drivers by points: ternaries 10 (23 pts), if/else 11 (19 pts), boolean chains 11, loops 3 (4 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 · ReviewOrchestrator.render_fixing_passes (cognitive 57) · ×1
  • ReviewOrchestrator.render_fixing_passes (cognitive 57) backend/core/run_protocol/review.py:1051 — ReviewOrchestrator.render_fixing_passes has cognitive complexity 57 (threshold 15). Drivers by points: if/else 12 (33 pts), loops 5 (10 pts), boolean chains 8, ternaries 2 (6 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionEventHub.subscribe (cognitive 57) · ×1
  • SessionEventHub.subscribe (cognitive 57) backend/core/session_events.py:392 — SessionEventHub.subscribe has cognitive complexity 57 (threshold 15). Drivers by points: if/else 12 (27 pts), loops 7 (14 pts), ternaries 3 (7 pts), boolean chains 6, error handling 1 (3 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 · pollinate_validator.validate_delivery (cognitive 57) · ×1
  • pollinate_validator.validate_delivery (cognitive 57) backend/skills/s_pollinate/scripts/pollinate_validator.py:198 — pollinate_validator.validate_delivery has cognitive complexity 57 (threshold 15). Drivers by points: if/else 28 (43 pts), boolean chains 6, loops 3 (6 pts), error handling 1, 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 · recalc.recalc (cognitive 57) · ×1
  • recalc.recalc (cognitive 57) backend/skills/s_xlsx/recalc.py:53 — recalc.recalc has cognitive complexity 57 (threshold 15). Drivers by points: if/else 12 (27 pts), loops 8 (18 pts), boolean chains 5, error handling 2 (4 pts), ternaries 2 (3 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 · SwarmOutWaitCard.SwarmOutWaitCard (cognitive 57) · ×1
  • SwarmOutWaitCard.SwarmOutWaitCard (cognitive 57) desktop/src/components/swarm-out/SwarmOutWaitCard.tsx:42 — SwarmOutWaitCard.SwarmOutWaitCard has cognitive complexity 57 (threshold 15). Drivers by points: ternaries 13 (26 pts), boolean chains 23, if/else 7, error handling 1 (nesting depth added 13). Of this number, 37 points are the body's own statements and 20 belong to 7 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CapabilitiesOverlay.CapabilitiesContent (cognitive 57) · ×1
  • CapabilitiesOverlay.CapabilitiesContent (cognitive 57) desktop/src/components/layout/CapabilitiesOverlay.tsx:195 — CapabilitiesOverlay.CapabilitiesContent has cognitive complexity 57 (threshold 15). Drivers by points: boolean chains 25, ternaries 13 (22 pts), if/else 8 (9 pts), error handling 1 (nesting depth added 10). Of this number, 38 points are the body's own statements and 19 belong to 13 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 · AuthConfigPanel.AuthConfigPanel (cognitive 57) · ×1
  • AuthConfigPanel.AuthConfigPanel (cognitive 57) desktop/src/components/settings/AuthConfigPanel.tsx:25 — AuthConfigPanel.AuthConfigPanel has cognitive complexity 57 (threshold 15). Drivers by points: boolean chains 26, if/else 17 (24 pts), ternaries 6, error handling 1 (nesting depth added 7). Of this number, 21 points are the body's own statements and 36 belong to 8 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · FileTypes._scan_class (cognitive 56) · ×1
  • FileTypes._scan_class (cognitive 56) backend/core/code_intel/receivers.py:706 — FileTypes._scan_class has cognitive complexity 56 (threshold 15). Drivers by points: if/else 11 (29 pts), boolean chains 12, ternaries 4 (9 pts), loops 3 (6 pts) (nesting depth added 26). 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 · context_injector._extract_key_tool_results (cognitive 56) · ×1
  • context_injector._extract_key_tool_results (cognitive 56) backend/core/context_injector.py:713 — context_injector._extract_key_tool_results has cognitive complexity 56 (threshold 15). Drivers by points: if/else 15 (45 pts), boolean chains 7, loops 2 (3 pts), error handling 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · security_hooks._store_segment_destroys (cognitive 56) · ×1
  • security_hooks._store_segment_destroys (cognitive 56) backend/core/security_hooks.py:1114 — security_hooks._store_segment_destroys has cognitive complexity 56 (threshold 15). Drivers by points: if/else 21 (41 pts), boolean chains 7, loops 3 (4 pts), ternaries 2 (4 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · security_hooks._commit_only_mode_pathspecs (cognitive 56) · ×1
  • security_hooks._commit_only_mode_pathspecs (cognitive 56) backend/core/security_hooks.py:3191 — security_hooks._commit_only_mode_pathspecs has cognitive complexity 56 (threshold 15). Drivers by points: if/else 14 (46 pts), loops 2 (4 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 36). 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 · ParagraphData.__init__ (cognitive 56) · ×1
  • ParagraphData.__init__ (cognitive 56) backend/skills/s_pptx/scripts/inventory.py:140 — ParagraphData.__init__ has cognitive complexity 56 (threshold 15). Drivers by points: if/else 19 (40 pts), error handling 2 (7 pts), boolean chains 6, ternaries 1 (3 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 · html2pptx.addElements (cognitive 56) · ×1
  • html2pptx.addElements (cognitive 56) backend/skills/s_pptx/scripts/html2pptx.js:133 — html2pptx.addElements has cognitive complexity 56 (threshold 15). Drivers by points: if/else 19 (46 pts), ternaries 2 (6 pts), boolean chains 3, loops 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · docs._api_summary (cognitive 55) · ×1
  • docs._api_summary (cognitive 55) backend/core/brain_bootstrap/docs.py:380 — docs._api_summary has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 6 (24 pts), if/else 7 (15 pts), loops 4 (11 pts), boolean chains 4, error handling 1 (nesting depth added 33). 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 · file_change_classifier.parse_bash_delete_targets (cognitive 55) · ×1
  • file_change_classifier.parse_bash_delete_targets (cognitive 55) backend/core/file_change_classifier.py:268 — file_change_classifier.parse_bash_delete_targets has cognitive complexity 55 (threshold 15). Drivers by points: if/else 16 (44 pts), boolean chains 5, loops 3 (5 pts), error handling 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 · PluginManager.install_plugin (cognitive 55) · ×1
  • PluginManager.install_plugin (cognitive 55) backend/core/plugin_manager.py:696 — PluginManager.install_plugin has cognitive complexity 55 (threshold 15). Drivers by points: if/else 19 (36 pts), loops 7 (12 pts), ternaries 2 (4 pts), error handling 2 (3 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 · lifecycle._land (cognitive 55) · ×1
  • lifecycle._land (cognitive 55) backend/core/run_protocol/lifecycle.py:544 — lifecycle._land has cognitive complexity 55 (threshold 15). Drivers by points: if/else 22 (36 pts), boolean chains 15, ternaries 2 (4 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · turnZones.turnZones (cognitive 55) · ×1
  • turnZones.turnZones (cognitive 55) desktop/src/pages/chat/turnZones.ts:229 — turnZones.turnZones has cognitive complexity 55 (threshold 15). Drivers by points: boolean chains 20, if/else 11 (18 pts), ternaries 6 (15 pts), loops 2 (nesting depth added 16). Of this number, 51 points are the body's own statements and 4 belong to 5 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 · CsvRenderer.CsvRenderer (cognitive 55) · ×1
  • CsvRenderer.CsvRenderer (cognitive 55) desktop/src/components/file-viewer/renderers/CsvRenderer.tsx:49 — CsvRenderer.CsvRenderer has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 16 (23 pts), if/else 18, boolean chains 12, error handling 1, loops 1 (nesting depth added 7). Most of this is not in the body itself: 15 of the 55 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 93, 116, 62, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ProjectionLayer.project_skills (cognitive 54) · ×1
  • ProjectionLayer.project_skills (cognitive 54) backend/core/projection_layer.py:290 — ProjectionLayer.project_skills has cognitive complexity 54 (threshold 15). Drivers by points: if/else 19 (35 pts), error handling 4 (9 pts), boolean chains 4, loops 3 (4 pts), ternaries 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 · clustering.compute_graph_clusters (cognitive 53) · ×1
  • clustering.compute_graph_clusters (cognitive 53) backend/core/code_intel/clustering.py:74 — clustering.compute_graph_clusters has cognitive complexity 53 (threshold 15). Drivers by points: if/else 16 (30 pts), loops 9 (15 pts), ternaries 3 (4 pts), boolean chains 2, 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 · daily_activity_hook._get_session_git_commits (cognitive 53) · ×1
  • daily_activity_hook._get_session_git_commits (cognitive 53) backend/hooks/daily_activity_hook.py:212 — daily_activity_hook._get_session_git_commits has cognitive complexity 53 (threshold 15). Drivers by points: if/else 19 (31 pts), boolean chains 15, ternaries 2 (5 pts), error handling 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · style-extract.extract_fonts (cognitive 53) · ×1
  • style-extract.extract_fonts (cognitive 53) backend/skills/s_pptx/scripts/style-extract.py:53 — style-extract.extract_fonts has cognitive complexity 53 (threshold 15). Drivers by points: if/else 8 (30 pts), ternaries 3 (12 pts), loops 3 (9 pts), boolean chains 2 (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 · interface.delta (cognitive 52) · ×1
  • interface.delta (cognitive 52) backend/core/code_intel/interface.py:681 — interface.delta has cognitive complexity 52 (threshold 15). Drivers by points: if/else 15 (30 pts), boolean chains 18, loops 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 · RunEngine._review_facts (cognitive 52) · ×1
  • RunEngine._review_facts (cognitive 52) backend/core/run_protocol/engine.py:956 — RunEngine._review_facts has cognitive complexity 52 (threshold 15). Drivers by points: if/else 14 (31 pts), boolean chains 9, error handling 2 (6 pts), loops 3, ternaries 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 · RunEngine.review_start (cognitive 52) · ×1
  • RunEngine.review_start (cognitive 52) backend/core/run_protocol/engine.py:2908 — RunEngine.review_start has cognitive complexity 52 (threshold 15). Drivers by points: if/else 19 (32 pts), ternaries 3 (8 pts), boolean chains 7, loops 4 (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 · security_hooks._reads_script_from_stdin (cognitive 52) · ×1
  • security_hooks._reads_script_from_stdin (cognitive 52) backend/core/security_hooks.py:1337 — security_hooks._reads_script_from_stdin has cognitive complexity 52 (threshold 15). Drivers by points: if/else 17 (37 pts), ternaries 3 (8 pts), boolean chains 4, loops 2 (3 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 · swarm_out_results._checks (cognitive 52) · ×1
  • swarm_out_results._checks (cognitive 52) backend/core/swarm_out_results.py:208 — swarm_out_results._checks has cognitive complexity 52 (threshold 15). Drivers by points: ternaries 8 (21 pts), if/else 10 (16 pts), boolean chains 9, loops 4 (6 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 · pollinate._walk_assets (cognitive 52) · ×1
  • pollinate._walk_assets (cognitive 52) backend/routers/pollinate.py:327 — pollinate._walk_assets has cognitive complexity 52 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 6 (18 pts), ternaries 2 (10 pts), boolean chains 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 · cdf_write_scan.scan_tree (cognitive 52) · ×1
  • cdf_write_scan.scan_tree (cognitive 52) backend/scripts/cdf_write_scan.py:202 — cdf_write_scan.scan_tree has cognitive complexity 52 (threshold 15). Drivers by points: if/else 13 (28 pts), loops 11 (16 pts), boolean chains 6, error handling 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 · SelfLoopsHealthEngine.to_markdown (cognitive 52) · ×1
  • SelfLoopsHealthEngine.to_markdown (cognitive 52) backend/skills/s_loops-health/scripts/loops_health_check.py:844 — SelfLoopsHealthEngine.to_markdown has cognitive complexity 52 (threshold 15). Drivers by points: if/else 14 (21 pts), ternaries 12 (19 pts), loops 4 (8 pts), boolean chains 2, 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 · replace.apply_replacements (cognitive 52) · ×1
  • replace.apply_replacements (cognitive 52) backend/skills/s_pptx/scripts/replace.py:214 — replace.apply_replacements has cognitive complexity 52 (threshold 15). Drivers by points: if/else 12 (27 pts), loops 11 (24 pts), boolean chains 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 · PluginManager._install_from_marketplace_json (cognitive 51) · ×1
  • PluginManager._install_from_marketplace_json (cognitive 51) backend/core/plugin_manager.py:522 — PluginManager._install_from_marketplace_json has cognitive complexity 51 (threshold 15). Drivers by points: if/else 19 (34 pts), boolean chains 6, loops 3 (6 pts), error handling 2 (4 pts), ternaries 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · recall_filter.filter_recall (cognitive 51) · ×1
  • recall_filter.filter_recall (cognitive 51) backend/core/recall_filter.py:398 — recall_filter.filter_recall has cognitive complexity 51 (threshold 15). Drivers by points: if/else 13 (32 pts), ternaries 5 (12 pts), boolean chains 6, loops 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 · security_hooks._builtin_session_link (cognitive 51) · ×1
  • security_hooks._builtin_session_link (cognitive 51) backend/core/security_hooks.py:4731 — security_hooks._builtin_session_link has cognitive complexity 51 (threshold 15). Drivers by points: if/else 19 (30 pts), boolean chains 14, ternaries 2 (5 pts), loops 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 · turnView.deriveTurnView · ×1
  • turnView.deriveTurnView::pushToolStep (cognitive 51) REDACTED:431 — turnView.deriveTurnView::pushToolStep has cognitive complexity 51 (threshold 15). Drivers by points: ternaries 13 (42 pts), boolean chains 6, if/else 3 (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (turnView.deriveTurnView) 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 · ChatErrorMessage.ChatErrorMessage (cognitive 51) · ×1
  • ChatErrorMessage.ChatErrorMessage (cognitive 51) desktop/src/components/chat/ChatErrorMessage.tsx:55 — ChatErrorMessage.ChatErrorMessage has cognitive complexity 51 (threshold 15). Drivers by points: ternaries 14 (38 pts), boolean chains 12, if/else 1 (nesting depth added 24). Of this number, 50 points are the body's own statements and 1 belongs to one function literal 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 · file_change_classifier.parse_bash_write_targets (cognitive 50) · ×1
  • file_change_classifier.parse_bash_write_targets (cognitive 50) backend/core/file_change_classifier.py:99 — file_change_classifier.parse_bash_write_targets has cognitive complexity 50 (threshold 15). Drivers by points: if/else 12 (34 pts), loops 6 (12 pts), boolean chains 3, 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 · security_hooks._dangerous_rm_segment (cognitive 50) · ×1
  • security_hooks._dangerous_rm_segment (cognitive 50) backend/core/security_hooks.py:225 — security_hooks._dangerous_rm_segment has cognitive complexity 50 (threshold 15). Drivers by points: if/else 10 (23 pts), ternaries 4 (13 pts), loops 5 (10 pts), boolean chains 4 (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 · security_hooks._audit_inline_code (cognitive 50) · ×1
  • security_hooks._audit_inline_code (cognitive 50) backend/core/security_hooks.py:5706 — security_hooks._audit_inline_code has cognitive complexity 50 (threshold 15). Drivers by points: if/else 14 (33 pts), boolean chains 14, ternaries 1 (2 pts), 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 · ExplorerContext.ExplorerProvider (cognitive 50) · ×1
  • ExplorerContext.ExplorerProvider (cognitive 50) desktop/src/contexts/ExplorerContext.tsx:390 — ExplorerContext.ExplorerProvider has cognitive complexity 50 (threshold 15). Drivers by points: if/else 22 (32 pts), boolean chains 6, ternaries 4 (6 pts), loops 4, error handling 2 (nesting depth added 12). None of this is in the body itself: all 50 points belong to 13 function literals inside it that branch (lines 647, 610, 525, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · transcriptFeed.planTranscriptChange (cognitive 50) · ×1
  • transcriptFeed.planTranscriptChange (cognitive 50) desktop/src/hooks/transcriptFeed.ts:71 — transcriptFeed.planTranscriptChange has cognitive complexity 50 (threshold 15). Drivers by points: if/else 15 (21 pts), ternaries 9 (15 pts), boolean chains 11, loops 2 (3 pts) (nesting depth added 13). Of this number, 38 points are the body's own statements and 12 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelGateway.handle_inbound_message (cognitive 49) · ×1
  • ChannelGateway.handle_inbound_message (cognitive 49) backend/channels/gateway.py:1283 — ChannelGateway.handle_inbound_message has cognitive complexity 49 (threshold 15). Drivers by points: if/else 20 (29 pts), error handling 4 (10 pts), boolean chains 8, ternaries 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · clean_daily_activity._merge_entries (cognitive 49) · ×1
  • clean_daily_activity._merge_entries (cognitive 49) backend/scripts/clean_daily_activity.py:134 — clean_daily_activity._merge_entries has cognitive complexity 49 (threshold 15). Drivers by points: if/else 12 (29 pts), loops 6 (14 pts), boolean chains 4, ternaries 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 · generate_app_execution_releases.verify_attestation (cognitive 49) · ×1
  • generate_app_execution_releases.verify_attestation (cognitive 49) backend/scripts/generate_app_execution_releases.py:103 — generate_app_execution_releases.verify_attestation has cognitive complexity 49 (threshold 15). Drivers by points: if/else 25 (41 pts), boolean chains 6, loops 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 · pptx_to_deck.extract (cognitive 49) · ×1
  • pptx_to_deck.extract (cognitive 49) backend/skills/s_pollinate/scripts/pptx_to_deck.py:36 — pptx_to_deck.extract has cognitive complexity 49 (threshold 15). Drivers by points: if/else 10 (28 pts), loops 5 (12 pts), boolean chains 6, ternaries 2 (3 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 · TurnZones.ToolStripV6 (cognitive 49) · ×1
  • TurnZones.ToolStripV6 (cognitive 49) desktop/src/pages/chat/components/TurnZones.tsx:352 — TurnZones.ToolStripV6 has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 23 (42 pts), boolean chains 7 (nesting depth added 19). Of this number, 48 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _ClaudeClientWrapper._extract_pid (cognitive 48) · ×1
  • _ClaudeClientWrapper._extract_pid (cognitive 48) backend/core/claude_environment.py:78 — _ClaudeClientWrapper._extract_pid has cognitive complexity 48 (threshold 15). Drivers by points: if/else 18 (41 pts), error handling 2 (3 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · writer._execute_plan (cognitive 48) · ×1
  • writer._execute_plan (cognitive 48) backend/core/ingestion/writer.py:842 — writer._execute_plan has cognitive complexity 48 (threshold 15). Drivers by points: if/else 14 (40 pts), boolean chains 5, ternaries 1 (2 pts), loops 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 · SessionUnit._emit_post_stream_metadata (cognitive 48) · ×1
  • SessionUnit._emit_post_stream_metadata (cognitive 48) backend/core/session_unit.py:3546 — SessionUnit._emit_post_stream_metadata has cognitive complexity 48 (threshold 15). Drivers by points: if/else 13 (19 pts), ternaries 8 (14 pts), error handling 5 (8 pts), boolean chains 7 (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 · swarm_out._open_asks (cognitive 48) · ×1
  • swarm_out._open_asks (cognitive 48) backend/core/swarm_out.py:1286 — swarm_out._open_asks has cognitive complexity 48 (threshold 15). Drivers by points: if/else 14 (31 pts), boolean chains 7, ternaries 2 (6 pts), loops 3 (4 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 · eval_scheduled.run_eval_scheduled (cognitive 48) · ×1
  • eval_scheduled.run_eval_scheduled (cognitive 48) backend/jobs/handlers/eval_scheduled.py:148 — eval_scheduled.run_eval_scheduled has cognitive complexity 48 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 17, error handling 3 (7 pts), ternaries 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 · backfill_cjk_escapes.backfill (cognitive 48) · ×1
  • backfill_cjk_escapes.backfill (cognitive 48) backend/scripts/backfill_cjk_escapes.py:579 — backfill_cjk_escapes.backfill has cognitive complexity 48 (threshold 15). Drivers by points: if/else 16 (26 pts), loops 6 (9 pts), boolean chains 7, error handling 3 (6 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 · migrate_followups_to_todos.da_items (cognitive 48) · ×1
  • migrate_followups_to_todos.da_items (cognitive 48) backend/scripts/migrate_followups_to_todos.py:157 — migrate_followups_to_todos.da_items has cognitive complexity 48 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 16, loops 7 (11 pts), ternaries 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VirtualizedTree.flattenTree (cognitive 48) · ×1
  • VirtualizedTree.flattenTree (cognitive 48) desktop/src/components/workspace-explorer/VirtualizedTree.tsx:264 — VirtualizedTree.flattenTree has cognitive complexity 48 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 10 (14 pts), boolean chains 10 (nesting depth added 17). Of this number, 47 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pipelineRows.fromLocal (cognitive 48) · ×1
  • pipelineRows.fromLocal (cognitive 48) desktop/src/components/layout/pipelineRows.ts:70 — pipelineRows.fromLocal has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 16 (41 pts), boolean chains 7 (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 · FileTypes._scan_method (cognitive 47) · ×1
  • FileTypes._scan_method (cognitive 47) backend/core/code_intel/receivers.py:759 — FileTypes._scan_method has cognitive complexity 47 (threshold 15). Drivers by points: if/else 11 (28 pts), boolean chains 13, loops 2 (3 pts), ternaries 2 (3 pts) (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ContextDirectoryLoader._assemble_from_sources (cognitive 47) · ×1
  • ContextDirectoryLoader._assemble_from_sources (cognitive 47) backend/core/context_directory_loader.py:951 — ContextDirectoryLoader._assemble_from_sources has cognitive complexity 47 (threshold 15). Drivers by points: if/else 15 (32 pts), error handling 3 (7 pts), boolean chains 5, loops 2, 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 · provenance.sync_run_evidence (cognitive 47) · ×1
  • provenance.sync_run_evidence (cognitive 47) backend/core/run_protocol/provenance.py:52 — provenance.sync_run_evidence has cognitive complexity 47 (threshold 15). Drivers by points: if/else 9 (20 pts), ternaries 3 (9 pts), boolean chains 8, loops 4 (7 pts), error handling 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 · run_worktree.sweep (cognitive 47) · ×1
  • run_worktree.sweep (cognitive 47) backend/core/run_worktree.py:1782 — run_worktree.sweep has cognitive complexity 47 (threshold 15). Drivers by points: if/else 9 (23 pts), boolean chains 7, error handling 2 (6 pts), ternaries 4 (6 pts), loops 4 (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 · SessionUnit._pid_watchdog_loop (cognitive 47) · ×1
  • SessionUnit._pid_watchdog_loop (cognitive 47) backend/core/session_unit.py:1842 — SessionUnit._pid_watchdog_loop has cognitive complexity 47 (threshold 15). Drivers by points: if/else 9 (38 pts), error handling 3 (5 pts), boolean chains 3, loops 1 (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 · worktree_write_gate._git_verdict (cognitive 47) · ×1
  • worktree_write_gate._git_verdict (cognitive 47) backend/core/worktree_write_gate.py:435 — worktree_write_gate._git_verdict has cognitive complexity 47 (threshold 15). Drivers by points: if/else 16 (27 pts), boolean chains 16, loops 1 (2 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 · turnZones.pipelineZones (cognitive 47) · ×1
  • turnZones.pipelineZones (cognitive 47) desktop/src/pages/chat/turnZones.ts:308 — turnZones.pipelineZones has cognitive complexity 47 (threshold 15). Drivers by points: if/else 21 (40 pts), boolean chains 5, loops 2 (nesting depth added 19). Of this number, 39 points are the body's own statements and 8 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 · DispatchCard.DispatchCard (cognitive 47) · ×1
  • DispatchCard.DispatchCard (cognitive 47) desktop/src/pages/chat/components/DispatchCard.tsx:160 — DispatchCard.DispatchCard has cognitive complexity 47 (threshold 15). Drivers by points: boolean chains 30, ternaries 8 (16 pts), if/else 1 (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 · ddd_packager.package_ddd (cognitive 46) · ×1
  • ddd_packager.package_ddd (cognitive 46) backend/core/ddd_packager.py:1867 — ddd_packager.package_ddd has cognitive complexity 46 (threshold 15). Drivers by points: if/else 17 (33 pts), loops 4 (6 pts), boolean chains 5, ternaries 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 · StarterMaterial.MaterialPicker (cognitive 46) · ×1
  • StarterMaterial.MaterialPicker (cognitive 46) desktop/src/components/layout/StarterMaterial.tsx:47 — StarterMaterial.MaterialPicker has cognitive complexity 46 (threshold 15). Drivers by points: if/else 15 (18 pts), ternaries 11 (17 pts), boolean chains 7, error handling 2 (3 pts), loops 1 (nesting depth added 10). Most of this is not in the body itself: 1 of the 46 points is its own statement and the rest belongs to 14 function literals inside it that branch (lines 137, 111, 87, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ToDoOverlay.TodoForm (cognitive 46) · ×1
  • ToDoOverlay.TodoForm (cognitive 46) desktop/src/components/layout/ToDoOverlay.tsx:938 — ToDoOverlay.TodoForm has cognitive complexity 46 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 9 (13 pts), boolean chains 9, error handling 4 (7 pts), loops 2 (4 pts) (nesting depth added 11). Most of this is not in the body itself: 11 of the 46 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 1003, 968, 960, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · turnControls.sendMessage (cognitive 46) · ×1
  • turnControls.sendMessage (cognitive 46) desktop/src/pages/chat/turnControls.ts:224 — turnControls.sendMessage has cognitive complexity 46 (threshold 15). Drivers by points: if/else 24 (28 pts), boolean chains 12, ternaries 5, error handling 1 (nesting depth added 4). Of this number, 43 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 · status.north_star (cognitive 45) · ×1
  • status.north_star (cognitive 45) backend/core/ingestion/status.py:94 — status.north_star has cognitive complexity 45 (threshold 15). Drivers by points: if/else 8 (17 pts), ternaries 8 (14 pts), boolean chains 6, loops 5 (6 pts), error handling 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 · recall_multi._render_domain_hits (cognitive 45) · ×1
  • recall_multi._render_domain_hits (cognitive 45) backend/core/recall_multi.py:747 — recall_multi._render_domain_hits has cognitive complexity 45 (threshold 15). Drivers by points: if/else 12 (33 pts), boolean chains 8, ternaries 1 (3 pts), loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · answers.parse_answer (cognitive 45) · ×1
  • answers.parse_answer (cognitive 45) backend/core/run_protocol/answers.py:139 — answers.parse_answer has cognitive complexity 45 (threshold 15). Drivers by points: if/else 22 (33 pts), boolean chains 10, 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 · schemas.validate_design_spec (cognitive 45) · ×1
  • schemas.validate_design_spec (cognitive 45) backend/core/run_protocol/schemas.py:505 — schemas.validate_design_spec has cognitive complexity 45 (threshold 15). Drivers by points: if/else 13 (24 pts), loops 5 (14 pts), boolean chains 6, ternaries 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · security_hooks._unwrap_program (cognitive 45) · ×1
  • security_hooks._unwrap_program (cognitive 45) backend/core/security_hooks.py:4108 — security_hooks._unwrap_program has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (34 pts), boolean chains 7, loops 2 (4 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 · SessionRouter._persist_stream_event (cognitive 45) · ×1
  • SessionRouter._persist_stream_event (cognitive 45) backend/core/session_router.py:2598 — SessionRouter._persist_stream_event has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (20 pts), error handling 4 (11 pts), boolean chains 6, loops 2 (5 pts), ternaries 1 (3 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 · chat.chat_stream (cognitive 45) · ×1
  • chat.chat_stream (cognitive 45) backend/routers/chat.py:390 — chat.chat_stream has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 12, error handling 5 (8 pts), ternaries 5 (8 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 · PipelineRunCard.PipelineRunCard (cognitive 45) · ×1
  • PipelineRunCard.PipelineRunCard (cognitive 45) desktop/src/components/layout/PipelineRunCard.tsx:66 — PipelineRunCard.PipelineRunCard has cognitive complexity 45 (threshold 15). Drivers by points: boolean chains 24, if/else 11, ternaries 6 (10 pts) (nesting depth added 4). Of this number, 28 points are the body's own statements and 17 belong to 10 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AIModelsTab.AIModelsTab (cognitive 45) · ×1
  • AIModelsTab.AIModelsTab (cognitive 45) desktop/src/components/settings/AIModelsTab.tsx:24 — AIModelsTab.AIModelsTab has cognitive complexity 45 (threshold 15). Drivers by points: boolean chains 20, ternaries 11 (12 pts), if/else 7, error handling 6 (nesting depth added 1). Most of this is not in the body itself: 10 of the 45 points are its own statements and the rest belongs to 15 function items inside it that branch (handleAddDiscovered, a function literal at line 79, handleRefreshFromBedrock, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · apply.apply_entries (cognitive 44) · ×1
  • apply.apply_entries (cognitive 44) backend/core/brain_bootstrap/apply.py:474 — apply.apply_entries has cognitive complexity 44 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 5 (9 pts), error handling 5 (7 pts), ternaries 5 (7 pts), boolean chains 5 (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 · interface._java_scan_types (cognitive 44) · ×1
  • interface._java_scan_types (cognitive 44) backend/core/code_intel/interface.py:347 — interface._java_scan_types has cognitive complexity 44 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 3 (7 pts), ternaries 3 (7 pts), boolean chains 4 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · child_cli.dispatch (cognitive 44) · ×1
  • child_cli.dispatch (cognitive 44) backend/core/run_protocol/child_cli.py:329 — child_cli.dispatch has cognitive complexity 44 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 11, error handling 2 (5 pts), ternaries 3 (4 pts), loops 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.
D2 · Cognitive Complexity · RunEngine.review_proof (cognitive 44) · ×1
  • RunEngine.review_proof (cognitive 44) backend/core/run_protocol/engine.py:1697 — RunEngine.review_proof has cognitive complexity 44 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 9, error handling 2 (6 pts), loops 3 (5 pts), 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 · swarm_out._dispatch_spec (cognitive 44) · ×1
  • swarm_out._dispatch_spec (cognitive 44) backend/core/swarm_out.py:773 — swarm_out._dispatch_spec has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 14 (15 pts), if/else 13 (14 pts), boolean chains 8, error handling 5 (7 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · swarm_out.answer (cognitive 44) · ×1
  • swarm_out.answer (cognitive 44) backend/core/swarm_out.py:2184 — swarm_out.answer has cognitive complexity 44 (threshold 15). Drivers by points: if/else 22 (32 pts), boolean chains 10, 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 · task_repos.parse (cognitive 44) · ×1
  • task_repos.parse (cognitive 44) backend/core/task_repos.py:112 — task_repos.parse has cognitive complexity 44 (threshold 15). Drivers by points: if/else 18 (36 pts), boolean chains 7, 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 · DocxXMLEditor.suggest_deletion (cognitive 44) · ×1
  • DocxXMLEditor.suggest_deletion (cognitive 44) backend/skills/s_docx/scripts/document.py:482 — DocxXMLEditor.suggest_deletion has cognitive complexity 44 (threshold 15). Drivers by points: loops 8 (20 pts), if/else 10 (19 pts), ternaries 1 (3 pts), boolean chains 2 (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 · useChatStreamingLifecycle.useChatStreamingLifecycle.createDisconnectHandler.<returned closure> (cognitive 44) · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle.createDisconnectHandler.<returned closure> (cognitive 44) desktop/src/hooks/useChatStreamingLifecycle.ts:4525 — useChatStreamingLifecycle.useChatStreamingLifecycle.createDisconnectHandler.<returned closure> has cognitive complexity 44 (threshold 15). Drivers by points: if/else 14 (32 pts), error handling 2 (7 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 25). Most of this is not in the body itself: 14 of the 44 points are its own statements and the rest belongs to one function literal inside it that branches (line 4563). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · PollinateOverlay.AssetDrawer (cognitive 44) · ×1
  • PollinateOverlay.AssetDrawer (cognitive 44) desktop/src/components/layout/PollinateOverlay.tsx:492 — PollinateOverlay.AssetDrawer has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 14 (25 pts), if/else 9 (11 pts), boolean chains 8 (nesting depth added 13). Of this number, 32 points are the body's own statements and 12 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · interface.bound_names (cognitive 43) · ×1
  • interface.bound_names (cognitive 43) backend/core/code_intel/interface.py:479 — interface.bound_names has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (27 pts), boolean chains 9, loops 3 (7 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 · parser._extract_from_tree (cognitive 43) · ×1
  • parser._extract_from_tree (cognitive 43) backend/core/code_intel/parser.py:1168 — parser._extract_from_tree has cognitive complexity 43 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 4 (11 pts), ternaries 7, boolean chains 5 (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 · s7_review.knowledge_view (cognitive 43) · ×1
  • s7_review.knowledge_view (cognitive 43) backend/core/ingestion/sources/s7_review.py:213 — s7_review.knowledge_view has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (31 pts), boolean chains 8, loops 3 (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 · run_owner_gate._decide (cognitive 43) · ×1
  • run_owner_gate._decide (cognitive 43) backend/core/run_owner_gate.py:512 — run_owner_gate._decide has cognitive complexity 43 (threshold 15). Drivers by points: if/else 18 (36 pts), boolean chains 6, 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 · decision.validate (cognitive 43) · ×1
  • decision.validate (cognitive 43) backend/core/run_protocol/decision.py:41 — decision.validate has cognitive complexity 43 (threshold 15). Drivers by points: if/else 17 (28 pts), loops 4 (8 pts), boolean chains 7 (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 · RunEngine.create (cognitive 43) · ×1
  • RunEngine.create (cognitive 43) backend/core/run_protocol/engine.py:465 — RunEngine.create has cognitive complexity 43 (threshold 15). Drivers by points: boolean chains 18, if/else 14 (17 pts), error handling 4 (6 pts), 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 · trace.matrix (cognitive 43) · ×1
  • trace.matrix (cognitive 43) backend/core/run_protocol/trace.py:19 — trace.matrix has cognitive complexity 43 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 6 (10 pts), boolean chains 9 (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 · DailyActivityExtractionHook._capture_git_activity (cognitive 43) · ×1
  • DailyActivityExtractionHook._capture_git_activity (cognitive 43) backend/hooks/daily_activity_hook.py:752 — DailyActivityExtractionHook._capture_git_activity has cognitive complexity 43 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 4 (11 pts), error handling 4 (7 pts), boolean chains 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · backfill_cjk_escapes._populate_seg_columns (cognitive 43) · ×1
  • backfill_cjk_escapes._populate_seg_columns (cognitive 43) backend/scripts/backfill_cjk_escapes.py:447 — backfill_cjk_escapes._populate_seg_columns has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (27 pts), loops 5 (11 pts), boolean chains 5 (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 · LibraryPanel.LibraryPanel (cognitive 43) · ×1
  • LibraryPanel.LibraryPanel (cognitive 43) backend/apps/pptx-maker/package/upstream/kirocrew/website/src/apps/pptx-maker/LibraryPanel.tsx:98 — LibraryPanel.LibraryPanel has cognitive complexity 43 (threshold 15). Drivers by points: boolean chains 23, ternaries 19, if/else 1. Of this number, 32 points are the body's own statements and 11 belong to 7 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · turnZones.layOut (cognitive 43) · ×1
  • turnZones.layOut (cognitive 43) desktop/src/pages/chat/turnZones.ts:138 — turnZones.layOut has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (28 pts), ternaries 3 (8 pts), boolean chains 6, loops 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 · RunList.Row (cognitive 43) · ×1
  • RunList.Row (cognitive 43) desktop/src/components/swarm-out/RunList.tsx:63 — RunList.Row has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 16 (33 pts), boolean chains 9, if/else 1 (nesting depth added 17). Of this number, 40 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CasesTab.CaseDetailView (cognitive 43) · ×1
  • CasesTab.CaseDetailView (cognitive 43) desktop/src/pages/eval/CasesTab.tsx:368 — CasesTab.CaseDetailView has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 18 (23 pts), boolean chains 18, if/else 2 (nesting depth added 5). Of this number, 38 points are the body's own statements and 5 belong to 4 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · mcp_config_loader.merge_catalog_template (cognitive 42) · ×1
  • mcp_config_loader.merge_catalog_template (cognitive 42) backend/core/mcp_config_loader.py:149 — mcp_config_loader.merge_catalog_template has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (29 pts), error handling 4 (6 pts), ternaries 1 (4 pts), loops 2, boolean chains 1 (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 · recall_multi._recall_ddd (cognitive 42) · ×1
  • recall_multi._recall_ddd (cognitive 42) backend/core/recall_multi.py:1260 — recall_multi._recall_ddd has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 4 (10 pts), error handling 2 (6 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SummarizationPipeline._extract_topics (cognitive 42) · ×1
  • SummarizationPipeline._extract_topics (cognitive 42) backend/core/summarization.py:347 — SummarizationPipeline._extract_topics has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (38 pts), boolean chains 3, loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cdf_move_misrouted.run (cognitive 42) · ×1
  • cdf_move_misrouted.run (cognitive 42) backend/scripts/cdf_move_misrouted.py:97 — cdf_move_misrouted.run has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 8 (10 pts), ternaries 8 (10 pts), boolean chains 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · context_recall_cli.main (cognitive 42) · ×1
  • context_recall_cli.main (cognitive 42) backend/scripts/context_recall_cli.py:57 — context_recall_cli.main has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 3 (6 pts), boolean chains 5, error handling 2 (3 pts), ternaries 2 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · eval_runner.eval_trajectory_capture (cognitive 42) · ×1
  • eval_runner.eval_trajectory_capture (cognitive 42) backend/scripts/eval_runner.py:1549 — eval_runner.eval_trajectory_capture has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 12, error handling 4 (7 pts), 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 · eval_runner.evaluate_case (cognitive 42) · ×1
  • eval_runner.evaluate_case (cognitive 42) backend/scripts/eval_runner.py:1990 — eval_runner.evaluate_case has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (37 pts), loops 3 (5 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 · sessionTurnRouter.routePostEvent (cognitive 42) · ×1
  • sessionTurnRouter.routePostEvent (cognitive 42) desktop/src/hooks/sessionTurnRouter.ts:162 — sessionTurnRouter.routePostEvent has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (25 pts), loops 3 (9 pts), boolean chains 8 (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 · ChatInput.ChatInput (cognitive 42) · ×1
  • ChatInput.ChatInput (cognitive 42) desktop/src/pages/chat/components/ChatInput.tsx:173 — ChatInput.ChatInput has cognitive complexity 42 (threshold 15). Drivers by points: if/else 60 (73 pts), boolean chains 54, ternaries 16 (25 pts), error handling 1, loops 1 (nesting depth added 22). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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. This shape REPEATS in the file: one other method here (ChatInput.ChatInput::handleKeyDown) 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 · OnboardingPage.OnboardingPage (cognitive 42) · ×1
  • OnboardingPage.OnboardingPage (cognitive 42) desktop/src/pages/OnboardingPage.tsx:70 — OnboardingPage.OnboardingPage has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 10 (15 pts), if/else 9 (12 pts), boolean chains 10, error handling 4 (5 pts) (nesting depth added 9). Most of this is not in the body itself: 11 of the 42 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 95, 201, 94, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · brain-demo.html.act (cognitive 42) · ×1
  • brain-demo.html.act (cognitive 42) docs/design/brain-demo.html:697 — brain-demo.html.act has cognitive complexity 42 (threshold 15). Drivers by points: if/else 30 (38 pts), ternaries 2 (4 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.
D2 · Cognitive Complexity · community_data.build_feed (cognitive 41) · ×1
  • community_data.build_feed (cognitive 41) backend/core/community_data.py:274 — community_data.build_feed has cognitive complexity 41 (threshold 15). Drivers by points: if/else 6 (16 pts), ternaries 3 (11 pts), error handling 3 (10 pts), loops 2 (3 pts), boolean chains 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 · DddCultivationOrchestrator._ch_ddd_staleness (cognitive 41) · ×1
  • DddCultivationOrchestrator._ch_ddd_staleness (cognitive 41) backend/core/ddd_orchestrator.py:292 — DddCultivationOrchestrator._ch_ddd_staleness has cognitive complexity 41 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 4 (9 pts), ternaries 2 (6 pts), error handling 2 (4 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · queries.brain_changes (cognitive 41) · ×1
  • queries.brain_changes (cognitive 41) backend/core/ingestion/queries.py:567 — queries.brain_changes has cognitive complexity 41 (threshold 15). Drivers by points: if/else 8 (18 pts), ternaries 5 (12 pts), boolean chains 10, 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 · usage._observe_bash_read (cognitive 41) · ×1
  • usage._observe_bash_read (cognitive 41) backend/core/ingestion/usage.py:350 — usage._observe_bash_read has cognitive complexity 41 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 9, loops 5 (8 pts), ternaries 4 (7 pts), error handling 1 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · security_hooks._js_pm_shell_c_command (cognitive 41) · ×1
  • security_hooks._js_pm_shell_c_command (cognitive 41) backend/core/security_hooks.py:4310 — security_hooks._js_pm_shell_c_command has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (28 pts), loops 2 (5 pts), boolean chains 4, ternaries 2 (4 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 · memory_health.run_memory_health (cognitive 41) · ×1
  • memory_health.run_memory_health (cognitive 41) backend/jobs/handlers/memory_health.py:137 — memory_health.run_memory_health has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (22 pts), loops 3 (6 pts), boolean chains 5, error handling 2 (5 pts), ternaries 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 · memory_relocate.run (cognitive 41) · ×1
  • memory_relocate.run (cognitive 41) backend/scripts/memory_relocate.py:196 — memory_relocate.run has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 7 (9 pts), boolean chains 6, ternaries 3 (6 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 · TerminalPanel.TerminalPanel (cognitive 41) · ×1
  • TerminalPanel.TerminalPanel (cognitive 41) desktop/src/components/terminal/TerminalPanel.tsx:146 — TerminalPanel.TerminalPanel has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (17 pts), boolean chains 15, ternaries 8, loops 1 (nesting depth added 1). Most of this is not in the body itself: 8 of the 41 points are its own statements and the rest belongs to 16 function items inside it that branch (a function literal at line 483, closeHere, a function literal at line 227, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · aws_account._check_candidate (cognitive 40) · ×1
  • aws_account._check_candidate (cognitive 40) backend/core/aws_account.py:485 — aws_account._check_candidate has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 15, ternaries 3 (4 pts), 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 · swarm_out_card._text_of (cognitive 40) · ×1
  • swarm_out_card._text_of (cognitive 40) backend/core/swarm_out_card.py:340 — swarm_out_card._text_of has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 11, ternaries 8 (11 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 · swarm_out_record.funnel (cognitive 40) · ×1
  • swarm_out_record.funnel (cognitive 40) backend/core/swarm_out_record.py:236 — swarm_out_record.funnel has cognitive complexity 40 (threshold 15). Drivers by points: boolean chains 20, if/else 9 (12 pts), ternaries 4 (6 pts), error handling 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 · turn_changes.session_trees (cognitive 40) · ×1
  • turn_changes.session_trees (cognitive 40) backend/core/turn_changes.py:194 — turn_changes.session_trees has cognitive complexity 40 (threshold 15). Drivers by points: if/else 7 (25 pts), error handling 4 (9 pts), boolean chains 3, loops 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 · usage_report.report (cognitive 40) · ×1
  • usage_report.report (cognitive 40) backend/core/usage_report.py:148 — usage_report.report has cognitive complexity 40 (threshold 15). Drivers by points: boolean chains 15, if/else 8 (10 pts), ternaries 9 (10 pts), loops 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 · meta_shape_migrate.rewrite (cognitive 40) · ×1
  • meta_shape_migrate.rewrite (cognitive 40) backend/scripts/meta_shape_migrate.py:77 — meta_shape_migrate.rewrite has cognitive complexity 40 (threshold 15). Drivers by points: if/else 8 (22 pts), boolean chains 7, error handling 1 (5 pts), ternaries 1 (4 pts), loops 2 (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 · ddd_format.check (cognitive 39) · ×1
  • ddd_format.check (cognitive 39) backend/core/ddd_format.py:177 — ddd_format.check has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (27 pts), ternaries 3 (6 pts), boolean chains 3, loops 2 (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 · hive_records.turn_rows (cognitive 39) · ×1
  • hive_records.turn_rows (cognitive 39) backend/core/hive_records.py:679 — hive_records.turn_rows has cognitive complexity 39 (threshold 15). Drivers by points: if/else 7 (19 pts), ternaries 4 (8 pts), loops 4 (7 pts), boolean chains 5 (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 · cli_main._localize (cognitive 39) · ×1
  • cli_main._localize (cognitive 39) backend/core/run_protocol/cli_main.py:28 — cli_main._localize has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (18 pts), ternaries 4 (13 pts), boolean chains 7, loops 1 (nesting depth added 17). 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 · events._event_contract (cognitive 39) · ×1
  • events._event_contract (cognitive 39) backend/core/run_protocol/events.py:394 — events._event_contract has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 9, ternaries 4 (6 pts), loops 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 · session_router._inject_ddd_for_active_project (cognitive 39) · ×1
  • session_router._inject_ddd_for_active_project (cognitive 39) backend/core/session_router.py:1914 — session_router._inject_ddd_for_active_project has cognitive complexity 39 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 5 (11 pts), boolean chains 7, error handling 2 (5 pts), loops 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 · CliResults.rows (cognitive 39) · ×1
  • CliResults.rows (cognitive 39) backend/core/usage_accounting.py:174 — CliResults.rows has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (18 pts), ternaries 5 (10 pts), boolean chains 8, 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 · ddd_weekly_report._generate_report (cognitive 39) · ×1
  • ddd_weekly_report._generate_report (cognitive 39) backend/jobs/handlers/ddd_weekly_report.py:182 — ddd_weekly_report._generate_report has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (23 pts), loops 7 (11 pts), ternaries 2 (4 pts), boolean chains 1 (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 · eval_runner.cmd_run (cognitive 39) · ×1
  • eval_runner.cmd_run (cognitive 39) backend/scripts/eval_runner.py:3199 — eval_runner.cmd_run has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 9, ternaries 3, 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 · recall_replay.cmd_score (cognitive 39) · ×1
  • recall_replay.cmd_score (cognitive 39) backend/scripts/recall_replay.py:331 — recall_replay.cmd_score has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 10, ternaries 2 (7 pts), loops 3 (6 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 · FileContextMenu.FileContextMenu (cognitive 39) · ×1
  • FileContextMenu.FileContextMenu (cognitive 39) desktop/src/components/workspace-explorer/FileContextMenu.tsx:61 — FileContextMenu.FileContextMenu has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (18 pts), ternaries 7 (12 pts), boolean chains 7, error handling 2 (nesting depth added 7). Most of this is not in the body itself: 9 of the 39 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 105, 143, 169, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · BrainHub.DistributeView (cognitive 39) · ×1
  • BrainHub.DistributeView (cognitive 39) desktop/src/components/layout/BrainHub.tsx:1082 — BrainHub.DistributeView has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 16 (28 pts), boolean chains 6, if/else 4 (5 pts) (nesting depth added 13). Of this number, 25 points are the body's own statements and 14 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PipelineRunCard.Commands (cognitive 39) · ×1
  • PipelineRunCard.Commands (cognitive 39) desktop/src/components/layout/PipelineRunCard.tsx:294 — PipelineRunCard.Commands has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 19, if/else 9 (10 pts), ternaries 5 (9 pts), error handling 1 (nesting depth added 5). Most of this is not in the body itself: 15 of the 39 points are its own statements and the rest belongs to 7 function items inside it that branch (button, act, a function literal at line 354, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · RepoPane.RepoPane (cognitive 39) · ×1
  • RepoPane.RepoPane (cognitive 39) desktop/src/components/workspace-explorer/RepoPane.tsx:75 — RepoPane.RepoPane has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 16, ternaries 3, error handling 2 (nesting depth added 1). Of this number, 18 points are the body's own statements and 21 belong to 10 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 · local_roots.migrate_once (cognitive 38) · ×1
  • local_roots.migrate_once (cognitive 38) backend/core/code_intel/local_roots.py:379 — local_roots.migrate_once has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 7, error handling 2 (5 pts), loops 3 (4 pts), 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 · context_injector._extract_tool_summary (cognitive 38) · ×1
  • context_injector._extract_tool_summary (cognitive 38) backend/core/context_injector.py:259 — context_injector._extract_tool_summary has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (27 pts), boolean chains 7, loops 2 (3 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 · governed_edit.apply_sync (cognitive 38) · ×1
  • governed_edit.apply_sync (cognitive 38) backend/core/ingestion/governed_edit.py:753 — governed_edit.apply_sync has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 6, loops 5, 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 · knowledge_store.sync_knowledge_index (cognitive 38) · ×1
  • knowledge_store.sync_knowledge_index (cognitive 38) backend/core/knowledge_store.py:861 — knowledge_store.sync_knowledge_index has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 6 (9 pts), error handling 2 (4 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 · run_worktree._signed_view (cognitive 38) · ×1
  • run_worktree._signed_view (cognitive 38) backend/core/run_worktree.py:1431 — run_worktree._signed_view has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 13, error handling 2 (3 pts), loops 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 · security_hooks._rm_segment_is_dangerous (cognitive 38) · ×1
  • security_hooks._rm_segment_is_dangerous (cognitive 38) backend/core/security_hooks.py:309 — security_hooks._rm_segment_is_dangerous has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 10, loops 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 · security_hooks._discard_dirs (cognitive 38) · ×1
  • security_hooks._discard_dirs (cognitive 38) backend/core/security_hooks.py:1449 — security_hooks._discard_dirs has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (16 pts), ternaries 3 (11 pts), boolean chains 7, loops 3 (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 · SessionRouter._published_events (cognitive 38) · ×1
  • SessionRouter._published_events (cognitive 38) backend/core/session_router.py:4163 — SessionRouter._published_events has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 6, ternaries 2 (3 pts), loops 2, 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 · worktree_write_gate.judge (cognitive 38) · ×1
  • worktree_write_gate.judge (cognitive 38) backend/core/worktree_write_gate.py:526 — worktree_write_gate.judge has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 9, ternaries 2 (4 pts), 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 · channels.update_channel (cognitive 38) · ×1
  • channels.update_channel (cognitive 38) backend/routers/channels.py:180 — channels.update_channel has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (24 pts), error handling 2 (6 pts), ternaries 4 (5 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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 · eval_runner.bootstrap_counts (cognitive 38) · ×1
  • eval_runner.bootstrap_counts (cognitive 38) backend/scripts/eval_runner.py:1795 — eval_runner.bootstrap_counts has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 7, ternaries 3 (4 pts), loops 2 (3 pts), error handling 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 · replace.validate_replacements (cognitive 38) · ×1
  • replace.validate_replacements (cognitive 38) backend/skills/s_pptx/scripts/replace.py:162 — replace.validate_replacements has cognitive complexity 38 (threshold 15). Drivers by points: if/else 7 (26 pts), loops 3 (7 pts), ternaries 1 (4 pts), boolean chains 1 (nesting depth added 26). 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 · AskUserQuestion.AskUserQuestion (cognitive 38) · ×1
  • AskUserQuestion.AskUserQuestion (cognitive 38) desktop/src/components/common/AskUserQuestion.tsx:35 — AskUserQuestion.AskUserQuestion has cognitive complexity 38 (threshold 15). Drivers by points: boolean chains 17, ternaries 8 (13 pts), if/else 8 (nesting depth added 5). Most of this is not in the body itself: 8 of the 38 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 134, a function literal at line 58, a function literal at line 83, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · OverviewTab.Dimensions (cognitive 38) · ×1
  • OverviewTab.Dimensions (cognitive 38) desktop/src/pages/eval/OverviewTab.tsx:253 — OverviewTab.Dimensions has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 19 (26 pts), boolean chains 12 (nesting depth added 7). Most of this is not in the body itself: 3 of the 38 points are its own statements and the rest belongs to 6 function items inside it that branch (caseCol, metricCol, a function literal at line 315, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · SlackChannelAdapter._text_to_blocks (cognitive 37) · ×1
  • SlackChannelAdapter._text_to_blocks (cognitive 37) REDACTED:1945 — SlackChannelAdapter._text_to_blocks has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 4 (7 pts), boolean chains 6, ternaries 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · domain_rules.compute_domain_rules (cognitive 37) · ×1
  • domain_rules.compute_domain_rules (cognitive 37) backend/core/code_intel/domain_rules.py:157 — domain_rules.compute_domain_rules has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 5 (14 pts), loops 4 (7 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · context_injector.build_resume_context (cognitive 37) · ×1
  • context_injector.build_resume_context (cognitive 37) backend/core/context_injector.py:1233 — context_injector.build_resume_context has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 5, ternaries 4 (5 pts), error handling 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mcp_migration.migrate_if_needed (cognitive 37) · ×1
  • mcp_migration.migrate_if_needed (cognitive 37) backend/core/mcp_migration.py:28 — mcp_migration.migrate_if_needed has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (28 pts), error handling 3 (4 pts), loops 3 (4 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 · PluginManager.sync_git_marketplace (cognitive 37) · ×1
  • PluginManager.sync_git_marketplace (cognitive 37) backend/core/plugin_manager.py:118 — PluginManager.sync_git_marketplace has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (25 pts), error handling 2 (6 pts), loops 3 (4 pts), boolean chains 2 (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 · child_cli._clean_plan (cognitive 37) · ×1
  • child_cli._clean_plan (cognitive 37) backend/core/run_protocol/child_cli.py:115 — child_cli._clean_plan has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 9, loops 3 (4 pts), 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 · session_changes.row_facts (cognitive 37) · ×1
  • session_changes.row_facts (cognitive 37) backend/core/session_changes.py:69 — session_changes.row_facts has cognitive complexity 37 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 3 (9 pts), boolean chains 7, loops 2 (4 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 · eval._build_learning_dashboard (cognitive 37) · ×1
  • eval._build_learning_dashboard (cognitive 37) backend/routers/eval.py:434 — eval._build_learning_dashboard has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 4 (11 pts), error handling 2 (6 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · settings.update_app_configuration (cognitive 37) · ×1
  • settings.update_app_configuration (cognitive 37) backend/routers/settings.py:299 — settings.update_app_configuration has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (27 pts), boolean chains 8, error handling 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 · ai_ready_helpers.compute_business_rules_dimension (cognitive 37) · ×1
  • ai_ready_helpers.compute_business_rules_dimension (cognitive 37) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2090 — ai_ready_helpers.compute_business_rules_dimension has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 9, loops 2 (5 pts), ternaries 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 · TreeNodeRow.TreeNodeRow (cognitive 37) · ×1
  • TreeNodeRow.TreeNodeRow (cognitive 37) desktop/src/components/workspace-explorer/TreeNodeRow.tsx:190 — TreeNodeRow.TreeNodeRow has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 14 (17 pts), if/else 10 (11 pts), boolean chains 9 (nesting depth added 4). Of this number, 27 points are the body's own statements and 10 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · CasesTab.CaseForm (cognitive 37) · ×1
  • CasesTab.CaseForm (cognitive 37) desktop/src/pages/eval/CasesTab.tsx:537 — CasesTab.CaseForm has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 18 (27 pts), boolean chains 10 (nesting depth added 9). Most of this is not in the body itself: 14 of the 37 points are its own statements and the rest belongs to 4 function items inside it that branch (payload, a function literal at line 656, a function literal at line 604, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · HiveFleet.HiveSetupStep (cognitive 37) · ×1
  • HiveFleet.HiveSetupStep (cognitive 37) desktop/src/components/awsAccount/HiveFleet.tsx:115 — HiveFleet.HiveSetupStep has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 16, ternaries 10 (15 pts), if/else 5, error handling 1 (nesting depth added 5). Of this number, 28 points are the body's own statements and 9 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TerminalTab.TerminalTab (cognitive 37) · ×1
  • TerminalTab.TerminalTab (cognitive 37) desktop/src/components/terminal/TerminalTab.tsx:124 — TerminalTab.TerminalTab has cognitive complexity 37 (threshold 15). Drivers by points: if/else 19 (21 pts), boolean chains 11, error handling 3 (5 pts) (nesting depth added 4). Most of this is not in the body itself: 4 of the 37 points are its own statements and the rest belongs to 13 function items inside it that branch (a function literal at line 243, a function literal at line 353, a function literal at line 271, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · brain-demo.html.tick (cognitive 37) · ×1
  • brain-demo.html.tick (cognitive 37) docs/design/brain-demo.html:287 — brain-demo.html.tick has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15 (29 pts), boolean chains 4, loops 3 (4 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 · file_change_classifier.parse_bash_heredoc_write_candidates (cognitive 36) · ×1
  • file_change_classifier.parse_bash_heredoc_write_candidates (cognitive 36) backend/core/file_change_classifier.py:190 — file_change_classifier.parse_bash_heredoc_write_candidates has cognitive complexity 36 (threshold 15). Drivers by points: if/else 7 (17 pts), ternaries 3 (9 pts), boolean chains 5, loops 3 (5 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 · SessionUnit._ensure_spawned (cognitive 36) · ×1
  • SessionUnit._ensure_spawned (cognitive 36) backend/core/session_unit.py:3080 — SessionUnit._ensure_spawned has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (18 pts), error handling 4 (7 pts), ternaries 2 (6 pts), boolean chains 3, loops 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 · swarm_out_follow.watch (cognitive 36) · ×1
  • swarm_out_follow.watch (cognitive 36) backend/core/swarm_out_follow.py:206 — swarm_out_follow.watch has cognitive complexity 36 (threshold 15). Drivers by points: if/else 8 (17 pts), ternaries 3 (9 pts), boolean chains 5, loops 3 (5 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 · swarm_out_follow.digest (cognitive 36) · ×1
  • swarm_out_follow.digest (cognitive 36) backend/core/swarm_out_follow.py:274 — swarm_out_follow.digest has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 9, ternaries 2 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · swarm_out_results.spend_of (cognitive 36) · ×1
  • swarm_out_results.spend_of (cognitive 36) backend/core/swarm_out_results.py:1144 — swarm_out_results.spend_of has cognitive complexity 36 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 7, loops 4 (7 pts), ternaries 2 (7 pts), error handling 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · swarm_out_wait_card.card (cognitive 36) · ×1
  • swarm_out_wait_card.card (cognitive 36) backend/core/swarm_out_wait_card.py:148 — swarm_out_wait_card.card has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 14, 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 · SwarmWorkspaceManager._cleanup_legacy_content (cognitive 36) · ×1
  • SwarmWorkspaceManager._cleanup_legacy_content (cognitive 36) backend/core/swarm_workspace_manager.py:1945 — SwarmWorkspaceManager._cleanup_legacy_content has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 8 (13 pts), 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 · task_repos._one (cognitive 36) · ×1
  • task_repos._one (cognitive 36) backend/core/task_repos.py:330 — task_repos._one has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 8, ternaries 6 (8 pts), error handling 1, 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 · chat._merge_consecutive_assistant_messages (cognitive 36) · ×1
  • chat._merge_consecutive_assistant_messages (cognitive 36) backend/routers/chat.py:1102 — chat._merge_consecutive_assistant_messages has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (25 pts), boolean chains 10, 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 · tasks.create_task (cognitive 36) · ×1
  • tasks.create_task (cognitive 36) backend/routers/tasks.py:66 — tasks.create_task has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (6 pts), boolean chains 4, error handling 3 (4 pts), ternaries 1 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · da_resummarize.plan_days (cognitive 36) · ×1
  • da_resummarize.plan_days (cognitive 36) backend/scripts/da_resummarize.py:272 — da_resummarize.plan_days has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 4 (8 pts), boolean chains 3, ternaries 1 (3 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 · XMLEditor.get_node (cognitive 36) · ×1
  • XMLEditor.get_node (cognitive 36) backend/skills/s_docx/scripts/utilities.py:76 — XMLEditor.get_node has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (30 pts), ternaries 2 (5 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 · ai_ready_helpers.select_verification_tasks (cognitive 36) · ×1
  • ai_ready_helpers.select_verification_tasks (cognitive 36) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1443 — ai_ready_helpers.select_verification_tasks has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 5 (6 pts), boolean chains 4, 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 · useChatStreamingLifecycle.updateMessages (cognitive 36) · ×1
  • useChatStreamingLifecycle.updateMessages (cognitive 36) desktop/src/hooks/useChatStreamingLifecycle.ts:386 — useChatStreamingLifecycle.updateMessages has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (27 pts), boolean chains 3, loops 2 (3 pts), ternaries 3 (nesting depth added 16). None of this is in the body itself: all 36 points belong to 2 function literals inside it that branch (lines 393, 423). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · RunOverlay.DeliverableTab (cognitive 36) · ×1
  • RunOverlay.DeliverableTab (cognitive 36) desktop/src/components/swarm-out/RunOverlay.tsx:196 — RunOverlay.DeliverableTab has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 19, ternaries 7 (8 pts), if/else 6 (7 pts), error handling 2 (nesting depth added 2). Most of this is not in the body itself: 11 of the 36 points are its own statements and the rest belongs to 6 function items inside it that branch (openChange, a function literal at line 290, a function literal at line 301, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · LibraryTree.LibraryTree (cognitive 36) · ×1
  • LibraryTree.LibraryTree (cognitive 36) desktop/src/components/layout/LibraryTree.tsx:219 — LibraryTree.LibraryTree has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 13 (20 pts), if/else 8, boolean chains 7, error handling 1 (nesting depth added 7). Of this number, 17 points are the body's own statements and 19 belong to 8 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 · sentenceSplitter.extractSentences (cognitive 36) · ×1
  • sentenceSplitter.extractSentences (cognitive 36) desktop/src/utils/sentenceSplitter.ts:127 — sentenceSplitter.extractSentences has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (27 pts), boolean chains 4, ternaries 1 (4 pts), 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 · useUnifiedAttachments.useUnifiedAttachments.addFiles (cognitive 36) · ×1
  • useUnifiedAttachments.useUnifiedAttachments.addFiles (cognitive 36) desktop/src/hooks/useUnifiedAttachments.ts:179 — useUnifiedAttachments.useUnifiedAttachments.addFiles has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (19 pts), ternaries 3 (7 pts), error handling 2 (6 pts), boolean chains 3, loops 1 (nesting depth added 14). Of this number, 31 points are the body's own statements and 5 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 · apply.validate (cognitive 35) · ×1
  • apply.validate (cognitive 35) backend/core/brain_bootstrap/apply.py:206 — apply.validate has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 5, ternaries 3 (5 pts), loops 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 · flow_view.list_units (cognitive 35) · ×1
  • flow_view.list_units (cognitive 35) backend/core/ingestion/flow_view.py:351 — flow_view.list_units has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 11, ternaries 4 (8 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 · LifecycleManager._check_memory_pressure (cognitive 35) · ×1
  • LifecycleManager._check_memory_pressure (cognitive 35) backend/core/lifecycle_manager.py:1571 — LifecycleManager._check_memory_pressure has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 4, ternaries 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 · prompt_builder._render_ui_context_section (cognitive 35) · ×1
  • prompt_builder._render_ui_context_section (cognitive 35) REDACTED:395 — prompt_builder._render_ui_context_section has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 16, if/else 11 (15 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 · prompt_metrics.daily (cognitive 35) · ×1
  • prompt_metrics.daily (cognitive 35) backend/core/prompt_metrics.py:165 — prompt_metrics.daily has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 5 (10 pts), error handling 1 (3 pts), boolean chains 2 (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 · RunEngine._handoff_problems (cognitive 35) · ×1
  • RunEngine._handoff_problems (cognitive 35) backend/core/run_protocol/engine.py:1563 — RunEngine._handoff_problems has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (17 pts), ternaries 4 (7 pts), error handling 1 (4 pts), loops 2 (4 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 · RunEngine._normal_land (cognitive 35) · ×1
  • RunEngine._normal_land (cognitive 35) backend/core/run_protocol/engine.py:3885 — RunEngine._normal_land has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 10, ternaries 3 (5 pts), error handling 3, 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.
D2 · Cognitive Complexity · run_worktree.land (cognitive 35) · ×1
  • run_worktree.land (cognitive 35) backend/core/run_worktree.py:1045 — run_worktree.land has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 7, error handling 3, ternaries 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · security_hooks._runs_touching (cognitive 35) · ×1
  • security_hooks._runs_touching (cognitive 35) backend/core/security_hooks.py:3641 — security_hooks._runs_touching has cognitive complexity 35 (threshold 15). Drivers by points: if/else 5 (17 pts), error handling 4 (10 pts), loops 3 (6 pts), boolean chains 2 (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 · security_hooks._audit_segment_hit (cognitive 35) · ×1
  • security_hooks._audit_segment_hit (cognitive 35) backend/core/security_hooks.py:5844 — security_hooks._audit_segment_hit has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 8, ternaries 2 (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 · SQLiteDatabase._run_data_cleanups (cognitive 35) · ×1
  • SQLiteDatabase._run_data_cleanups (cognitive 35) backend/database/sqlite.py:3970 — SQLiteDatabase._run_data_cleanups has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (17 pts), error handling 5 (13 pts), loops 1 (2 pts), ternaries 1 (2 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 · ContextHealthHook._detect_stale_memory_claims (cognitive 35) · ×1
  • ContextHealthHook._detect_stale_memory_claims (cognitive 35) backend/hooks/context_health_hook.py:1205 — ContextHealthHook._detect_stale_memory_claims has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 4 (8 pts), error handling 2 (4 pts), ternaries 1 (4 pts), boolean chains 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 · system._probe_ada_details (cognitive 35) · ×1
  • system._probe_ada_details (cognitive 35) backend/routers/system.py:680 — system._probe_ada_details has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 3 (6 pts), ternaries 2 (6 pts), error handling 2 (4 pts), boolean chains 1 (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · generate_app_registry._validate_binding_sources (cognitive 35) · ×1
  • generate_app_registry._validate_binding_sources (cognitive 35) backend/scripts/generate_app_registry.py:137 — generate_app_registry._validate_binding_sources has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (27 pts), boolean chains 7, 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 · design_system.format_ascii_box (cognitive 35) · ×1
  • design_system.format_ascii_box (cognitive 35) backend/skills/s_frontend-design/scripts/design_system.py:282 — design_system.format_ascii_box has cognitive complexity 35 (threshold 15). Drivers by points: loops 10 (17 pts), if/else 15 (16 pts), boolean chains 2 (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 · ShapeData._estimate_frame_overflow (cognitive 35) · ×1
  • ShapeData._estimate_frame_overflow (cognitive 35) backend/skills/s_pptx/scripts/inventory.py:562 — ShapeData._estimate_frame_overflow has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 6, error handling 1 (3 pts), 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 · backendIssue.describeBackendIssue (cognitive 35) · ×1
  • backendIssue.describeBackendIssue (cognitive 35) desktop/src/hooks/backendIssue.ts:108 — backendIssue.describeBackendIssue has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 5 (13 pts), boolean chains 5 (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 · sessionTurnRouter.routeSubEvent (cognitive 35) · ×1
  • sessionTurnRouter.routeSubEvent (cognitive 35) desktop/src/hooks/sessionTurnRouter.ts:217 — sessionTurnRouter.routeSubEvent has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (28 pts), boolean chains 7 (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 · LiveDispatches.Fleet (cognitive 35) · ×1
  • LiveDispatches.Fleet (cognitive 35) desktop/src/components/swarm-out/LiveDispatches.tsx:100 — LiveDispatches.Fleet has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 11 (27 pts), boolean chains 8 (nesting depth added 16). Most of this is not in the body itself: 4 of the 35 points are its own statements and the rest belongs to one function literal inside it that branches (line 125). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · pipelineRows.fromHive (cognitive 35) · ×1
  • pipelineRows.fromHive (cognitive 35) desktop/src/components/layout/pipelineRows.ts:96 — pipelineRows.fromHive has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 14 (30 pts), boolean chains 4, if/else 1 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · OverlayHost.OverlayHost (cognitive 35) · ×1
  • OverlayHost.OverlayHost (cognitive 35) desktop/src/components/layout/OverlayHost.tsx:69 — OverlayHost.OverlayHost has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 9, ternaries 7 (8 pts) (nesting depth added 4). Most of this is not in the body itself: 14 of the 35 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 92, 171, 120, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · survey._guard_parts (cognitive 34) · ×1
  • survey._guard_parts (cognitive 34) backend/core/brain_bootstrap/survey.py:302 — survey._guard_parts has cognitive complexity 34 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 9, loops 6 (8 pts), ternaries 2 (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 · impact._callers (cognitive 34) · ×1
  • impact._callers (cognitive 34) backend/core/code_intel/impact.py:103 — impact._callers has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 6, loops 4 (6 pts), ternaries 2 (4 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 · context_usage._scan_transcript_usage (cognitive 34) · ×1
  • context_usage._scan_transcript_usage (cognitive 34) backend/core/context_usage.py:171 — context_usage._scan_transcript_usage has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 3 (9 pts), boolean chains 5, error handling 2 (3 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · usage._bash_paths (cognitive 34) · ×1
  • usage._bash_paths (cognitive 34) backend/core/ingestion/usage.py:292 — usage._bash_paths has cognitive complexity 34 (threshold 15). Drivers by points: if/else 3 (11 pts), ternaries 3 (10 pts), error handling 2 (5 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · leak_transcript._clean_line (cognitive 34) · ×1
  • leak_transcript._clean_line (cognitive 34) backend/core/leak_transcript.py:124 — leak_transcript._clean_line has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 7, ternaries 3 (6 pts), error handling 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 · library_health.scan_library_health (cognitive 34) · ×1
  • library_health.scan_library_health (cognitive 34) backend/core/library_health.py:102 — library_health.scan_library_health has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 4 (5 pts), boolean chains 3, ternaries 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 · security_hooks._segment_reserved (cognitive 34) · ×1
  • security_hooks._segment_reserved (cognitive 34) backend/core/security_hooks.py:726 — security_hooks._segment_reserved has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 9, ternaries 4 (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 · security_hooks._single_commit_only_paths (cognitive 34) · ×1
  • security_hooks._single_commit_only_paths (cognitive 34) backend/core/security_hooks.py:3246 — security_hooks._single_commit_only_paths has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 6, error handling 2, 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 · session_router._maybe_inject_recall_inner (cognitive 34) · ×1
  • session_router._maybe_inject_recall_inner (cognitive 34) backend/core/session_router.py:1400 — session_router._maybe_inject_recall_inner has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (12 pts), error handling 6 (9 pts), boolean chains 7, ternaries 4 (6 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · skill_migration.migrate_skill_ids_to_allowed_skills (cognitive 34) · ×1
  • skill_migration.migrate_skill_ids_to_allowed_skills (cognitive 34) backend/core/skill_migration.py:25 — skill_migration.migrate_skill_ids_to_allowed_skills has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (17 pts), error handling 7 (9 pts), loops 4 (6 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 · swarm_out_results._fetch (cognitive 34) · ×1
  • swarm_out_results._fetch (cognitive 34) backend/core/swarm_out_results.py:700 — swarm_out_results._fetch has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 5 (12 pts), boolean chains 7, error handling 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · turn_stop.build (cognitive 34) · ×1
  • turn_stop.build (cognitive 34) backend/core/turn_stop.py:103 — turn_stop.build has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 8, error handling 2 (5 pts), loops 2, 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 · HiveProvisioner.update (cognitive 34) · ×1
  • HiveProvisioner.update (cognitive 34) backend/hive/provisioner.py:1425 — HiveProvisioner.update has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (17 pts), error handling 3 (8 pts), ternaries 2 (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 · brain_mistake_audit.run_brain_mistake_audit (cognitive 34) · ×1
  • brain_mistake_audit.run_brain_mistake_audit (cognitive 34) backend/jobs/handlers/brain_mistake_audit.py:625 — brain_mistake_audit.run_brain_mistake_audit has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 9, ternaries 3 (5 pts), error handling 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 · knowledge_usage_report.scan_transcript (cognitive 34) · ×1
  • knowledge_usage_report.scan_transcript (cognitive 34) backend/scripts/knowledge_usage_report.py:80 — knowledge_usage_report.scan_transcript has cognitive complexity 34 (threshold 15). Drivers by points: if/else 6 (20 pts), loops 3 (6 pts), boolean chains 5, error handling 2 (3 pts) (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 · publish_dashboard.scan_deliver (cognitive 34) · ×1
  • publish_dashboard.scan_deliver (cognitive 34) backend/skills/s_pollinate/scripts/publish_dashboard.py:44 — publish_dashboard.scan_deliver has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 5 (19 pts), if/else 5 (11 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useChatStreamingLifecycle.useChatStreamingLifecycle.syncQueuedBadges (cognitive 34) · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle.syncQueuedBadges (cognitive 34) desktop/src/hooks/useChatStreamingLifecycle.ts:1823 — useChatStreamingLifecycle.useChatStreamingLifecycle.syncQueuedBadges has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 13, if/else 6 (11 pts), loops 6, ternaries 3 (4 pts) (nesting depth added 6). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useChatStreamingLifecycle.useChatStreamingLifecycle.beginSubscriptionTurn (cognitive 34) · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle.beginSubscriptionTurn (cognitive 34) desktop/src/hooks/useChatStreamingLifecycle.ts:4659 — useChatStreamingLifecycle.useChatStreamingLifecycle.beginSubscriptionTurn has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 8 (13 pts), if/else 10 (11 pts), boolean chains 10 (nesting depth added 6). Of this number, 25 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToDoOverlay.ToDoContent (cognitive 34) · ×1
  • ToDoOverlay.ToDoContent (cognitive 34) desktop/src/components/layout/ToDoOverlay.tsx:195 — ToDoOverlay.ToDoContent has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 10 (15 pts), boolean chains 10, if/else 7, error handling 2 (nesting depth added 5). Most of this is not in the body itself: 11 of the 34 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 287, 234, 250, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ReviewModeGutter.ReviewModeGutter (cognitive 34) · ×1
  • ReviewModeGutter.ReviewModeGutter (cognitive 34) desktop/src/components/common/ReviewModeGutter.tsx:43 — ReviewModeGutter.ReviewModeGutter has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 17 (23 pts), boolean chains 11 (nesting depth added 6). Most of this is not in the body itself: 14 of the 34 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 116, 164, 177). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · parser._c_family_declarator_name (cognitive 33) · ×1
  • parser._c_family_declarator_name (cognitive 33) backend/core/code_intel/parser.py:1596 — parser._c_family_declarator_name has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (24 pts), ternaries 1 (4 pts), loops 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 · context_injector._extract_files_touched (cognitive 33) · ×1
  • context_injector._extract_files_touched (cognitive 33) backend/core/context_injector.py:315 — context_injector._extract_files_touched has cognitive complexity 33 (threshold 15). Drivers by points: if/else 4 (17 pts), loops 3 (6 pts), ternaries 1 (6 pts), boolean chains 3, 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 · ddd_packager._scan_text (cognitive 33) · ×1
  • ddd_packager._scan_text (cognitive 33) backend/core/ddd_packager.py:254 — ddd_packager._scan_text has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 4 (8 pts), boolean chains 3 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · hive_lessons.ingest (cognitive 33) · ×1
  • hive_lessons.ingest (cognitive 33) backend/core/hive_lessons.py:142 — hive_lessons.ingest has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (16 pts), error handling 3 (6 pts), boolean chains 5, ternaries 3 (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 · hive_records.turn_projection (cognitive 33) · ×1
  • hive_records.turn_projection (cognitive 33) backend/core/hive_records.py:373 — hive_records.turn_projection has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (19 pts), ternaries 3 (6 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · hive_return.verify_revert (cognitive 33) · ×1
  • hive_return.verify_revert (cognitive 33) backend/core/hive_return.py:651 — hive_return.verify_revert has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 5, loops 3 (4 pts), ternaries 1 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · recall_multi.render_recall_body (cognitive 33) · ×1
  • recall_multi.render_recall_body (cognitive 33) backend/core/recall_multi.py:675 — recall_multi.render_recall_body has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 8, ternaries 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 · cli_commands.execute (cognitive 33) · ×1
  • cli_commands.execute (cognitive 33) backend/core/run_protocol/cli_commands.py:277 — cli_commands.execute has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (27 pts), boolean chains 4, 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 · RunEngine.execute_authorized_action (cognitive 33) · ×1
  • RunEngine.execute_authorized_action (cognitive 33) backend/core/run_protocol/engine.py:2278 — RunEngine.execute_authorized_action has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (19 pts), ternaries 3 (6 pts), boolean chains 4, error handling 3 (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 · session_utils.classify_failure (cognitive 33) · ×1
  • session_utils.classify_failure (cognitive 33) backend/core/session_utils.py:75 — session_utils.classify_failure has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 5, error handling 2 (4 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 · swarm_out_actor.row_blocker (cognitive 33) · ×1
  • swarm_out_actor.row_blocker (cognitive 33) backend/core/swarm_out_actor.py:111 — swarm_out_actor.row_blocker has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 10, ternaries 2 (4 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.
D2 · Cognitive Complexity · Bridge._valid (cognitive 33) · ×1
  • Bridge._valid (cognitive 33) REDACTED:277 — Bridge._valid has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 13, 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 · ui_actions.format_attention_for_agent (cognitive 33) · ×1
  • ui_actions.format_attention_for_agent (cognitive 33) backend/core/ui_actions.py:296 — ui_actions.format_attention_for_agent has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 4 (8 pts), ternaries 2 (3 pts), boolean chains 2, 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 · SQLiteDatabase._migrate_existing_task_data (cognitive 33) · ×1
  • SQLiteDatabase._migrate_existing_task_data (cognitive 33) backend/database/sqlite.py:4052 — SQLiteDatabase._migrate_existing_task_data has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (24 pts), error handling 2 (5 pts), ternaries 3 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · code_intel_reindex.reindex_projects (cognitive 33) · ×1
  • code_intel_reindex.reindex_projects (cognitive 33) backend/jobs/handlers/code_intel_reindex.py:61 — code_intel_reindex.reindex_projects has cognitive complexity 33 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 4 (8 pts), error handling 3 (7 pts), ternaries 2 (7 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 · session_quality.run_session_quality (cognitive 33) · ×1
  • session_quality.run_session_quality (cognitive 33) backend/jobs/handlers/session_quality.py:414 — session_quality.run_session_quality has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 10, if/else 9 (10 pts), error handling 3 (7 pts), loops 1 (3 pts), ternaries 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 · agents.update_agent (cognitive 33) · ×1
  • agents.update_agent (cognitive 33) backend/routers/agents.py:168 — agents.update_agent has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (30 pts), loops 1 (2 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 · da_resummarize.recount_commits (cognitive 33) · ×1
  • da_resummarize.recount_commits (cognitive 33) backend/scripts/da_resummarize.py:584 — da_resummarize.recount_commits has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 7, loops 4 (6 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 · scenario_runner.parse_steps (cognitive 33) · ×1
  • scenario_runner.parse_steps (cognitive 33) backend/scripts/scenario_runner.py:183 — scenario_runner.parse_steps has cognitive complexity 33 (threshold 15). Drivers by points: if/else 6 (18 pts), error handling 2 (6 pts), ternaries 2 (4 pts), loops 2 (3 pts), boolean chains 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 · extract_form_field_info.get_field_info (cognitive 33) · ×1
  • extract_form_field_info.get_field_info (cognitive 33) backend/skills/s_pdf/scripts/extract_form_field_info.py:62 — extract_form_field_info.get_field_info has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 4 (5 pts), error handling 1 (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 · rearrange.rearrange_presentation (cognitive 33) · ×1
  • rearrange.rearrange_presentation (cognitive 33) backend/skills/s_pptx/scripts/rearrange.py:149 — rearrange.rearrange_presentation has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 6 (10 pts), boolean chains 5, ternaries 1 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useLayer.useLayerFocus (cognitive 33) · ×1
  • useLayer.useLayerFocus (cognitive 33) desktop/src/hooks/useLayer.ts:46 — useLayer.useLayerFocus has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (17 pts), boolean chains 12, ternaries 2 (4 pts) (nesting depth added 3). Most of this is not in the body itself: 7 of the 33 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 77, 60, 94, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · uiCommands.dispatchUiCommand (cognitive 33) · ×1
  • uiCommands.dispatchUiCommand (cognitive 33) desktop/src/utils/uiCommands.ts:127 — uiCommands.dispatchUiCommand has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 7 (11 pts), boolean chains 6 (nesting depth added 9). Of this number, 32 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 · InlinePermissionRequest.InlinePermissionRequest (cognitive 33) · ×1
  • InlinePermissionRequest.InlinePermissionRequest (cognitive 33) desktop/src/pages/chat/components/InlinePermissionRequest.tsx:60 — InlinePermissionRequest.InlinePermissionRequest has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 7 (13 pts), boolean chains 10, if/else 10 (nesting depth added 6). Of this number, 22 points are the body's own statements and 11 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FolderPickerModal.FolderPickerModal (cognitive 33) · ×1
  • FolderPickerModal.FolderPickerModal (cognitive 33) desktop/src/components/workspace/FolderPickerModal.tsx:22 — FolderPickerModal.FolderPickerModal has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 8 (19 pts), boolean chains 7, if/else 7 (nesting depth added 11). Most of this is not in the body itself: 13 of the 33 points are its own statements and the rest belongs to 8 function items inside it that branch (getBreadcrumbParts, a function literal at line 35, handleBreadcrumbClick, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · docs.rank (cognitive 32) · ×1
  • docs.rank (cognitive 32) backend/core/brain_bootstrap/docs.py:217 — docs.rank has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 7 (10 pts), loops 5 (6 pts), boolean chains 5 (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 · interface._py_params (cognitive 32) · ×1
  • interface._py_params (cognitive 32) backend/core/code_intel/interface.py:185 — interface._py_params has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 5, ternaries 2 (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 · cognition.locate (cognitive 32) · ×1
  • cognition.locate (cognitive 32) backend/core/cognition.py:407 — cognition.locate has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 6 (12 pts), boolean chains 4, error handling 1 (2 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · context_injector._extract_git_activity (cognitive 32) · ×1
  • context_injector._extract_git_activity (cognitive 32) backend/core/context_injector.py:378 — context_injector._extract_git_activity has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (26 pts), loops 2 (3 pts), boolean chains 2, error handling 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 · hive_records._referenced (cognitive 32) · ×1
  • hive_records._referenced (cognitive 32) backend/core/hive_records.py:840 — hive_records._referenced has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 5 (12 pts), if/else 3 (10 pts), loops 3 (6 pts), boolean chains 2, error handling 1 (2 pts) (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 · usage.record_recalled_result (cognitive 32) · ×1
  • usage.record_recalled_result (cognitive 32) backend/core/ingestion/usage.py:192 — usage.record_recalled_result has cognitive complexity 32 (threshold 15). Drivers by points: if/else 5 (13 pts), ternaries 2 (8 pts), boolean chains 7, loops 2 (3 pts), 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 · checks._report_check (cognitive 32) · ×1
  • checks._report_check (cognitive 32) backend/core/run_protocol/checks.py:321 — checks._report_check has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 13, if/else 6 (9 pts), ternaries 5 (9 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 · run_worktree._sweep_branches (cognitive 32) · ×1
  • run_worktree._sweep_branches (cognitive 32) backend/core/run_worktree.py:1922 — run_worktree._sweep_branches has cognitive complexity 32 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 4 (6 pts), boolean chains 5, ternaries 1 (3 pts), error handling 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 · runtime_hooks._extract_pipeline_id (cognitive 32) · ×1
  • runtime_hooks._extract_pipeline_id (cognitive 32) backend/core/runtime_hooks.py:578 — runtime_hooks._extract_pipeline_id has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 17). 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 · SessionUnit.compact (cognitive 32) · ×1
  • SessionUnit.compact (cognitive 32) backend/core/session_unit.py:4918 — SessionUnit.compact has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (18 pts), ternaries 3 (9 pts), boolean chains 3, error handling 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 · StreamingOrchestrator._build_file_delete_events (cognitive 32) · ×1
  • StreamingOrchestrator._build_file_delete_events (cognitive 32) backend/core/streaming_orchestrator.py:839 — StreamingOrchestrator._build_file_delete_events has cognitive complexity 32 (threshold 15). Drivers by points: error handling 4 (11 pts), if/else 5 (10 pts), ternaries 4 (10 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 · worktree_write_gate._git_segments (cognitive 32) · ×1
  • worktree_write_gate._git_segments (cognitive 32) backend/core/worktree_write_gate.py:359 — worktree_write_gate._git_segments has cognitive complexity 32 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 3 (10 pts), boolean chains 6, loops 3 (5 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 · fleet.reconcile (cognitive 32) · ×1
  • fleet.reconcile (cognitive 32) backend/hive/fleet.py:307 — fleet.reconcile has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 6 (9 pts), error handling 2 (4 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 · aws_account._connect_locked (cognitive 32) · ×1
  • aws_account._connect_locked (cognitive 32) backend/routers/aws_account.py:229 — aws_account._connect_locked has cognitive complexity 32 (threshold 15). Drivers by points: error handling 6 (9 pts), ternaries 4 (9 pts), boolean chains 7, if/else 4 (7 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · eval_runner._load_rules_context (cognitive 32) · ×1
  • eval_runner._load_rules_context (cognitive 32) backend/scripts/eval_runner.py:916 — eval_runner._load_rules_context has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 3 (9 pts), boolean chains 1, error handling 1, ternaries 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · migrate_followups_to_todos.checked (cognitive 32) · ×1
  • migrate_followups_to_todos.checked (cognitive 32) backend/scripts/migrate_followups_to_todos.py:376 — migrate_followups_to_todos.checked has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 16, if/else 8 (10 pts), ternaries 4 (6 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 · Document._update_settings (cognitive 32) · ×1
  • Document._update_settings (cognitive 32) backend/skills/s_docx/scripts/document.py:988 — Document._update_settings has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (28 pts), loops 1 (3 pts), ternaries 1 (nesting depth added 17). 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 · check_bounding_boxes.get_bounding_box_messages (cognitive 32) · ×1
  • check_bounding_boxes.get_bounding_box_messages (cognitive 32) backend/skills/s_pdf/scripts/check_bounding_boxes.py:18 — check_bounding_boxes.get_bounding_box_messages has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (27 pts), loops 3 (4 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 · publish_dashboard.generate_markdown (cognitive 32) · ×1
  • publish_dashboard.generate_markdown (cognitive 32) backend/skills/s_pollinate/scripts/publish_dashboard.py:114 — publish_dashboard.generate_markdown has cognitive complexity 32 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 7 (10 pts), ternaries 4 (10 pts), boolean chains 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 · ai_ready_helpers.generate_learning_tour (cognitive 32) · ×1
  • ai_ready_helpers.generate_learning_tour (cognitive 32) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1053 — ai_ready_helpers.generate_learning_tour has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 7 (9 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 · VirtualizedTree.VirtualizedTree (cognitive 32) · ×1
  • VirtualizedTree.VirtualizedTree (cognitive 32) desktop/src/components/workspace-explorer/VirtualizedTree.tsx:697 — VirtualizedTree.VirtualizedTree has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15, ternaries 6 (7 pts), error handling 5, boolean chains 4, loops 1 (nesting depth added 1). Most of this is not in the body itself: 1 of the 32 points is its own statement and the rest belongs to 11 function literals inside it that branch (lines 935, 891, 823, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · live.workLines (cognitive 32) · ×1
  • live.workLines (cognitive 32) desktop/src/components/swarm-out/live.ts:258 — live.workLines has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 3 (9 pts), boolean chains 6, loops 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OnlineTab.OnlineTab (cognitive 32) · ×1
  • OnlineTab.OnlineTab (cognitive 32) desktop/src/pages/eval/OnlineTab.tsx:21 — OnlineTab.OnlineTab has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 13 (20 pts), boolean chains 10, if/else 2 (nesting depth added 7). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConnectAccount.DetectedRow (cognitive 32) · ×1
  • ConnectAccount.DetectedRow (cognitive 32) desktop/src/components/awsAccount/ConnectAccount.tsx:734 — ConnectAccount.DetectedRow has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 14 (26 pts), boolean chains 5, if/else 1 (nesting depth added 12). Of this number, 27 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelsTab.ChannelsTab (cognitive 32) · ×1
  • ChannelsTab.ChannelsTab (cognitive 32) desktop/src/components/settings/ChannelsTab.tsx:14 — ChannelsTab.ChannelsTab has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 14, ternaries 6 (14 pts), error handling 3, if/else 1 (nesting depth added 8). Of this number, 25 points are the body's own statements and 7 belong to 3 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · SessionTab.SessionTab (cognitive 32) · ×1
  • SessionTab.SessionTab (cognitive 32) desktop/src/pages/chat/components/SessionTab.tsx:53 — SessionTab.SessionTab has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 17, ternaries 10 (13 pts), if/else 2 (nesting depth added 3). Of this number, 29 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · attention_authority._collect_swarm_out (cognitive 31) · ×1
  • attention_authority._collect_swarm_out (cognitive 31) backend/core/attention_authority.py:781 — attention_authority._collect_swarm_out has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 4 (8 pts), boolean chains 7, error handling 2, 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.
D2 · Cognitive Complexity · _Breaks.of (cognitive 31) · ×1
  • _Breaks.of (cognitive 31) backend/core/code_intel/changed.py:485 — _Breaks.of has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 8, ternaries 4 (8 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 · worker._process_v2_candidate (cognitive 31) · ×1
  • worker._process_v2_candidate (cognitive 31) backend/core/ingestion/worker.py:345 — worker._process_v2_candidate has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 3, error handling 2 (3 pts), ternaries 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 · facts.stale_closures (cognitive 31) · ×1
  • facts.stale_closures (cognitive 31) backend/core/run_protocol/facts.py:109 — facts.stale_closures has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 7, ternaries 3 (6 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 · SQLiteDatabase._run_legacy_migrations (cognitive 31) · ×1
  • SQLiteDatabase._run_legacy_migrations (cognitive 31) backend/database/sqlite.py:3607 — SQLiteDatabase._run_legacy_migrations has cognitive complexity 31 (threshold 15). Drivers by points: if/else 23 (25 pts), error handling 3 (4 pts), loops 1, 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 · ContextHealthHook._deep_check (cognitive 31) · ×1
  • ContextHealthHook._deep_check (cognitive 31) backend/hooks/context_health_hook.py:771 — ContextHealthHook._deep_check has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (19 pts), error handling 6 (8 pts), boolean chains 2, 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 · executor._handle_agent_task (cognitive 31) · ×1
  • executor._handle_agent_task (cognitive 31) REDACTED:760 — executor._handle_agent_task has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (17 pts), error handling 4 (6 pts), boolean chains 4, ternaries 3 (4 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 · font_link_backfill.main (cognitive 31) · ×1
  • font_link_backfill.main (cognitive 31) backend/skills/s_pollinate/scripts/font_link_backfill.py:94 — font_link_backfill.main has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 5 (6 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 · publish_dashboard.generate_html (cognitive 31) · ×1
  • publish_dashboard.generate_html (cognitive 31) backend/skills/s_pollinate/scripts/publish_dashboard.py:194 — publish_dashboard.generate_html has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 5 (6 pts), boolean chains 3, error handling 1 (3 pts), ternaries 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 · compaction.applyCompactionEvent (cognitive 31) · ×1
  • compaction.applyCompactionEvent (cognitive 31) desktop/src/pages/chat/compaction.ts:115 — compaction.applyCompactionEvent has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 5, loops 2 (3 pts), ternaries 3 (nesting depth added 8). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnZones.stopSummary (cognitive 31) · ×1
  • TurnZones.stopSummary (cognitive 31) desktop/src/pages/chat/components/TurnZones.tsx:425 — TurnZones.stopSummary has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 6 (10 pts), loops 4 (6 pts), boolean chains 3 (nesting depth added 8). Of this number, 28 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 · CdfUnitFeed.Trace (cognitive 31) · ×1
  • CdfUnitFeed.Trace (cognitive 31) desktop/src/components/layout/CdfUnitFeed.tsx:200 — CdfUnitFeed.Trace has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 9 (13 pts), boolean chains 10, if/else 8 (nesting depth added 4). Of this number, 29 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 · PipelineOverlay.PipelineContent (cognitive 31) · ×1
  • PipelineOverlay.PipelineContent (cognitive 31) desktop/src/components/layout/PipelineOverlay.tsx:126 — PipelineOverlay.PipelineContent has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 10 (14 pts), boolean chains 13, if/else 4 (nesting depth added 4). Of this number, 22 points are the body's own statements and 9 belong to 11 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 · app_profiles.account_profiles (cognitive 30) · ×1
  • app_profiles.account_profiles (cognitive 30) backend/core/app_profiles.py:96 — app_profiles.account_profiles has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 3 (10 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · receivers.value_reference (cognitive 30) · ×1
  • receivers.value_reference (cognitive 30) backend/core/code_intel/receivers.py:1099 — receivers.value_reference has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 8 (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 · knowledge_store.chunk_markdown (cognitive 30) · ×1
  • knowledge_store.chunk_markdown (cognitive 30) backend/core/knowledge_store.py:105 — knowledge_store.chunk_markdown has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (5 pts), ternaries 2 (5 pts), boolean chains 4 (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 · mcp_config_loader.add_mcp_server_to_dict (cognitive 30) · ×1
  • mcp_config_loader.add_mcp_server_to_dict (cognitive 30) backend/core/mcp_config_loader.py:303 — mcp_config_loader.add_mcp_server_to_dict has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 4 (7 pts), boolean chains 5 (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 · PluginManager.list_cached_plugins (cognitive 30) · ×1
  • PluginManager.list_cached_plugins (cognitive 30) backend/core/plugin_manager.py:954 — PluginManager.list_cached_plugins has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (18 pts), error handling 1 (5 pts), loops 4 (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 · recall_multi.recall_ddd (cognitive 30) · ×1
  • recall_multi.recall_ddd (cognitive 30) backend/core/recall_multi.py:1206 — recall_multi.recall_ddd has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3 (5 pts), ternaries 2 (3 pts), boolean chains 2, 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 · recall_multi.detect_active_project (cognitive 30) · ×1
  • recall_multi.detect_active_project (cognitive 30) backend/core/recall_multi.py:1400 — recall_multi.detect_active_project has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 1 (3 pts), ternaries 1 (3 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 · RunEngine.review_address (cognitive 30) · ×1
  • RunEngine.review_address (cognitive 30) backend/core/run_protocol/engine.py:1334 — RunEngine.review_address has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 6, loops 4 (5 pts), error handling 1, 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 · ReviewOrchestrator.render_review (cognitive 30) · ×1
  • ReviewOrchestrator.render_review (cognitive 30) backend/core/run_protocol/review.py:1000 — ReviewOrchestrator.render_review has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 8 (14 pts), boolean chains 8, if/else 4 (5 pts), 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 · run_worktree.own_isolated_run (cognitive 30) · ×1
  • run_worktree.own_isolated_run (cognitive 30) backend/core/run_worktree.py:1590 — run_worktree.own_isolated_run has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 7, error handling 2 (6 pts), loops 2 (3 pts), 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.
D2 · Cognitive Complexity · security_hooks._sudo_session_link (cognitive 30) · ×1
  • security_hooks._sudo_session_link (cognitive 30) backend/core/security_hooks.py:4652 — security_hooks._sudo_session_link has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SkillManager._scan_tier (cognitive 30) · ×1
  • SkillManager._scan_tier (cognitive 30) backend/core/skill_manager.py:772 — SkillManager._scan_tier has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (18 pts), error handling 6 (10 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 · turn_stop.continuation_note (cognitive 30) · ×1
  • turn_stop.continuation_note (cognitive 30) backend/core/turn_stop.py:174 — turn_stop.continuation_note has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 3 (8 pts), boolean chains 7, 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 · cleanup_message_history.main (cognitive 30) · ×1
  • cleanup_message_history.main (cognitive 30) backend/scripts/cleanup_message_history.py:107 — cleanup_message_history.main has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 4 (9 pts), boolean chains 6, 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 · da_resummarize.rebuild_day (cognitive 30) · ×1
  • da_resummarize.rebuild_day (cognitive 30) backend/scripts/da_resummarize.py:357 — da_resummarize.rebuild_day has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 3 (5 pts), boolean chains 3, error handling 1 (3 pts), ternaries 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · eval_runner.eval_trajectory (cognitive 30) · ×1
  • eval_runner.eval_trajectory (cognitive 30) backend/scripts/eval_runner.py:525 — eval_runner.eval_trajectory has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 4 (9 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 · format_recommend.recommend (cognitive 30) · ×1
  • format_recommend.recommend (cognitive 30) backend/skills/s_pollinate/scripts/format_recommend.py:158 — format_recommend.recommend has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 3 (5 pts), boolean chains 3, 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 · generate_tts.main (cognitive 30) · ×1
  • generate_tts.main (cognitive 30) backend/skills/s_pollinate/scripts/generate_tts.py:109 — generate_tts.main has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (20 pts), loops 3 (5 pts), ternaries 1 (3 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 · publish_meta.generate_publish_info (cognitive 30) · ×1
  • publish_meta.generate_publish_info (cognitive 30) backend/skills/s_pollinate/scripts/publish_meta.py:150 — publish_meta.generate_publish_info has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (5 pts), boolean chains 3, ternaries 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 · ai_ready_helpers.run_multi_package (cognitive 30) · ×1
  • ai_ready_helpers.run_multi_package (cognitive 30) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1139 — ai_ready_helpers.run_multi_package has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 6 (11 pts), boolean chains 2, error handling 1 (2 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 · ExplorerToolbar.ExplorerToolbar (cognitive 30) · ×1
  • ExplorerToolbar.ExplorerToolbar (cognitive 30) desktop/src/components/workspace-explorer/ExplorerToolbar.tsx:36 — ExplorerToolbar.ExplorerToolbar has cognitive complexity 30 (threshold 15). Drivers by points: if/else 17, ternaries 5 (7 pts), boolean chains 4, error handling 2 (nesting depth added 2). Most of this is not in the body itself: 6 of the 30 points are its own statements and the rest belongs to 9 function items inside it that branch (handleUpload, handleConfirm, validateName, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · streaming-machine.streamingReducer (cognitive 30) · ×1
  • streaming-machine.streamingReducer (cognitive 30) desktop/src/hooks/streaming-machine.ts:105 — streaming-machine.streamingReducer has cognitive complexity 30 (threshold 15). Drivers by points: match/switch 11 (21 pts), if/else 2 (6 pts), ternaries 1 (3 pts) (nesting depth added 16). 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 · useChatStreamingLifecycle.useChatStreamingLifecycle.surfacePendingPermission (cognitive 30) · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle.surfacePendingPermission (cognitive 30) desktop/src/hooks/useChatStreamingLifecycle.ts:2196 — useChatStreamingLifecycle.useChatStreamingLifecycle.surfacePendingPermission has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 5 (8 pts), boolean chains 5 (nesting depth added 8). Of this number, 23 points are the body's own statements and 7 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 · live.tallyRuns (cognitive 30) · ×1
  • live.tallyRuns (cognitive 30) desktop/src/components/swarm-out/live.ts:573 — live.tallyRuns has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 4, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useVoiceConversation.useVoiceConversation (cognitive 30) · ×1
  • useVoiceConversation.useVoiceConversation (cognitive 30) desktop/src/hooks/useVoiceConversation.ts:75 — useVoiceConversation.useVoiceConversation has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (17 pts), boolean chains 11, loops 1 (2 pts) (nesting depth added 2). None of this is in the body itself: all 30 points belong to 8 function literals inside it that branch (lines 179, 264, 149, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · decks.deck_detail (cognitive 29) · ×1
  • decks.deck_detail (cognitive 29) backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/decks.py:429 — decks.deck_detail has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 5 (7 pts), loops 3 (4 pts), error handling 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 · interface._self_attrs (cognitive 29) · ×1
  • interface._self_attrs (cognitive 29) backend/core/code_intel/interface.py:541 — interface._self_attrs has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 4 (8 pts), loops 2 (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 · FileTypes._java_value (cognitive 29) · ×1
  • FileTypes._java_value (cognitive 29) backend/core/code_intel/receivers.py:588 — FileTypes._java_value has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (22 pts), ternaries 2 (5 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 · eval_followups._online (cognitive 29) · ×1
  • eval_followups._online (cognitive 29) backend/core/eval_followups.py:281 — eval_followups._online has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 8, ternaries 5 (7 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 · eval_release.decide_release (cognitive 29) · ×1
  • eval_release.decide_release (cognitive 29) backend/core/eval_release.py:120 — eval_release.decide_release has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 9, ternaries 3 (8 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 · hive_workspace._ensure_mirror_from (cognitive 29) · ×1
  • hive_workspace._ensure_mirror_from (cognitive 29) backend/core/hive_workspace.py:265 — hive_workspace._ensure_mirror_from has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (19 pts), ternaries 3 (7 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 · overrides.check_session_own (cognitive 29) · ×1
  • overrides.check_session_own (cognitive 29) backend/core/ingestion/overrides.py:313 — overrides.check_session_own has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 5, 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 · overrides._apply (cognitive 29) · ×1
  • overrides._apply (cognitive 29) backend/core/ingestion/overrides.py:397 — overrides._apply has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 5 (9 pts), error handling 3 (8 pts), boolean chains 6, if/else 1 (3 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 · worker._defer_or_poison (cognitive 29) · ×1
  • worker._defer_or_poison (cognitive 29) backend/core/ingestion/worker.py:145 — worker._defer_or_poison has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 6 (9 pts), boolean chains 7 (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 · needs_human_review.needs_human_review_batch (cognitive 29) · ×1
  • needs_human_review.needs_human_review_batch (cognitive 29) backend/core/needs_human_review.py:495 — needs_human_review.needs_human_review_batch has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (19 pts), error handling 3 (5 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · project_agent.validate (cognitive 29) · ×1
  • project_agent.validate (cognitive 29) backend/core/project_agent.py:294 — project_agent.validate has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 6, 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 · project_agent_draft._default_commands (cognitive 29) · ×1
  • project_agent_draft._default_commands (cognitive 29) backend/core/project_agent_draft.py:407 — project_agent_draft._default_commands has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 4, 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 · hook_bridge._repo_paths (cognitive 29) · ×1
  • hook_bridge._repo_paths (cognitive 29) backend/core/run_protocol/hook_bridge.py:231 — hook_bridge._repo_paths has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 4, loops 3 (4 pts), error handling 2 (3 pts), 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 · review.r2_ledger (cognitive 29) · ×1
  • review.r2_ledger (cognitive 29) backend/core/run_protocol/review.py:40 — review.r2_ledger has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 10, loops 3 (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 · runtime_hooks._handout_attribution (cognitive 29) · ×1
  • runtime_hooks._handout_attribution (cognitive 29) backend/core/runtime_hooks.py:1015 — runtime_hooks._handout_attribution has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 7, error handling 1 (2 pts), 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 · security_hooks.v1_land_card (cognitive 29) · ×1
  • security_hooks.v1_land_card (cognitive 29) backend/core/security_hooks.py:467 — security_hooks.v1_land_card has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 8, loops 2 (4 pts), error handling 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · session_health_probe.session_health_probe (cognitive 29) · ×1
  • session_health_probe.session_health_probe (cognitive 29) backend/core/session_health_probe.py:197 — session_health_probe.session_health_probe has cognitive complexity 29 (threshold 15). Drivers by points: error handling 6 (8 pts), if/else 6 (8 pts), boolean chains 7, ternaries 4 (5 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 · swarm_out_results.public (cognitive 29) · ×1
  • swarm_out_results.public (cognitive 29) backend/core/swarm_out_results.py:1234 — swarm_out_results.public has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 8 (10 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 · swarm_run.child_report (cognitive 29) · ×1
  • swarm_run.child_report (cognitive 29) backend/core/swarm_run.py:306 — swarm_run.child_report has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (8 pts), ternaries 3 (6 pts), error handling 2 (3 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 · SwarmWorkspaceManager._seed_hive_from_package (cognitive 29) · ×1
  • SwarmWorkspaceManager._seed_hive_from_package (cognitive 29) backend/core/swarm_workspace_manager.py:1267 — SwarmWorkspaceManager._seed_hive_from_package has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · turn_changes._group (cognitive 29) · ×1
  • turn_changes._group (cognitive 29) backend/core/turn_changes.py:549 — turn_changes._group has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (17 pts), ternaries 2 (5 pts), loops 4, 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 · bedrock._validate (cognitive 29) · ×1
  • bedrock._validate (cognitive 29) backend/jobs/bedrock.py:605 — bedrock._validate has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 8, ternaries 4 (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 · brain_mistake_audit._candidates (cognitive 29) · ×1
  • brain_mistake_audit._candidates (cognitive 29) backend/jobs/handlers/brain_mistake_audit.py:199 — brain_mistake_audit._candidates has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 5 (7 pts), error handling 2 (5 pts), ternaries 3 (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 · job_manager.cmd_edit (cognitive 29) · ×1
  • job_manager.cmd_edit (cognitive 29) backend/jobs/job_manager.py:209 — job_manager.cmd_edit has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 2 (4 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 · chat.get_session_messages (cognitive 29) · ×1
  • chat.get_session_messages (cognitive 29) backend/routers/chat.py:1185 — chat.get_session_messages has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 4 (7 pts), boolean chains 6, error handling 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 · artifact_cli.cmd_release_gate (cognitive 29) · ×1
  • artifact_cli.cmd_release_gate (cognitive 29) backend/scripts/artifact_cli.py:178 — artifact_cli.cmd_release_gate has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 4 (7 pts), error handling 4 (6 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 · cdf_batch_eval._failures (cognitive 29) · ×1
  • cdf_batch_eval._failures (cognitive 29) backend/scripts/cdf_batch_eval.py:424 — cdf_batch_eval._failures has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 4 (6 pts), boolean chains 5, ternaries 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 · recall_replay._tool_events (cognitive 29) · ×1
  • recall_replay._tool_events (cognitive 29) backend/scripts/recall_replay.py:153 — recall_replay._tool_events has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 3 (10 pts), if/else 3 (9 pts), boolean chains 5, loops 2 (3 pts), error handling 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 · distribute.main (cognitive 29) · ×1
  • distribute.main (cognitive 29) backend/skills/s_ddd-distribute/scripts/distribute.py:53 — distribute.main has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 4 (9 pts), loops 4 (6 pts), 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 · ai_ready_helpers.render_agents_md (cognitive 29) · ×1
  • ai_ready_helpers.render_agents_md (cognitive 29) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:463 — ai_ready_helpers.render_agents_md has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 5 (9 pts), ternaries 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SlidePreview.SlidePreview (cognitive 29) · ×1
  • SlidePreview.SlidePreview (cognitive 29) REDACTED:274 — SlidePreview.SlidePreview has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 13, if/else 10 (11 pts), loops 1 (2 pts), ternaries 1 (2 pts), error handling 1 (nesting depth added 3). Most of this is not in the body itself: 1 of the 29 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 296, 366, 284, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ChangesCard.ChangeRow (cognitive 29) · ×1
  • ChangesCard.ChangeRow (cognitive 29) desktop/src/pages/chat/components/ChangesCard.tsx:84 — ChangesCard.ChangeRow has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 8 (13 pts), boolean chains 11, if/else 5 (nesting depth added 5). Of this number, 16 points are the body's own statements and 13 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · turnControls.sendWhileBusy (cognitive 29) · ×1
  • turnControls.sendWhileBusy (cognitive 29) desktop/src/pages/chat/turnControls.ts:113 — turnControls.sendWhileBusy has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 9, error handling 1, ternaries 1 (nesting depth added 3). Most of this is not in the body itself: 14 of the 29 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 182, settle, a function literal at line 118, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · _Breaks.new_calls (cognitive 28) · ×1
  • _Breaks.new_calls (cognitive 28) backend/core/code_intel/changed.py:535 — _Breaks.new_calls has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 4 (7 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · parser._build_file_scope_regex (cognitive 28) · ×1
  • parser._build_file_scope_regex (cognitive 28) backend/core/code_intel/parser.py:966 — parser._build_file_scope_regex has cognitive complexity 28 (threshold 15). Drivers by points: loops 7 (13 pts), if/else 5 (8 pts), ternaries 2 (7 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 · cognition.find (cognitive 28) · ×1
  • cognition.find (cognitive 28) backend/core/cognition.py:310 — cognition.find has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 5 (13 pts), boolean chains 7, if/else 2 (4 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 · hook_builder.build_hooks (cognitive 28) · ×1
  • hook_builder.build_hooks (cognitive 28) backend/core/hook_builder.py:309 — hook_builder.build_hooks has cognitive complexity 28 (threshold 15). Drivers by points: if/else 19 (20 pts), error handling 2 (4 pts), boolean chains 3, 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 · cognition_level.series (cognitive 28) · ×1
  • cognition_level.series (cognitive 28) backend/core/ingestion/cognition_level.py:369 — cognition_level.series has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 3 (5 pts), ternaries 2 (4 pts), boolean chains 3 (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 · flow_view.landed_overview (cognitive 28) · ×1
  • flow_view.landed_overview (cognitive 28) backend/core/ingestion/flow_view.py:201 — flow_view.landed_overview has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 6, loops 5, ternaries 3 (4 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 · queries.item_detail (cognitive 28) · ×1
  • queries.item_detail (cognitive 28) backend/core/ingestion/queries.py:255 — queries.item_detail has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 4 (8 pts), boolean chains 7, loops 5 (7 pts), if/else 4 (6 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · s7_review.review_session (cognitive 28) · ×1
  • s7_review.review_session (cognitive 28) backend/core/ingestion/sources/s7_review.py:927 — s7_review.review_session has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 4 (6 pts), boolean chains 5, ternaries 2 (4 pts), 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 · usage._observe_tool_read (cognitive 28) · ×1
  • usage._observe_tool_read (cognitive 28) backend/core/ingestion/usage.py:248 — usage._observe_tool_read has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 4 (12 pts), boolean chains 7, if/else 4 (7 pts), loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LifecycleManager._get_mcp_server_patterns (cognitive 28) · ×1
  • LifecycleManager._get_mcp_server_patterns (cognitive 28) backend/core/lifecycle_manager.py:1991 — LifecycleManager._get_mcp_server_patterns has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (4 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 · north_star._cdf (cognitive 28) · ×1
  • north_star._cdf (cognitive 28) backend/core/north_star.py:105 — north_star._cdf has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 13, loops 5 (7 pts), if/else 5, ternaries 3 (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 · output_degeneration.find_degenerate_run (cognitive 28) · ×1
  • output_degeneration.find_degenerate_run (cognitive 28) backend/core/output_degeneration.py:188 — output_degeneration.find_degenerate_run has cognitive complexity 28 (threshold 15). Drivers by points: loops 5 (13 pts), if/else 5 (9 pts), boolean chains 6 (nesting depth added 12). 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 · recall_filter._omitted_rows (cognitive 28) · ×1
  • recall_filter._omitted_rows (cognitive 28) backend/core/recall_filter.py:574 — recall_filter._omitted_rows has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 4 (11 pts), if/else 4 (7 pts), boolean chains 6, loops 3 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · lifecycle._failed_stage (cognitive 28) · ×1
  • lifecycle._failed_stage (cognitive 28) backend/core/run_protocol/lifecycle.py:325 — lifecycle._failed_stage has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 7, ternaries 1 (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 · lifecycle._authorization (cognitive 28) · ×1
  • lifecycle._authorization (cognitive 28) backend/core/run_protocol/lifecycle.py:699 — lifecycle._authorization has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 6, ternaries 2 (5 pts), error handling 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 · SessionRouter._acquire_chat_slot (cognitive 28) · ×1
  • SessionRouter._acquire_chat_slot (cognitive 28) backend/core/session_router.py:3192 — SessionRouter._acquire_chat_slot has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 3, error handling 1 (2 pts), 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 · SessionUnit.begin_stop_receipt (cognitive 28) · ×1
  • SessionUnit.begin_stop_receipt (cognitive 28) backend/core/session_unit.py:4408 — SessionUnit.begin_stop_receipt has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 6 (7 pts), boolean chains 6, loops 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 · swarm_out._compute_runs (cognitive 28) · ×1
  • swarm_out._compute_runs (cognitive 28) backend/core/swarm_out.py:1801 — swarm_out._compute_runs has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (11 pts), loops 5 (6 pts), ternaries 2 (5 pts), error handling 4, 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 · tool_summarizer.summarize_tool_result (cognitive 28) · ×1
  • tool_summarizer.summarize_tool_result (cognitive 28) backend/core/tool_summarizer.py:589 — tool_summarizer.summarize_tool_result has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 7, ternaries 2 (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 · ContextHealthHook._check_governance_budgets (cognitive 28) · ×1
  • ContextHealthHook._check_governance_budgets (cognitive 28) backend/hooks/context_health_hook.py:1530 — ContextHealthHook._check_governance_budgets has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (18 pts), error handling 3 (6 pts), boolean chains 2, loops 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 · daily_activity_hook._subjects_in (cognitive 28) · ×1
  • daily_activity_hook._subjects_in (cognitive 28) backend/hooks/daily_activity_hook.py:112 — daily_activity_hook._subjects_in has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 4 (14 pts), if/else 5 (10 pts), boolean chains 3, 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 · brain_mistake_audit._open_conflicts (cognitive 28) · ×1
  • brain_mistake_audit._open_conflicts (cognitive 28) backend/jobs/handlers/brain_mistake_audit.py:456 — brain_mistake_audit._open_conflicts has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 11, if/else 4 (10 pts), loops 2 (3 pts), error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · artifact_cli._bind_into_workspace (cognitive 28) · ×1
  • artifact_cli._bind_into_workspace (cognitive 28) backend/scripts/artifact_cli.py:403 — artifact_cli._bind_into_workspace has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 6 (9 pts), boolean chains 7, error handling 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · autonomous_rate.compute_autonomous_rate (cognitive 28) · ×1
  • autonomous_rate.compute_autonomous_rate (cognitive 28) backend/scripts/autonomous_rate.py:83 — autonomous_rate.compute_autonomous_rate has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 3, loops 2 (3 pts), error handling 1 (2 pts), ternaries 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 · migrate_followups_to_todos.run (cognitive 28) · ×1
  • migrate_followups_to_todos.run (cognitive 28) backend/scripts/migrate_followups_to_todos.py:554 — migrate_followups_to_todos.run has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 3 (7 pts), boolean chains 5, ternaries 2 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · migrate_skills.migrate_skill (cognitive 28) · ×1
  • migrate_skills.migrate_skill (cognitive 28) backend/scripts/migrate_skills.py:400 — migrate_skills.migrate_skill has cognitive complexity 28 (threshold 15). Drivers by points: if/else 19 (25 pts), boolean chains 1, error handling 1, ternaries 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 · scan.main (cognitive 28) · ×1
  • scan.main (cognitive 28) backend/skills/s_context-hygiene/scripts/scan.py:213 — scan.main has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 4 (9 pts), boolean chains 1, ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DocxXMLEditor.revert_deletion (cognitive 28) · ×1
  • DocxXMLEditor.revert_deletion (cognitive 28) backend/skills/s_docx/scripts/document.py:342 — DocxXMLEditor.revert_deletion has cognitive complexity 28 (threshold 15). Drivers by points: loops 5 (14 pts), if/else 8 (12 pts), boolean chains 2 (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 · SelfLoopsHealthEngine._find_stale_pipelines (cognitive 28) · ×1
  • SelfLoopsHealthEngine._find_stale_pipelines (cognitive 28) backend/skills/s_loops-health/scripts/loops_health_check.py:612 — SelfLoopsHealthEngine._find_stale_pipelines has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 3 (6 pts), error handling 1 (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 · turnView.isReadOnlySegment (cognitive 28) · ×1
  • turnView.isReadOnlySegment (cognitive 28) REDACTED:814 — turnView.isReadOnlySegment has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 13, 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 · AttachmentPreviewCard.AttachmentPreviewCard (cognitive 28) · ×1
  • AttachmentPreviewCard.AttachmentPreviewCard (cognitive 28) desktop/src/components/chat/AttachmentPreviewCard.tsx:40 — AttachmentPreviewCard.AttachmentPreviewCard has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 9 (22 pts), boolean chains 5, if/else 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · PollinateOverlay.PollinateContent (cognitive 28) · ×1
  • PollinateOverlay.PollinateContent (cognitive 28) desktop/src/components/layout/PollinateOverlay.tsx:114 — PollinateOverlay.PollinateContent has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 12, if/else 10, ternaries 5 (6 pts) (nesting depth added 1). Most of this is not in the body itself: 11 of the 28 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 165, 145, 210, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · CasesTab.CasesTab (cognitive 28) · ×1
  • CasesTab.CasesTab (cognitive 28) desktop/src/pages/eval/CasesTab.tsx:39 — CasesTab.CasesTab has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 10 (14 pts), boolean chains 10, if/else 4 (nesting depth added 4). Of this number, 22 points are the body's own statements and 6 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 · SlackChannelAdapter._ws_health_monitor (cognitive 27) · ×1
  • SlackChannelAdapter._ws_health_monitor (cognitive 27) REDACTED:1671 — SlackChannelAdapter._ws_health_monitor has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (18 pts), error handling 1 (5 pts), boolean chains 3, 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 · addressing._sections (cognitive 27) · ×1
  • addressing._sections (cognitive 27) backend/core/addressing.py:267 — addressing._sections has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 4 (11 pts), if/else 4 (7 pts), boolean chains 5, loops 3 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · aws_permissions.run_hive_checks (cognitive 27) · ×1
  • aws_permissions.run_hive_checks (cognitive 27) backend/core/aws_permissions.py:277 — aws_permissions.run_hive_checks has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 5 (9 pts), boolean chains 2, error handling 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 · commands._github_actions (cognitive 27) · ×1
  • commands._github_actions (cognitive 27) backend/core/brain_bootstrap/commands.py:48 — commands._github_actions has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 5 (12 pts), if/else 2 (7 pts), boolean chains 5, 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 · canvas_surface.is_canvas_surfaceable (cognitive 27) · ×1
  • canvas_surface.is_canvas_surfaceable (cognitive 27) backend/core/canvas_surface.py:111 — canvas_surface.is_canvas_surfaceable has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 6, error handling 2, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · GraphStore.incremental_update (cognitive 27) · ×1
  • GraphStore.incremental_update (cognitive 27) backend/core/code_intel/graph_store.py:1638 — GraphStore.incremental_update has cognitive complexity 27 (threshold 15). Drivers by points: error handling 5 (11 pts), if/else 7 (11 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 · interface._code_hash (cognitive 27) · ×1
  • interface._code_hash (cognitive 27) backend/core/code_intel/interface.py:155 — interface._code_hash has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 7, ternaries 1 (4 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 · local_roots.hive_task_clones (cognitive 27) · ×1
  • local_roots.hive_task_clones (cognitive 27) backend/core/code_intel/local_roots.py:472 — local_roots.hive_task_clones has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 4 (7 pts), boolean chains 5, 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 · parser._get_name (cognitive 27) · ×1
  • parser._get_name (cognitive 27) backend/core/code_intel/parser.py:1642 — parser._get_name has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 4, 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 · CompactionGuard.check (cognitive 27) · ×1
  • CompactionGuard.check (cognitive 27) backend/core/compaction_guard.py:621 — CompactionGuard.check has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 3 (10 pts), 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 · history_page.page_by_turns (cognitive 27) · ×1
  • history_page.page_by_turns (cognitive 27) backend/core/history_page.py:35 — history_page.page_by_turns has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 5, loops 2, 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 · hive_files.deliverable_paths (cognitive 27) · ×1
  • hive_files.deliverable_paths (cognitive 27) backend/core/hive_files.py:68 — hive_files.deliverable_paths has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 4 (11 pts), if/else 2 (7 pts), loops 3 (6 pts), boolean chains 3 (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 · knowledge_cli._find_stores (cognitive 27) · ×1
  • knowledge_cli._find_stores (cognitive 27) backend/core/knowledge_cli.py:262 — knowledge_cli._find_stores has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 5, ternaries 3 (5 pts), 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 · PluginManager._parse_marketplace_json_with_name (cognitive 27) · ×1
  • PluginManager._parse_marketplace_json_with_name (cognitive 27) backend/core/plugin_manager.py:250 — PluginManager._parse_marketplace_json_with_name has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (21 pts), boolean chains 4, error handling 1, 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 · run_owner_gate._token_binding (cognitive 27) · ×1
  • run_owner_gate._token_binding (cognitive 27) backend/core/run_owner_gate.py:179 — run_owner_gate._token_binding has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 3 (10 pts), loops 2 (3 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 · RunEngine._read_model (cognitive 27) · ×1
  • RunEngine._read_model (cognitive 27) backend/core/run_protocol/engine.py:1073 — RunEngine._read_model has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 8, 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 · RunEngine._landed_as_check (cognitive 27) · ×1
  • RunEngine._landed_as_check (cognitive 27) backend/core/run_protocol/engine.py:1976 — RunEngine._landed_as_check has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 8, error handling 1 (2 pts), loops 2, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · findings._proof (cognitive 27) · ×1
  • findings._proof (cognitive 27) backend/core/run_protocol/findings.py:229 — findings._proof has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 10 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · swarm_out_settle._actions (cognitive 27) · ×1
  • swarm_out_settle._actions (cognitive 27) backend/core/swarm_out_settle.py:404 — swarm_out_settle._actions has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 6 (12 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · swarm_out_settle.annotate (cognitive 27) · ×1
  • swarm_out_settle.annotate (cognitive 27) backend/core/swarm_out_settle.py:693 — swarm_out_settle.annotate has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 7, ternaries 1 (3 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · transcript_usage._scan (cognitive 27) · ×1
  • transcript_usage._scan (cognitive 27) backend/core/transcript_usage.py:92 — transcript_usage._scan has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 3 (6 pts), boolean chains 5, error handling 2 (3 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ContextHealthHook._enforce_retention_policies (cognitive 27) · ×1
  • ContextHealthHook._enforce_retention_policies (cognitive 27) backend/hooks/context_health_hook.py:1649 — ContextHealthHook._enforce_retention_policies has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 2 (6 pts), loops 2 (4 pts), ternaries 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 · log_patrol.run_log_patrol (cognitive 27) · ×1
  • log_patrol.run_log_patrol (cognitive 27) backend/jobs/handlers/log_patrol.py:56 — log_patrol.run_log_patrol has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 4 (7 pts), error handling 4 (6 pts), ternaries 3 (4 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · scheduler.load_user_context (cognitive 27) · ×1
  • scheduler.load_user_context (cognitive 27) backend/jobs/scheduler.py:252 — scheduler.load_user_context has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (16 pts), error handling 3 (5 pts), ternaries 2 (4 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 · swarm_out.main (cognitive 27) · ×1
  • swarm_out.main (cognitive 27) backend/scripts/swarm_out.py:422 — swarm_out.main has cognitive complexity 27 (threshold 15). Drivers by points: if/else 19 (22 pts), error handling 1 (3 pts), ternaries 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, 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 · design_system.format_page_override_md (cognitive 27) · ×1
  • design_system.format_page_override_md (cognitive 27) backend/skills/s_frontend-design/scripts/design_system.py:886 — design_system.format_page_override_md has cognitive complexity 27 (threshold 15). Drivers by points: loops 7 (14 pts), if/else 13 (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 · SelfLoopsHealthEngine._check_infrastructure (cognitive 27) · ×1
  • SelfLoopsHealthEngine._check_infrastructure (cognitive 27) backend/skills/s_loops-health/scripts/loops_health_check.py:529 — SelfLoopsHealthEngine._check_infrastructure has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 12 (16 pts), if/else 7 (9 pts), boolean chains 1, loops 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 · useChatStreamingLifecycle.useChatStreamingLifecycle.surfacePendingQuestion (cognitive 27) · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle.surfacePendingQuestion (cognitive 27) desktop/src/hooks/useChatStreamingLifecycle.ts:2091 — useChatStreamingLifecycle.useChatStreamingLifecycle.surfacePendingQuestion has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 5 (nesting depth added 8). Of this number, 23 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoryView.HistoryView (cognitive 27) · ×1
  • HistoryView.HistoryView (cognitive 27) desktop/src/pages/chat/components/RightSidebar/HistoryView.tsx:34 — HistoryView.HistoryView has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 9 (17 pts), boolean chains 6, if/else 4 (nesting depth added 8). Of this number, 17 points are the body's own statements and 10 belong to 5 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 · TurnZones.useSettled (cognitive 27) · ×1
  • TurnZones.useSettled (cognitive 27) desktop/src/pages/chat/components/TurnZones.tsx:160 — TurnZones.useSettled has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 2 (5 pts), boolean chains 4, ternaries 1 (nesting depth added 10). Of this number, 24 points are the body's own statements and 3 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 · hiveComponents.InstanceCard (cognitive 27) · ×1
  • hiveComponents.InstanceCard (cognitive 27) REDACTED:164 — hiveComponents.InstanceCard has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 21, ternaries 3 (4 pts), error handling 1, if/else 1 (nesting depth added 1). Of this number, 24 points are the body's own statements and 3 belong to 6 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · hiveComponents.AuthDisplay (cognitive 27) · ×1
  • hiveComponents.AuthDisplay (cognitive 27) REDACTED:341 — hiveComponents.AuthDisplay has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 8 (11 pts), if/else 8, error handling 3 (6 pts), boolean chains 2 (nesting depth added 6). Most of this is not in the body itself: 13 of the 27 points are its own statements and the rest belongs to 5 function items inside it that branch (togglePass, handleCopyPassword, handleShare, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · OverviewTab.releaseLede (cognitive 27) · ×1
  • OverviewTab.releaseLede (cognitive 27) desktop/src/pages/eval/OverviewTab.tsx:108 — OverviewTab.releaseLede has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 9 (17 pts), if/else 6, boolean chains 4 (nesting depth added 8). Of this number, 26 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 · FilePreviewModal.FilePreviewModal (cognitive 27) · ×1
  • FilePreviewModal.FilePreviewModal (cognitive 27) desktop/src/components/workspace/FilePreviewModal.tsx:50 — FilePreviewModal.FilePreviewModal has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11, boolean chains 8, ternaries 5 (6 pts), error handling 1 (2 pts) (nesting depth added 2). Most of this is not in the body itself: 6 of the 27 points are its own statements and the rest belongs to 2 function items inside it that branch (renderContent, a function literal at line 82). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · addressing.matches (cognitive 26) · ×1
  • addressing.matches (cognitive 26) backend/core/addressing.py:456 — addressing.matches has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4, ternaries 2 (4 pts), error handling 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 · app_provenance.load_verified_provenance (cognitive 26) · ×1
  • app_provenance.load_verified_provenance (cognitive 26) backend/core/app_provenance.py:122 — app_provenance.load_verified_provenance has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (14 pts), error handling 3 (5 pts), boolean chains 4, loops 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · attention_authority._collect_escalations (cognitive 26) · ×1
  • attention_authority._collect_escalations (cognitive 26) backend/core/attention_authority.py:133 — attention_authority._collect_escalations has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 3 (7 pts), boolean chains 4, error handling 2 (3 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 · attention_authority._collect_db_recovery (cognitive 26) · ×1
  • attention_authority._collect_db_recovery (cognitive 26) backend/core/attention_authority.py:390 — attention_authority._collect_db_recovery has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 5, error handling 2 (4 pts), ternaries 1 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · attention_authority._collect_local_roots (cognitive 26) · ×1
  • attention_authority._collect_local_roots (cognitive 26) backend/core/attention_authority.py:630 — attention_authority._collect_local_roots has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 6, error handling 2 (4 pts), loops 2 (3 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 · GraphStore.store_file_nodes_edges (cognitive 26) · ×1
  • GraphStore.store_file_nodes_edges (cognitive 26) backend/core/code_intel/graph_store.py:718 — GraphStore.store_file_nodes_edges has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (10 pts), loops 6 (8 pts), ternaries 4 (7 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 · cognition.find_store (cognitive 26) · ×1
  • cognition.find_store (cognitive 26) backend/core/cognition.py:233 — cognition.find_store has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 7, 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 · context_injector._extract_agent_spawns (cognitive 26) · ×1
  • context_injector._extract_agent_spawns (cognitive 26) backend/core/context_injector.py:416 — context_injector._extract_agent_spawns has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 2 (3 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 · engine_metrics._collect_ddd_health (cognitive 26) · ×1
  • engine_metrics._collect_ddd_health (cognitive 26) backend/core/engine_metrics.py:357 — engine_metrics._collect_ddd_health has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 4 (8 pts), boolean chains 2, error handling 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · hive_workspace._parse_checks (cognitive 26) · ×1
  • hive_workspace._parse_checks (cognitive 26) backend/core/hive_workspace.py:435 — hive_workspace._parse_checks has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 6, 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 · health.score (cognitive 26) · ×1
  • health.score (cognitive 26) backend/core/ingestion/health.py:573 — health.score has cognitive complexity 26 (threshold 15). Drivers by points: loops 6 (11 pts), ternaries 3 (8 pts), if/else 2 (5 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 · s7_review.session_model (cognitive 26) · ×1
  • s7_review.session_model (cognitive 26) backend/core/ingestion/sources/s7_review.py:678 — s7_review.session_model has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (12 pts), error handling 3 (6 pts), loops 1 (3 pts), ternaries 3, 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 · office_preview.preview_pptx (cognitive 26) · ×1
  • office_preview.preview_pptx (cognitive 26) backend/core/office_preview.py:99 — office_preview.preview_pptx has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 3 (7 pts), boolean chains 4 (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 · checks.coverage_errors (cognitive 26) · ×1
  • checks.coverage_errors (cognitive 26) backend/core/run_protocol/checks.py:252 — checks.coverage_errors has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 3 (5 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 · run_knowledge._render (cognitive 26) · ×1
  • run_knowledge._render (cognitive 26) backend/core/run_protocol/run_knowledge.py:284 — run_knowledge._render has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 4 (7 pts), ternaries 4 (7 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · schemas._design_rows (cognitive 26) · ×1
  • schemas._design_rows (cognitive 26) backend/core/run_protocol/schemas.py:425 — schemas._design_rows has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 7 (10 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 · run_worktree.landed_path (cognitive 26) · ×1
  • run_worktree.landed_path (cognitive 26) backend/core/run_worktree.py:1964 — run_worktree.landed_path has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 6, error handling 2 (3 pts), loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · security_hooks._command_has_git_commit (cognitive 26) · ×1
  • security_hooks._command_has_git_commit (cognitive 26) backend/core/security_hooks.py:3028 — security_hooks._command_has_git_commit has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 3 (5 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 · session_registry.kill_all_claude_processes (cognitive 26) · ×1
  • session_registry.kill_all_claude_processes (cognitive 26) backend/core/session_registry.py:176 — session_registry.kill_all_claude_processes has cognitive complexity 26 (threshold 15). Drivers by points: error handling 6 (12 pts), if/else 8 (11 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionRouter._evict_idle (cognitive 26) · ×1
  • SessionRouter._evict_idle (cognitive 26) backend/core/session_router.py:3352 — SessionRouter._evict_idle has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 4, 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 · SessionRouter._turn_products_at_stop (cognitive 26) · ×1
  • SessionRouter._turn_products_at_stop (cognitive 26) backend/core/session_router.py:6000 — SessionRouter._turn_products_at_stop has cognitive complexity 26 (threshold 15). Drivers by points: loops 3 (9 pts), error handling 2 (7 pts), if/else 3 (4 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · session_utils._build_error_event (cognitive 26) · ×1
  • session_utils._build_error_event (cognitive 26) backend/core/session_utils.py:860 — session_utils._build_error_event has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 1 (3 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 · SummarizationPipeline._extract_decisions (cognitive 26) · ×1
  • SummarizationPipeline._extract_decisions (cognitive 26) backend/core/summarization.py:423 — SummarizationPipeline._extract_decisions has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (22 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 · SummarizationPipeline._enrich_with_llm (cognitive 26) · ×1
  • SummarizationPipeline._enrich_with_llm (cognitive 26) backend/core/summarization.py:608 — SummarizationPipeline._enrich_with_llm has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 9, ternaries 3 (6 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 · task_repos._pulled_upstream (cognitive 26) · ×1
  • task_repos._pulled_upstream (cognitive 26) backend/core/task_repos.py:220 — task_repos._pulled_upstream has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, ternaries 2 (5 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 · memory_health._compress_evolution_entries (cognitive 26) · ×1
  • memory_health._compress_evolution_entries (cognitive 26) backend/jobs/handlers/memory_health.py:503 — memory_health._compress_evolution_entries has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 4, 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 · self_tune.suggest_new_feeds (cognitive 26) · ×1
  • self_tune.suggest_new_feeds (cognitive 26) backend/jobs/self_tune.py:376 — self_tune.suggest_new_feeds has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 5 (9 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pollinate._publish_status_for (cognitive 26) · ×1
  • pollinate._publish_status_for (cognitive 26) backend/routers/pollinate.py:232 — pollinate._publish_status_for has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (14 pts), ternaries 1 (6 pts), loops 2 (4 pts), error handling 1 (2 pts) (nesting depth added 17). 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 · migrate_skills.generate_manifest (cognitive 26) · ×1
  • migrate_skills.generate_manifest (cognitive 26) backend/scripts/migrate_skills.py:235 — migrate_skills.generate_manifest has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 4 (7 pts), boolean chains 3, error handling 1 (2 pts), ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · scenario_runner.run_scenario_raw (cognitive 26) · ×1
  • scenario_runner.run_scenario_raw (cognitive 26) backend/scripts/scenario_runner.py:325 — scenario_runner.run_scenario_raw has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (10 pts), error handling 5 (8 pts), boolean chains 7, 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 · brand_chart.apply_brand_to_charts (cognitive 26) · ×1
  • brand_chart.apply_brand_to_charts (cognitive 26) backend/skills/s_pollinate/scripts/brand_chart.py:58 — brand_chart.apply_brand_to_charts has cognitive complexity 26 (threshold 15). Drivers by points: error handling 4 (14 pts), if/else 2 (6 pts), loops 3 (6 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 · generate_shorts.main (cognitive 26) · ×1
  • generate_shorts.main (cognitive 26) backend/skills/s_pollinate/scripts/generate_shorts.py:534 — generate_shorts.main has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (20 pts), loops 4 (5 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 · ShapeData.get_font_path (cognitive 26) · ×1
  • ShapeData.get_font_path (cognitive 26) backend/skills/s_pptx/scripts/inventory.py:280 — ShapeData.get_font_path has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 4 (8 pts), error handling 1 (2 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 · verify_ddd_complete._check_project_agent (cognitive 26) · ×1
  • verify_ddd_complete._check_project_agent (cognitive 26) backend/skills/s_project-manager/scripts/verify_ddd_complete.py:546 — verify_ddd_complete._check_project_agent has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7, ternaries 6, error handling 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 · MultiSelect.MultiSelect (cognitive 26) · ×1
  • MultiSelect.MultiSelect (cognitive 26) desktop/src/components/common/MultiSelect.tsx:26 — MultiSelect.MultiSelect has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 15, if/else 8 (9 pts), ternaries 2 (nesting depth added 1). Most of this is not in the body itself: 12 of the 26 points are its own statements and the rest belongs to 7 function items inside it that branch (handleSelect, handleToggle, a function literal at line 46, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · sessionEvents.createSessionEventsClient.dispatch (cognitive 26) · ×1
  • sessionEvents.createSessionEventsClient.dispatch (cognitive 26) desktop/src/services/sessionEvents.ts:104 — sessionEvents.createSessionEventsClient.dispatch has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4, ternaries 1 (4 pts), loops 2 (3 pts), 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 · useChatStreamingLifecycle.useChatStreamingLifecycle.applySteerRead (cognitive 26) · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle.applySteerRead (cognitive 26) desktop/src/hooks/useChatStreamingLifecycle.ts:2538 — useChatStreamingLifecycle.useChatStreamingLifecycle.applySteerRead has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 9, ternaries 2 (nesting depth added 3). Of this number, 23 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 · CodeGraph.CodeGraph (cognitive 26) · ×1
  • CodeGraph.CodeGraph (cognitive 26) desktop/src/components/code-intel/CodeGraph.tsx:81 — CodeGraph.CodeGraph has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12, boolean chains 11, loops 2, ternaries 1. Most of this is not in the body itself: 9 of the 26 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 174, 162, 106, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · HiveFleetOverlay.HiveFleetContent (cognitive 26) · ×1
  • HiveFleetOverlay.HiveFleetContent (cognitive 26) desktop/src/components/layout/HiveFleetOverlay.tsx:46 — HiveFleetOverlay.HiveFleetContent has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 12 (21 pts), boolean chains 5 (nesting depth added 9). Of this number, 23 points are the body's own statements and 3 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 · PdfRenderer.PdfRenderer (cognitive 26) · ×1
  • PdfRenderer.PdfRenderer (cognitive 26) desktop/src/components/file-viewer/renderers/PdfRenderer.tsx:45 — PdfRenderer.PdfRenderer has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12, ternaries 6 (7 pts), boolean chains 5, error handling 1, loops 1 (nesting depth added 1). Most of this is not in the body itself: 8 of the 26 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 169, 61, 80, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · TSCCModules.SystemPromptModule (cognitive 26) · ×1
  • TSCCModules.SystemPromptModule (cognitive 26) desktop/src/pages/chat/components/TSCCModules.tsx:653 — TSCCModules.SystemPromptModule has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 14, if/else 11, ternaries 1. Most of this is not in the body itself: 8 of the 26 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 712, 662, 725, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · turnControls.answerQuestion (cognitive 26) · ×1
  • turnControls.answerQuestion (cognitive 26) desktop/src/pages/chat/turnControls.ts:402 — turnControls.answerQuestion has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 5, ternaries 2 (3 pts) (nesting depth added 7). Of this number, 20 points are the body's own statements and 6 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GraphStore.overridden (cognitive 25) · ×1
  • GraphStore.overridden (cognitive 25) backend/core/code_intel/graph_store.py:1063 — GraphStore.overridden has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 4 (10 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 · interface.breaks (cognitive 25) · ×1
  • interface.breaks (cognitive 25) backend/core/code_intel/interface.py:842 — interface.breaks has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 8, 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 · coe_threads.coe_states (cognitive 25) · ×1
  • coe_threads.coe_states (cognitive 25) backend/core/coe_threads.py:130 — coe_threads.coe_states has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (14 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (3 pts), 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 · ddd_health.compute_section_health (cognitive 25) · ×1
  • ddd_health.compute_section_health (cognitive 25) backend/core/ddd_health.py:256 — ddd_health.compute_section_health has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (15 pts), error handling 3 (7 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 · ddd_job_registry.build_manifest_jobs (cognitive 25) · ×1
  • ddd_job_registry.build_manifest_jobs (cognitive 25) backend/core/ddd_job_registry.py:121 — ddd_job_registry.build_manifest_jobs has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (4 pts), error handling 2 (3 pts), ternaries 1 (3 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 · ddd_packager._materialize_shared (cognitive 25) · ×1
  • ddd_packager._materialize_shared (cognitive 25) backend/core/ddd_packager.py:926 — ddd_packager._materialize_shared has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 5 (8 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 · eval_log.export (cognitive 25) · ×1
  • eval_log.export (cognitive 25) backend/core/ingestion/eval_log.py:98 — eval_log.export has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 14, loops 5 (6 pts), ternaries 3, if/else 1 (2 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · LifecycleManager._scan_unprocessed_sessions (cognitive 25) · ×1
  • LifecycleManager._scan_unprocessed_sessions (cognitive 25) backend/core/lifecycle_manager.py:1717 — LifecycleManager._scan_unprocessed_sessions has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 4, error handling 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 · north_star._cognition (cognitive 25) · ×1
  • north_star._cognition (cognitive 25) backend/core/north_star.py:49 — north_star._cognition has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 8 (10 pts), boolean chains 7, if/else 7, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · recall_multi._memory_outside_prompt (cognitive 25) · ×1
  • recall_multi._memory_outside_prompt (cognitive 25) backend/core/recall_multi.py:791 — recall_multi._memory_outside_prompt has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 2 (4 pts), error handling 1 (2 pts) (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · repo_placement.clone_into_workspace (cognitive 25) · ×1
  • repo_placement.clone_into_workspace (cognitive 25) backend/core/repo_placement.py:309 — repo_placement.clone_into_workspace has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 5, loops 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 · audit.select_untracked (cognitive 25) · ×1
  • audit.select_untracked (cognitive 25) backend/core/run_protocol/audit.py:291 — audit.select_untracked has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 9, error handling 1 (2 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · next_step._review_action (cognitive 25) · ×1
  • next_step._review_action (cognitive 25) backend/core/run_protocol/next_step.py:104 — next_step._review_action has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 5, ternaries 1 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · session_changes._read_window (cognitive 25) · ×1
  • session_changes._read_window (cognitive 25) backend/core/session_changes.py:173 — session_changes._read_window has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (6 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 · SessionEventHub.publish (cognitive 25) · ×1
  • SessionEventHub.publish (cognitive 25) backend/core/session_events.py:209 — SessionEventHub.publish has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 4, ternaries 2 (4 pts), error handling 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 · SessionRouter.drain_pending (cognitive 25) · ×1
  • SessionRouter.drain_pending (cognitive 25) backend/core/session_router.py:3794 — SessionRouter.drain_pending has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 2 (5 pts), boolean chains 4, error handling 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 · SessionUnit._spawn (cognitive 25) · ×1
  • SessionUnit._spawn (cognitive 25) backend/core/session_unit.py:3896 — SessionUnit._spawn has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11, boolean chains 7, error handling 3 (4 pts), ternaries 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · session_utils.read_owner_pid (cognitive 25) · ×1
  • session_utils.read_owner_pid (cognitive 25) backend/core/session_utils.py:916 — session_utils.read_owner_pid has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 4 (6 pts), loops 1 (3 pts), boolean chains 1, ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · shell_segments.split_segments (cognitive 25) · ×1
  • shell_segments.split_segments (cognitive 25) backend/core/shell_segments.py:24 — shell_segments.split_segments has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 3 (5 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 · swarm_out._prepare_work (cognitive 25) · ×1
  • swarm_out._prepare_work (cognitive 25) backend/core/swarm_out.py:365 — swarm_out._prepare_work has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (7 pts), ternaries 4 (7 pts), error handling 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 · tscc.get_security_scan (cognitive 25) · ×1
  • tscc.get_security_scan (cognitive 25) backend/routers/tscc.py:159 — tscc.get_security_scan has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 6, ternaries 2 (3 pts), 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, 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 · cdf_batch_eval.final_labels (cognitive 25) · ×1
  • cdf_batch_eval.final_labels (cognitive 25) backend/scripts/cdf_batch_eval.py:342 — cdf_batch_eval.final_labels has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 3 (11 pts), if/else 3 (8 pts), boolean chains 3, 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 · cdf_replay_invalid.candidates (cognitive 25) · ×1
  • cdf_replay_invalid.candidates (cognitive 25) backend/scripts/cdf_replay_invalid.py:62 — cdf_replay_invalid.candidates has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 12, if/else 2 (7 pts), loops 3 (6 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 · cdf_write_scan.sink_kind (cognitive 25) · ×1
  • cdf_write_scan.sink_kind (cognitive 25) backend/scripts/cdf_write_scan.py:77 — cdf_write_scan.sink_kind has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 8, boolean chains 5 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check_migration_class.check_migration_class (cognitive 25) · ×1
  • check_migration_class.check_migration_class (cognitive 25) backend/scripts/check_migration_class.py:197 — check_migration_class.check_migration_class has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 2, 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 · ci_eval_gate.check_gate (cognitive 25) · ×1
  • ci_eval_gate.check_gate (cognitive 25) backend/scripts/ci_eval_gate.py:76 — ci_eval_gate.check_gate has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 7, loops 1, 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 · da_resummarize.split_day (cognitive 25) · ×1
  • da_resummarize.split_day (cognitive 25) backend/scripts/da_resummarize.py:118 — da_resummarize.split_day has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3 (7 pts), boolean chains 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 · degeneration_dataset_eval._blocks (cognitive 25) · ×1
  • degeneration_dataset_eval._blocks (cognitive 25) backend/scripts/degeneration_dataset_eval.py:69 — degeneration_dataset_eval._blocks has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 4, loops 2 (3 pts), 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 · golden_case_validator._bootstrap_check_errors (cognitive 25) · ×1
  • golden_case_validator._bootstrap_check_errors (cognitive 25) backend/scripts/golden_case_validator.py:337 — golden_case_validator._bootstrap_check_errors has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 10, if/else 7 (10 pts), loops 3, ternaries 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · scenario_runner.parse_final_text (cognitive 25) · ×1
  • scenario_runner.parse_final_text (cognitive 25) backend/scripts/scenario_runner.py:114 — scenario_runner.parse_final_text has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (3 pts), boolean chains 2, error handling 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 · cross_format_check.main (cognitive 25) · ×1
  • cross_format_check.main (cognitive 25) backend/skills/s_pollinate/scripts/cross_format_check.py:266 — cross_format_check.main has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 1 (2 pts), ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · format_recommend.detect_fast_path (cognitive 25) · ×1
  • format_recommend.detect_fast_path (cognitive 25) backend/skills/s_pollinate/scripts/format_recommend.py:412 — format_recommend.detect_fast_path has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (18 pts), boolean chains 3, loops 2 (3 pts), ternaries 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 · todo_db._print_work_packet (cognitive 25) · ×1
  • todo_db._print_work_packet (cognitive 25) backend/skills/s_radar-todo/scripts/todo_db.py:145 — todo_db._print_work_packet has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12, loops 6 (12 pts), ternaries 1 (nesting depth added 6). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · UpdateNotification.UpdateNotification (cognitive 25) · ×1
  • UpdateNotification.UpdateNotification (cognitive 25) desktop/src/components/common/UpdateNotification.tsx:17 — UpdateNotification.UpdateNotification has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 13, ternaries 3 (5 pts), if/else 4, error handling 3 (nesting depth added 2). Of this number, 15 points are the body's own statements and 10 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CMBrainOverlay.CMBrainContent (cognitive 25) · ×1
  • CMBrainOverlay.CMBrainContent (cognitive 25) desktop/src/components/layout/CMBrainOverlay.tsx:161 — CMBrainOverlay.CMBrainContent has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 9 (15 pts), boolean chains 10 (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 · PipelineOverlay.Row (cognitive 25) · ×1
  • PipelineOverlay.Row (cognitive 25) desktop/src/components/layout/PipelineOverlay.tsx:88 — PipelineOverlay.Row has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 12 (20 pts), boolean chains 4, if/else 1 (nesting depth added 8). Of this number, 22 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OverviewTab.OverviewTab (cognitive 25) · ×1
  • OverviewTab.OverviewTab (cognitive 25) desktop/src/pages/eval/OverviewTab.tsx:32 — OverviewTab.OverviewTab has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 8 (12 pts), boolean chains 11, 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 · SystemTab.SystemTab (cognitive 25) · ×1
  • SystemTab.SystemTab (cognitive 25) desktop/src/components/settings/SystemTab.tsx:15 — SystemTab.SystemTab has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 6 (10 pts), boolean chains 6, error handling 4 (5 pts), if/else 3 (4 pts) (nesting depth added 6). Of this number, 13 points are the body's own statements and 12 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 · HiveFleet.HiveFleetSection (cognitive 25) · ×1
  • HiveFleet.HiveFleetSection (cognitive 25) desktop/src/components/awsAccount/HiveFleet.tsx:279 — HiveFleet.HiveFleetSection has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 7 (14 pts), boolean chains 7, if/else 3, error handling 1 (nesting depth added 7). Of this number, 22 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 · turnControls.stopTurn (cognitive 25) · ×1
  • turnControls.stopTurn (cognitive 25) desktop/src/pages/chat/turnControls.ts:561 — turnControls.stopTurn has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (13 pts), error handling 2 (5 pts), ternaries 3 (4 pts), boolean chains 3 (nesting depth added 7). Of this number, 21 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · adversarial_meta.check_adversarial_health (cognitive 24) · ×1
  • adversarial_meta.check_adversarial_health (cognitive 24) backend/core/adversarial_meta.py:31 — adversarial_meta.check_adversarial_health has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 3 (6 pts), boolean chains 2, loops 2, 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 · attention_authority._collect_ingestion (cognitive 24) · ×1
  • attention_authority._collect_ingestion (cognitive 24) backend/core/attention_authority.py:925 — attention_authority._collect_ingestion has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 6, error handling 3 (4 pts), ternaries 2 (4 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 · survey.owned_repos (cognitive 24) · ×1
  • survey.owned_repos (cognitive 24) backend/core/brain_bootstrap/survey.py:76 — survey.owned_repos has cognitive complexity 24 (threshold 15). Drivers by points: error handling 3 (8 pts), if/else 3 (6 pts), loops 4 (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 · brain_teardown._ownership (cognitive 24) · ×1
  • brain_teardown._ownership (cognitive 24) backend/core/brain_teardown.py:87 — brain_teardown._ownership has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 5, error handling 2 (5 pts), loops 2 (3 pts), ternaries 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · changed._hunk_ranges (cognitive 24) · ×1
  • changed._hunk_ranges (cognitive 24) backend/core/code_intel/changed.py:172 — changed._hunk_ranges has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 5 (14 pts), if/else 3 (7 pts), boolean chains 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · interface._java_scan (cognitive 24) · ×1
  • interface._java_scan (cognitive 24) backend/core/code_intel/interface.py:313 — interface._java_scan has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 3, loops 2 (3 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 · parser._regex_fallback (cognitive 24) · ×1
  • parser._regex_fallback (cognitive 24) backend/core/code_intel/parser.py:2188 — parser._regex_fallback has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 4 (8 pts), ternaries 2 (4 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 · parser.parse_file_with_status (cognitive 24) · ×1
  • parser.parse_file_with_status (cognitive 24) backend/core/code_intel/parser.py:2294 — parser.parse_file_with_status has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 4, error handling 2 (3 pts), loops 1 (2 pts), ternaries 1 (nesting depth added 10). 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 · ddd_entry_lifecycle.split_blocks_at (cognitive 24) · ×1
  • ddd_entry_lifecycle.split_blocks_at (cognitive 24) backend/core/ddd_entry_lifecycle.py:597 — ddd_entry_lifecycle.split_blocks_at has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (18 pts), ternaries 1 (3 pts), boolean chains 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 · ddd_packager.gate_dangling_skill_refs (cognitive 24) · ×1
  • ddd_packager.gate_dangling_skill_refs (cognitive 24) backend/core/ddd_packager.py:615 — ddd_packager.gate_dangling_skill_refs has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (6 pts), boolean chains 3, ternaries 2 (3 pts), error handling 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 · governed_edit.recover_tree_plan (cognitive 24) · ×1
  • governed_edit.recover_tree_plan (cognitive 24) backend/core/ingestion/governed_edit.py:381 — governed_edit.recover_tree_plan has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (22 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 · s2_session.window_roots (cognitive 24) · ×1
  • s2_session.window_roots (cognitive 24) backend/core/ingestion/sources/s2_session.py:113 — s2_session.window_roots has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 2 (5 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · knowledge_cli._find (cognitive 24) · ×1
  • knowledge_cli._find (cognitive 24) backend/core/knowledge_cli.py:96 — knowledge_cli._find has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (17 pts), ternaries 3 (4 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · memory_index._bm25_scores (cognitive 24) · ×1
  • memory_index._bm25_scores (cognitive 24) backend/core/memory_index.py:430 — memory_index._bm25_scores has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 5 (7 pts), ternaries 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 · RunEngine._resolve_reported_tests (cognitive 24) · ×1
  • RunEngine._resolve_reported_tests (cognitive 24) backend/core/run_protocol/engine.py:1636 — RunEngine._resolve_reported_tests has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, ternaries 3 (5 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 · RunEngine._callers_block (cognitive 24) · ×1
  • RunEngine._callers_block (cognitive 24) backend/core/run_protocol/engine.py:3033 — RunEngine._callers_block has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (8 pts), error handling 2 (7 pts), ternaries 2 (7 pts), boolean chains 1, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · lifecycle._attempt (cognitive 24) · ×1
  • lifecycle._attempt (cognitive 24) backend/core/run_protocol/lifecycle.py:263 — lifecycle._attempt has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 5 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runtime_hooks._runner_runs_tests (cognitive 24) · ×1
  • runtime_hooks._runner_runs_tests (cognitive 24) backend/core/runtime_hooks.py:191 — runtime_hooks._runner_runs_tests has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 4, 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 · _LinkScan.stdin_hit (cognitive 24) · ×1
  • _LinkScan.stdin_hit (cognitive 24) backend/core/security_hooks.py:4921 — _LinkScan.stdin_hit has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 2 (5 pts), ternaries 3 (5 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 · security_hooks._shell_c_parts (cognitive 24) · ×1
  • security_hooks._shell_c_parts (cognitive 24) backend/core/security_hooks.py:4221 — security_hooks._shell_c_parts has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 4, 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 · security_hooks._npm_call_command (cognitive 24) · ×1
  • security_hooks._npm_call_command (cognitive 24) backend/core/security_hooks.py:4280 — security_hooks._npm_call_command has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 3 (9 pts), boolean chains 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 · SessionUnit.continue_with_answer (cognitive 24) · ×1
  • SessionUnit.continue_with_answer (cognitive 24) backend/core/session_unit.py:4488 — SessionUnit.continue_with_answer has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 3 (7 pts), boolean chains 5, error handling 2 (4 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 · swarm_out.dispatch (cognitive 24) · ×1
  • swarm_out.dispatch (cognitive 24) backend/core/swarm_out.py:455 — swarm_out.dispatch has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 8, error handling 4, ternaries 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 · swarm_out._start_session (cognitive 24) · ×1
  • swarm_out._start_session (cognitive 24) backend/core/swarm_out.py:1029 — swarm_out._start_session has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 4, 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 · swarm_out_actor.commits_here (cognitive 24) · ×1
  • swarm_out_actor.commits_here (cognitive 24) backend/core/swarm_out_actor.py:322 — swarm_out_actor.commits_here has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 9, error handling 2 (4 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 · swarm_out_results.execution_check (cognitive 24) · ×1
  • swarm_out_results.execution_check (cognitive 24) backend/core/swarm_out_results.py:1061 — swarm_out_results.execution_check has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 4 (7 pts), boolean chains 6 (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 · swarm_out_wake.wake_sessions (cognitive 24) · ×1
  • swarm_out_wake.wake_sessions (cognitive 24) backend/core/swarm_out_wake.py:142 — swarm_out_wake.wake_sessions has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 2 (4 pts), boolean chains 2, 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 · daily_activity_hook.commit_subjects (cognitive 24) · ×1
  • daily_activity_hook.commit_subjects (cognitive 24) backend/hooks/daily_activity_hook.py:151 — daily_activity_hook.commit_subjects has cognitive complexity 24 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 3 (6 pts), boolean chains 4, error handling 1 (3 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 · github_trending.fetch_github_trending (cognitive 24) · ×1
  • github_trending.fetch_github_trending (cognitive 24) backend/jobs/adapters/github_trending.py:47 — github_trending.fetch_github_trending has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 4 (8 pts), error handling 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 · weibo_trending._search_keyword (cognitive 24) · ×1
  • weibo_trending._search_keyword (cognitive 24) backend/jobs/adapters/weibo_trending.py:135 — weibo_trending._search_keyword has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (21 pts), 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 · self_tune.track_signal_usage (cognitive 24) · ×1
  • self_tune.track_signal_usage (cognitive 24) backend/jobs/self_tune.py:203 — self_tune.track_signal_usage has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 5 (7 pts), ternaries 2, 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 · cdf_rehearsal_replay.replay (cognitive 24) · ×1
  • cdf_rehearsal_replay.replay (cognitive 24) backend/scripts/cdf_rehearsal_replay.py:225 — cdf_rehearsal_replay.replay has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (16 pts), error handling 1 (3 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 · da_resummarize._rewrite_rows (cognitive 24) · ×1
  • da_resummarize._rewrite_rows (cognitive 24) backend/scripts/da_resummarize.py:492 — da_resummarize._rewrite_rows has cognitive complexity 24 (threshold 15). Drivers by points: loops 4 (7 pts), boolean chains 5, ternaries 2 (5 pts), if/else 2 (4 pts), error handling 1 (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 · knowledge_usage_report.scan_runs (cognitive 24) · ×1
  • knowledge_usage_report.scan_runs (cognitive 24) backend/scripts/knowledge_usage_report.py:127 — knowledge_usage_report.scan_runs has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (13 pts), error handling 2 (5 pts), boolean chains 3, 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 · DocxXMLEditor.revert_insertion (cognitive 24) · ×1
  • DocxXMLEditor.revert_insertion (cognitive 24) backend/skills/s_docx/scripts/document.py:264 — DocxXMLEditor.revert_insertion has cognitive complexity 24 (threshold 15). Drivers by points: loops 6 (16 pts), if/else 5 (8 pts) (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 · phonemes.load_phoneme_dicts (cognitive 24) · ×1
  • phonemes.load_phoneme_dicts (cognitive 24) backend/skills/s_pollinate/scripts/tts/phonemes.py:7 — phonemes.load_phoneme_dicts has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 1, ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mcp_validation.validate_config_entry (cognitive 24) · ×1
  • mcp_validation.validate_config_entry (cognitive 24) backend/utils/mcp_validation.py:105 — mcp_validation.validate_config_entry has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 8, 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 · turnZones.mergeColumn (cognitive 24) · ×1
  • turnZones.mergeColumn (cognitive 24) desktop/src/pages/chat/turnZones.ts:621 — turnZones.mergeColumn has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 6, loops 1 (nesting depth added 10). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CMBrainOverlay.ArchivePanel (cognitive 24) · ×1
  • CMBrainOverlay.ArchivePanel (cognitive 24) desktop/src/components/layout/CMBrainOverlay.tsx:805 — CMBrainOverlay.ArchivePanel has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 7 (19 pts), boolean chains 5 (nesting depth added 12). Of this number, 23 points are the body's own statements and 1 belongs to one function literal 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 · LibraryOverlay.BrowseTab (cognitive 24) · ×1
  • LibraryOverlay.BrowseTab (cognitive 24) desktop/src/components/layout/LibraryOverlay.tsx:185 — LibraryOverlay.BrowseTab has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 8 (19 pts), boolean chains 5 (nesting depth added 11). 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 literals inside it that branch (lines 232, 240). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · BrainLearnedView.Entry (cognitive 24) · ×1
  • BrainLearnedView.Entry (cognitive 24) desktop/src/components/layout/BrainLearnedView.tsx:199 — BrainLearnedView.Entry has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 11, ternaries 7 (11 pts), error handling 1, if/else 1 (nesting depth added 4). Of this number, 18 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 · PipelineMetrics.PipelineMetrics (cognitive 24) · ×1
  • PipelineMetrics.PipelineMetrics (cognitive 24) desktop/src/components/layout/PipelineMetrics.tsx:82 — PipelineMetrics.PipelineMetrics has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 14 (15 pts), boolean chains 8, if/else 1 (nesting depth added 1). Of this number, 22 points are the body's own statements and 2 belong to 4 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 · useVoiceRecorder.useVoiceRecorder.stopRecording (cognitive 24) · ×1
  • useVoiceRecorder.useVoiceRecorder.stopRecording (cognitive 24) desktop/src/hooks/useVoiceRecorder.ts:245 — useVoiceRecorder.useVoiceRecorder.stopRecording has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (15 pts), error handling 3 (4 pts), boolean chains 3, 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, 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 · FileBrowser.FileBrowser (cognitive 24) · ×1
  • FileBrowser.FileBrowser (cognitive 24) desktop/src/components/workspace/FileBrowser.tsx:100 — FileBrowser.FileBrowser has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 8 (15 pts), if/else 5, boolean chains 4 (nesting depth added 7). Of this number, 13 points are the body's own statements and 11 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 · ChannelGateway._should_reply (cognitive 23) · ×1
  • ChannelGateway._should_reply (cognitive 23) backend/channels/gateway.py:1199 — ChannelGateway._should_reply has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 7, error handling 1 (3 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 · attention_authority._collect_paused_runs (cognitive 23) · ×1
  • attention_authority._collect_paused_runs (cognitive 23) backend/core/attention_authority.py:262 — attention_authority._collect_paused_runs has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 5 (9 pts), boolean chains 6, if/else 2 (4 pts), error handling 2 (3 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · attention_authority._collect_aws_account (cognitive 23) · ×1
  • attention_authority._collect_aws_account (cognitive 23) backend/core/attention_authority.py:1019 — attention_authority._collect_aws_account has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 11, ternaries 4 (8 pts), if/else 3, error handling 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 · FileTypes._name_type (cognitive 23) · ×1
  • FileTypes._name_type (cognitive 23) backend/core/code_intel/receivers.py:636 — FileTypes._name_type has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (16 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 · receivers.patch_reference (cognitive 23) · ×1
  • receivers.patch_reference (cognitive 23) backend/core/code_intel/receivers.py:1157 — receivers.patch_reference has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 10, 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 · context_injector._extract_skill_invocations (cognitive 23) · ×1
  • context_injector._extract_skill_invocations (cognitive 23) backend/core/context_injector.py:451 — context_injector._extract_skill_invocations has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ddd_health._build_changelog_index (cognitive 23) · ×1
  • ddd_health._build_changelog_index (cognitive 23) backend/core/ddd_health.py:159 — ddd_health._build_changelog_index has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 3 (5 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 · hive_records.append (cognitive 23) · ×1
  • hive_records.append (cognitive 23) backend/core/hive_records.py:209 — hive_records.append has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 8, ternaries 4, loops 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 · governed_edit.recover_redact_plan (cognitive 23) · ×1
  • governed_edit.recover_redact_plan (cognitive 23) backend/core/ingestion/governed_edit.py:554 — governed_edit.recover_redact_plan has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 6 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · s7_review.relation_prompt (cognitive 23) · ×1
  • s7_review.relation_prompt (cognitive 23) backend/core/ingestion/sources/s7_review.py:488 — s7_review.relation_prompt has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 3 (7 pts), boolean chains 4, loops 3 (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 · s7_review.apply_relations (cognitive 23) · ×1
  • s7_review.apply_relations (cognitive 23) backend/core/ingestion/sources/s7_review.py:556 — s7_review.apply_relations has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 6, error handling 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 · worker.cleanup_expired (cognitive 23) · ×1
  • worker.cleanup_expired (cognitive 23) backend/core/ingestion/worker.py:504 — worker.cleanup_expired has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 4 (7 pts), ternaries 2 (5 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · child_cli._run (cognitive 23) · ×1
  • child_cli._run (cognitive 23) backend/core/run_protocol/child_cli.py:523 — child_cli._run has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9, ternaries 4 (9 pts), error handling 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 · engine._comment_only_diff (cognitive 23) · ×1
  • engine._comment_only_diff (cognitive 23) backend/core/run_protocol/engine.py:198 — engine._comment_only_diff has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (17 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 · next_step.split_groups (cognitive 23) · ×1
  • next_step.split_groups (cognitive 23) backend/core/run_protocol/next_step.py:340 — next_step.split_groups has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 4 (6 pts), boolean chains 5 (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 · security_hooks._checkout_discards (cognitive 23) · ×1
  • security_hooks._checkout_discards (cognitive 23) backend/core/security_hooks.py:1586 — security_hooks._checkout_discards has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 6, 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 · session_inputs._split_user_input_parts (cognitive 23) · ×1
  • session_inputs._split_user_input_parts (cognitive 23) backend/core/session_inputs.py:137 — session_inputs._split_user_input_parts has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, ternaries 2 (4 pts), loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · session_router._convert_unsupported_blocks_to_path_hints (cognitive 23) · ×1
  • session_router._convert_unsupported_blocks_to_path_hints (cognitive 23) backend/core/session_router.py:2113 — session_router._convert_unsupported_blocks_to_path_hints has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), error handling 1 (3 pts), ternaries 1 (3 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 · swarm_out_results._repo_fact (cognitive 23) · ×1
  • swarm_out_results._repo_fact (cognitive 23) backend/core/swarm_out_results.py:104 — swarm_out_results._repo_fact has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 11, ternaries 7, if/else 3 (4 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 · swarm_workspace_manager._load_ddd_native_skill_templates (cognitive 23) · ×1
  • swarm_workspace_manager._load_ddd_native_skill_templates (cognitive 23) backend/core/swarm_workspace_manager.py:634 — swarm_workspace_manager._load_ddd_native_skill_templates has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (13 pts), error handling 2 (6 pts), loops 2 (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 · usage_import._token_usage_rows (cognitive 23) · ×1
  • usage_import._token_usage_rows (cognitive 23) backend/core/usage_import.py:51 — usage_import._token_usage_rows has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 3 (7 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 · worktree_write_gate._ref_writes (cognitive 23) · ×1
  • worktree_write_gate._ref_writes (cognitive 23) backend/core/worktree_write_gate.py:403 — worktree_write_gate._ref_writes has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 5, 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 · ContextHealthHook._check_self_report_drift (cognitive 23) · ×1
  • ContextHealthHook._check_self_report_drift (cognitive 23) backend/hooks/context_health_hook.py:1449 — ContextHealthHook._check_self_report_drift has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (13 pts), error handling 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 · daily_activity_hook._bash_call_windows (cognitive 23) · ×1
  • daily_activity_hook._bash_call_windows (cognitive 23) backend/hooks/daily_activity_hook.py:178 — daily_activity_hook._bash_call_windows has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 5, error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · trending.fetch_trending (cognitive 23) · ×1
  • trending.fetch_trending (cognitive 23) backend/jobs/adapters/trending.py:47 — trending.fetch_trending has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 3, loops 2 (3 pts), error handling 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 · workspace.upload_file (cognitive 23) · ×1
  • workspace.upload_file (cognitive 23) backend/routers/workspace.py:643 — workspace.upload_file has cognitive complexity 23 (threshold 15). Drivers by points: error handling 7 (12 pts), if/else 9 (10 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 · clean_daily_activity._blocks (cognitive 23) · ×1
  • clean_daily_activity._blocks (cognitive 23) backend/scripts/clean_daily_activity.py:55 — clean_daily_activity._blocks has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · eval_runner._behavior_check_failures (cognitive 23) · ×1
  • eval_runner._behavior_check_failures (cognitive 23) backend/scripts/eval_runner.py:1740 — eval_runner._behavior_check_failures has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (21 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 · SelfLoopsHealthEngine._check_memory (cognitive 23) · ×1
  • SelfLoopsHealthEngine._check_memory (cognitive 23) backend/skills/s_loops-health/scripts/loops_health_check.py:268 — SelfLoopsHealthEngine._check_memory has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 5 (6 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 · style-extract.aggregate_style (cognitive 23) · ×1
  • style-extract.aggregate_style (cognitive 23) backend/skills/s_pptx/scripts/style-extract.py:201 — style-extract.aggregate_style has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ai_ready_helpers.evaluate_verification_response (cognitive 23) · ×1
  • ai_ready_helpers.evaluate_verification_response (cognitive 23) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1613 — ai_ready_helpers.evaluate_verification_response has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 2 (3 pts), boolean chains 2, 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 · diff_parser.format_human_summary (cognitive 23) · ×1
  • diff_parser.format_human_summary (cognitive 23) backend/utils/diff_parser.py:86 — diff_parser.format_human_summary has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 3, ternaries 2 (3 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BottomBar.BottomBar (cognitive 23) · ×1
  • BottomBar.BottomBar (cognitive 23) desktop/src/components/layout/BottomBar.tsx:24 — BottomBar.BottomBar has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 9 (16 pts), boolean chains 4, if/else 3 (nesting depth added 7). Of this number, 19 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 · ContentBlockRenderer.ContentBlockRenderer (cognitive 23) · ×1
  • ContentBlockRenderer.ContentBlockRenderer (cognitive 23) desktop/src/pages/chat/components/ContentBlockRenderer.tsx:166 — ContentBlockRenderer.ContentBlockRenderer has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 10, if/else 7 (9 pts), 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 · AboutTab.AboutTab (cognitive 23) · ×1
  • AboutTab.AboutTab (cognitive 23) desktop/src/components/settings/AboutTab.tsx:25 — AboutTab.AboutTab has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 10, if/else 6, ternaries 3 (5 pts), error handling 2 (nesting depth added 2). Most of this is not in the body itself: 10 of the 23 points are its own statements and the rest belongs to 4 function items inside it that branch (handleCheckForUpdates, handleDownload, a function literal at line 38, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · BackupTab.BackupTab (cognitive 23) · ×1
  • BackupTab.BackupTab (cognitive 23) desktop/src/components/settings/BackupTab.tsx:15 — BackupTab.BackupTab has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 10, ternaries 5 (6 pts), error handling 4, if/else 3 (nesting depth added 1). Of this number, 13 points are the body's own statements and 10 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SlackChannelAdapter._mcp_post_message (cognitive 22) · ×1
  • SlackChannelAdapter._mcp_post_message (cognitive 22) REDACTED:1349 — SlackChannelAdapter._mcp_post_message has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 1 (4 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 · attention_authority._collect_job_digests (cognitive 22) · ×1
  • attention_authority._collect_job_digests (cognitive 22) backend/core/attention_authority.py:534 — attention_authority._collect_job_digests has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 3 (5 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 · attention_authority._host_wait_items (cognitive 22) · ×1
  • attention_authority._host_wait_items (cognitive 22) backend/core/attention_authority.py:726 — attention_authority._host_wait_items has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (8 pts), ternaries 2 (5 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 · CliStreamReader._run (cognitive 22) · ×1
  • CliStreamReader._run (cognitive 22) backend/core/cli_stream_reader.py:339 — CliStreamReader._run has cognitive complexity 22 (threshold 15). Drivers by points: error handling 5 (9 pts), if/else 4 (6 pts), ternaries 3 (5 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 · parser._resolve_binding_name_nodes (cognitive 22) · ×1
  • parser._resolve_binding_name_nodes (cognitive 22) backend/core/code_intel/parser.py:388 — parser._resolve_binding_name_nodes has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 2 (4 pts), loops 1 (2 pts), boolean chains 1 (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 · FileTypes._scan (cognitive 22) · ×1
  • FileTypes._scan (cognitive 22) backend/core/code_intel/receivers.py:686 — FileTypes._scan has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 2 (7 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 · daily_activity_writer.upsert_session_block (cognitive 22) · ×1
  • daily_activity_writer.upsert_session_block (cognitive 22) backend/core/daily_activity_writer.py:283 — daily_activity_writer.upsert_session_block has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 7, ternaries 4 (6 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cognition_level.audit (cognitive 22) · ×1
  • cognition_level.audit (cognitive 22) backend/core/ingestion/cognition_level.py:292 — cognition_level.audit has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 4 (7 pts), boolean chains 3, 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 · health.run_checks (cognitive 22) · ×1
  • health.run_checks (cognitive 22) backend/core/ingestion/health.py:653 — health.run_checks has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 8, ternaries 8, if/else 3 (4 pts), error handling 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 · provenance.resolve_evidence (cognitive 22) · ×1
  • provenance.resolve_evidence (cognitive 22) backend/core/ingestion/provenance.py:282 — provenance.resolve_evidence has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, ternaries 2 (4 pts), loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · writer._build_plan (cognitive 22) · ×1
  • writer._build_plan (cognitive 22) backend/core/ingestion/writer.py:554 — writer._build_plan has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 8, ternaries 7 (8 pts), if/else 4 (5 pts), loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · LifecycleManager._sample_process_memory (cognitive 22) · ×1
  • LifecycleManager._sample_process_memory (cognitive 22) backend/core/lifecycle_manager.py:360 — LifecycleManager._sample_process_memory has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 4, error handling 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 · LifecycleManager._proactive_rss_restart (cognitive 22) · ×1
  • LifecycleManager._proactive_rss_restart (cognitive 22) backend/core/lifecycle_manager.py:458 — LifecycleManager._proactive_rss_restart has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 3 (5 pts), boolean chains 3, 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 · RecallEngine.search (cognitive 22) · ×1
  • RecallEngine.search (cognitive 22) backend/core/recall_engine.py:57 — RecallEngine.search has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 2 (7 pts), loops 3 (5 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · repo_guidance._targets (cognitive 22) · ×1
  • repo_guidance._targets (cognitive 22) backend/core/repo_guidance.py:288 — repo_guidance._targets has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 4 (8 pts), boolean chains 7, if/else 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 · repo_placement.normalize_url (cognitive 22) · ×1
  • repo_placement.normalize_url (cognitive 22) backend/core/repo_placement.py:203 — repo_placement.normalize_url has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 7, error handling 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · auth.normalize_bindings (cognitive 22) · ×1
  • auth.normalize_bindings (cognitive 22) backend/core/run_protocol/auth.py:59 — auth.normalize_bindings has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · baselines.compute (cognitive 22) · ×1
  • baselines.compute (cognitive 22) backend/core/run_protocol/baselines.py:54 — baselines.compute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 4, error handling 2 (3 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RunEngine._compute_current_code (cognitive 22) · ×1
  • RunEngine._compute_current_code (cognitive 22) backend/core/run_protocol/engine.py:861 — RunEngine._compute_current_code has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 2 (4 pts), ternaries 2 (4 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 · review_md.parse (cognitive 22) · ×1
  • review_md.parse (cognitive 22) backend/core/run_protocol/review_md.py:101 — review_md.parse has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · schemas._requirements (cognitive 22) · ×1
  • schemas._requirements (cognitive 22) backend/core/run_protocol/schemas.py:191 — schemas._requirements has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · run_worktree.sync (cognitive 22) · ×1
  • run_worktree.sync (cognitive 22) backend/core/run_worktree.py:726 — run_worktree.sync has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 4, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runtime_hooks._expert_answer (cognitive 22) · ×1
  • runtime_hooks._expert_answer (cognitive 22) backend/core/runtime_hooks.py:1141 — runtime_hooks._expert_answer has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, error handling 2 (4 pts), loops 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 · security_hooks._syntax_cannot_be_incomplete (cognitive 22) · ×1
  • security_hooks._syntax_cannot_be_incomplete (cognitive 22) backend/core/security_hooks.py:6175 — security_hooks._syntax_cannot_be_incomplete has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 5, ternaries 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · session_changes._apply_increment (cognitive 22) · ×1
  • session_changes._apply_increment (cognitive 22) backend/core/session_changes.py:218 — session_changes._apply_increment has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, loops 2 (3 pts), 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 · swarm_out._clean_ask (cognitive 22) · ×1
  • swarm_out._clean_ask (cognitive 22) backend/core/swarm_out.py:1099 — swarm_out._clean_ask has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, ternaries 4 (6 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 · Bridge.tick (cognitive 22) · ×1
  • Bridge.tick (cognitive 22) REDACTED:402 — Bridge.tick has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), error handling 2 (3 pts), loops 3, 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 · RelayManager._handle (cognitive 22) · ×1
  • RelayManager._handle (cognitive 22) backend/core/swarm_out_relay.py:223 — RelayManager._handle has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5, 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 · swarm_out_wait_card.answer_as_host (cognitive 22) · ×1
  • swarm_out_wait_card.answer_as_host (cognitive 22) backend/core/swarm_out_wait_card.py:346 — swarm_out_wait_card.answer_as_host has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 8, ternaries 2, error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · swarm_run_conductor._children_to_close (cognitive 22) · ×1
  • swarm_run_conductor._children_to_close (cognitive 22) backend/core/swarm_run_conductor.py:55 — swarm_run_conductor._children_to_close has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 6, loops 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SwarmWorkspaceManager.verify_integrity (cognitive 22) · ×1
  • SwarmWorkspaceManager.verify_integrity (cognitive 22) backend/core/swarm_workspace_manager.py:2060 — SwarmWorkspaceManager.verify_integrity has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (4 pts), error handling 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 · symlink_target_guard.link_into_dir (cognitive 22) · ×1
  • symlink_target_guard.link_into_dir (cognitive 22) backend/core/symlink_target_guard.py:79 — symlink_target_guard.link_into_dir has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, loops 2 (4 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 · usage_hive_sync._pull (cognitive 22) · ×1
  • usage_hive_sync._pull (cognitive 22) backend/core/usage_hive_sync.py:118 — usage_hive_sync._pull has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 3, loops 2 (3 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 · data_point_folding._fold_one_family (cognitive 22) · ×1
  • data_point_folding._fold_one_family (cognitive 22) backend/hooks/data_point_folding.py:201 — data_point_folding._fold_one_family has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 3, boolean chains 2, 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 · session_quality.score_window (cognitive 22) · ×1
  • session_quality.score_window (cognitive 22) backend/jobs/handlers/session_quality.py:271 — session_quality.score_window has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 9, 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 · model_resolve.resolve_job_model (cognitive 22) · ×1
  • model_resolve.resolve_job_model (cognitive 22) backend/jobs/model_resolve.py:33 — model_resolve.resolve_job_model has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (9 pts), error handling 4 (7 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 · ddd_brain._section_members (cognitive 22) · ×1
  • ddd_brain._section_members (cognitive 22) backend/routers/ddd_brain.py:337 — ddd_brain._section_members has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 2 (4 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 · settings._list_bedrock_inference_profiles (cognitive 22) · ×1
  • settings._list_bedrock_inference_profiles (cognitive 22) backend/routers/settings.py:169 — settings._list_bedrock_inference_profiles has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (15 pts), boolean chains 3, loops 2 (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 · workspace_api.put_workspace_file (cognitive 22) · ×1
  • workspace_api.put_workspace_file (cognitive 22) backend/routers/workspace_api.py:1822 — workspace_api.put_workspace_file has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (15 pts), error handling 3 (5 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workspace_api.rename_item (cognitive 22) · ×1
  • workspace_api.rename_item (cognitive 22) backend/routers/workspace_api.py:2175 — workspace_api.rename_item has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, error handling 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 · da_resummarize.shorten_sentences (cognitive 22) · ×1
  • da_resummarize.shorten_sentences (cognitive 22) backend/scripts/da_resummarize.py:535 — da_resummarize.shorten_sentences has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 6, loops 3 (4 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 · degeneration_dataset_eval.main (cognitive 22) · ×1
  • degeneration_dataset_eval.main (cognitive 22) backend/scripts/degeneration_dataset_eval.py:97 — degeneration_dataset_eval.main has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 6 (7 pts), boolean chains 2, ternaries 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 · golden_case_validator.main (cognitive 22) · ×1
  • golden_case_validator.main (cognitive 22) backend/scripts/golden_case_validator.py:549 — golden_case_validator.main has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 5 (8 pts), loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · meta_shape_migrate.main (cognitive 22) · ×1
  • meta_shape_migrate.main (cognitive 22) backend/scripts/meta_shape_migrate.py:146 — meta_shape_migrate.main has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 3, error handling 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 · update_convergence.append_to_convergence (cognitive 22) · ×1
  • update_convergence.append_to_convergence (cognitive 22) backend/scripts/update_convergence.py:179 — update_convergence.append_to_convergence has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cross_format_check.check_message_alignment (cognitive 22) · ×1
  • cross_format_check.check_message_alignment (cognitive 22) backend/skills/s_pollinate/scripts/cross_format_check.py:79 — cross_format_check.check_message_alignment has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (18 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cross_format_check.check_data_integrity (cognitive 22) · ×1
  • cross_format_check.check_data_integrity (cognitive 22) backend/skills/s_pollinate/scripts/cross_format_check.py:136 — cross_format_check.check_data_integrity has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 5 (9 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 · deck_notes_injector.main (cognitive 22) · ×1
  • deck_notes_injector.main (cognitive 22) backend/skills/s_pollinate/scripts/deck_notes_injector.py:264 — deck_notes_injector.main has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 2 (6 pts), ternaries 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 · format_recommend.main (cognitive 22) · ×1
  • format_recommend.main (cognitive 22) backend/skills/s_pollinate/scripts/format_recommend.py:502 — format_recommend.main has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 2 (5 pts), ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ai_ready_helpers._parse_git_log (cognitive 22) · ×1
  • ai_ready_helpers._parse_git_log (cognitive 22) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:174 — ai_ready_helpers._parse_git_log has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (19 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ai_ready_helpers.prioritized_file_list (cognitive 22) · ×1
  • ai_ready_helpers.prioritized_file_list (cognitive 22) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1364 — ai_ready_helpers.prioritized_file_list has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 3, error handling 2, loops 1 (2 pts), 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 · html2pptx.validateTextBoxPosition (cognitive 22) · ×1
  • html2pptx.validateTextBoxPosition (cognitive 22) backend/skills/s_pptx/scripts/html2pptx.js:88 — html2pptx.validateTextBoxPosition has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (17 pts), boolean chains 4, loops 1 (nesting depth added 12). Most of this is not in the body itself: 8 of the 22 points are its own statements and the rest belongs to one function item inside it that branches (getText). 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 · useHealthMonitor.useHealthMonitor.handleFailure (cognitive 22) · ×1
  • useHealthMonitor.useHealthMonitor.handleFailure (cognitive 22) desktop/src/hooks/useHealthMonitor.ts:237 — useHealthMonitor.useHealthMonitor.handleFailure has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 2 (6 pts), boolean chains 1 (nesting depth added 12). Of this number, 21 points are the body's own statements and 1 belongs to one function literal 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 · CdfFlowDetails.CdfFlowDetails (cognitive 22) · ×1
  • CdfFlowDetails.CdfFlowDetails (cognitive 22) desktop/src/components/layout/CdfFlowDetails.tsx:29 — CdfFlowDetails.CdfFlowDetails has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 11, ternaries 6 (8 pts), if/else 1 (2 pts), loops 1 (nesting depth added 3). Of this number, 12 points are the body's own statements and 10 belong to 2 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CommunityOverlay.SourcesTab (cognitive 22) · ×1
  • CommunityOverlay.SourcesTab (cognitive 22) desktop/src/components/layout/CommunityOverlay.tsx:230 — CommunityOverlay.SourcesTab has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 10 (15 pts), boolean chains 5, error handling 1, if/else 1 (nesting depth added 5). Most of this is not in the body itself: 3 of the 22 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 280, 243, 248, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · UsageView.Top (cognitive 22) · ×1
  • UsageView.Top (cognitive 22) desktop/src/components/usage/UsageView.tsx:244 — UsageView.Top has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 7, ternaries 4 (7 pts), if/else 5 (6 pts), error handling 1 (2 pts) (nesting depth added 5). Most of this is not in the body itself: 6 of the 22 points are its own statements and the rest belongs to 4 function items inside it that branch (open, a function literal at line 253, a function literal at line 289, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · FileEditorCore.DiffView (cognitive 22) · ×1
  • FileEditorCore.DiffView (cognitive 22) desktop/src/components/common/FileEditorCore.tsx:457 — FileEditorCore.DiffView has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 10, ternaries 8 (9 pts), if/else 3 (nesting depth added 1). Most of this is not in the body itself: 5 of the 22 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 495, 478, 560). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · turnControls.decidePermission (cognitive 22) · ×1
  • turnControls.decidePermission (cognitive 22) desktop/src/pages/chat/turnControls.ts:485 — turnControls.decidePermission has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 6, ternaries 2 (nesting depth added 2). Of this number, 17 points are the body's own statements and 5 belong to 4 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SlackChannelAdapter._normalize_event (cognitive 21) · ×1
  • SlackChannelAdapter._normalize_event (cognitive 21) REDACTED:587 — SlackChannelAdapter._normalize_event has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 6, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelGateway._retry_loop (cognitive 21) · ×1
  • ChannelGateway._retry_loop (cognitive 21) backend/channels/gateway.py:1054 — ChannelGateway._retry_loop has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), error handling 2 (4 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HumanResponseFormatter._split_on_boundaries (cognitive 21) · ×1
  • HumanResponseFormatter._split_on_boundaries (cognitive 21) backend/channels/response_formatter.py:54 — HumanResponseFormatter._split_on_boundaries has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 4, 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 · streaming.cleanup_stream (cognitive 21) · ×1
  • streaming.cleanup_stream (cognitive 21) backend/channels/streaming.py:407 — streaming.cleanup_stream has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (12 pts), error handling 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 · aws_signin.prune (cognitive 21) · ×1
  • aws_signin.prune (cognitive 21) backend/core/aws_signin.py:366 — aws_signin.prune has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5, 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 · commands._gitlab_ci (cognitive 21) · ×1
  • commands._gitlab_ci (cognitive 21) backend/core/brain_bootstrap/commands.py:77 — commands._gitlab_ci has cognitive complexity 21 (threshold 15). Drivers by points: if/else 2 (6 pts), loops 3 (6 pts), boolean chains 5, ternaries 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · repo_read.list_files (cognitive 21) · ×1
  • repo_read.list_files (cognitive 21) backend/core/brain_bootstrap/repo_read.py:171 — repo_read.list_files has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (5 pts), ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · brain_eval.used (cognitive 21) · ×1
  • brain_eval.used (cognitive 21) backend/core/brain_eval.py:254 — brain_eval.used has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 5 (7 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 · code_intel.load_project_graphs (cognitive 21) · ×1
  • code_intel.load_project_graphs (cognitive 21) backend/core/code_intel/__init__.py:117 — code_intel.load_project_graphs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 3 (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 · coe_threads._registry_baseline (cognitive 21) · ×1
  • coe_threads._registry_baseline (cognitive 21) backend/core/coe_threads.py:61 — coe_threads._registry_baseline has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 5 (13 pts), if/else 5 (7 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 · cognition.library_get (cognitive 21) · ×1
  • cognition.library_get (cognitive 21) backend/core/cognition.py:461 — cognition.library_get has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, 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 · context_injector._format_recent_turns (cognitive 21) · ×1
  • context_injector._format_recent_turns (cognitive 21) backend/core/context_injector.py:965 — context_injector._format_recent_turns has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, ternaries 1 (2 pts), 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 · credential_patterns._url_credential_spans (cognitive 21) · ×1
  • credential_patterns._url_credential_spans (cognitive 21) backend/core/credential_patterns.py:158 — credential_patterns._url_credential_spans has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, loops 3 (4 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 · ddd_entry_lifecycle.classify_entry_type (cognitive 21) · ×1
  • ddd_entry_lifecycle.classify_entry_type (cognitive 21) backend/core/ddd_entry_lifecycle.py:449 — ddd_entry_lifecycle.classify_entry_type has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 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 · gaps._close_declared (cognitive 21) · ×1
  • gaps._close_declared (cognitive 21) backend/core/ingestion/gaps.py:275 — gaps._close_declared has cognitive complexity 21 (threshold 15). Drivers by points: if/else 2 (6 pts), ternaries 4 (5 pts), boolean chains 4, error handling 1 (3 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 · governed_edit.withdraw (cognitive 21) · ×1
  • governed_edit.withdraw (cognitive 21) backend/core/ingestion/governed_edit.py:619 — governed_edit.withdraw has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 6, error handling 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.
D2 · Cognitive Complexity · queries.list_items (cognitive 21) · ×1
  • queries.list_items (cognitive 21) backend/core/ingestion/queries.py:185 — queries.list_items has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 8, ternaries 4 (8 pts), if/else 2 (3 pts), loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · standing._evidence (cognitive 21) · ×1
  • standing._evidence (cognitive 21) backend/core/ingestion/standing.py:87 — standing._evidence has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 4 (7 pts), error handling 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 · base_tree.extract (cognitive 21) · ×1
  • base_tree.extract (cognitive 21) backend/core/run_protocol/base_tree.py:50 — base_tree.extract has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 3, error handling 2 (3 pts), 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.
D2 · Cognitive Complexity · RunEngine._fix_diffs (cognitive 21) · ×1
  • RunEngine._fix_diffs (cognitive 21) backend/core/run_protocol/engine.py:1505 — RunEngine._fix_diffs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 4, error handling 1 (3 pts), loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RunEngine._sync_moved_bases (cognitive 21) · ×1
  • RunEngine._sync_moved_bases (cognitive 21) backend/core/run_protocol/engine.py:3697 — RunEngine._sync_moved_bases has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 2 (6 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 · facts.resolve_refs (cognitive 21) · ×1
  • facts.resolve_refs (cognitive 21) backend/core/run_protocol/facts.py:60 — facts.resolve_refs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 4, ternaries 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReviewOrchestrator.handout_spec (cognitive 21) · ×1
  • ReviewOrchestrator.handout_spec (cognitive 21) backend/core/run_protocol/review.py:704 — ReviewOrchestrator.handout_spec has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · run_knowledge.build (cognitive 21) · ×1
  • run_knowledge.build (cognitive 21) backend/core/run_protocol/run_knowledge.py:217 — run_knowledge.build has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, ternaries 3 (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 · validation_report._one (cognitive 21) · ×1
  • validation_report._one (cognitive 21) backend/core/run_protocol/validation_report.py:57 — validation_report._one has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (16 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 · security_hooks._gh_api_writes (cognitive 21) · ×1
  • security_hooks._gh_api_writes (cognitive 21) backend/core/security_hooks.py:673 — security_hooks._gh_api_writes has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, ternaries 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · security_hooks._commit_dirs (cognitive 21) · ×1
  • security_hooks._commit_dirs (cognitive 21) backend/core/security_hooks.py:3335 — security_hooks._commit_dirs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 5, loops 2 (3 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · security_hooks._gate_shell_segments (cognitive 21) · ×1
  • security_hooks._gate_shell_segments (cognitive 21) backend/core/security_hooks.py:4048 — security_hooks._gate_shell_segments has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (17 pts), boolean chains 2, error handling 1, loops 1 (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 · security_hooks._audit_cmd_names_path (cognitive 21) · ×1
  • security_hooks._audit_cmd_names_path (cognitive 21) backend/core/security_hooks.py:5510 — security_hooks._audit_cmd_names_path 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 · security_hooks._audit_code_hit (cognitive 21) · ×1
  • security_hooks._audit_code_hit (cognitive 21) backend/core/security_hooks.py:5812 — security_hooks._audit_code_hit has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · session_router._maybe_followup_recall (cognitive 21) · ×1
  • session_router._maybe_followup_recall (cognitive 21) backend/core/session_router.py:1264 — session_router._maybe_followup_recall has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 8, if/else 7, error handling 3, 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 · skill_manager.parse_skill_md (cognitive 21) · ×1
  • skill_manager.parse_skill_md (cognitive 21) backend/core/skill_manager.py:213 — skill_manager.parse_skill_md has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 11, if/else 8 (9 pts), 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 · subagent_transcript.read_prompt_head (cognitive 21) · ×1
  • subagent_transcript.read_prompt_head (cognitive 21) backend/core/subagent_transcript.py:26 — subagent_transcript.read_prompt_head has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 2 (3 pts), ternaries 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 · SummarizationPipeline._extract_open_questions (cognitive 21) · ×1
  • SummarizationPipeline._extract_open_questions (cognitive 21) backend/core/summarization.py:525 — SummarizationPipeline._extract_open_questions has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (17 pts), loops 2 (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 · swarm_out.run_state (cognitive 21) · ×1
  • swarm_out.run_state (cognitive 21) backend/core/swarm_out.py:1450 — swarm_out.run_state has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13, boolean chains 4, 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 · DecisionMirror._read (cognitive 21) · ×1
  • DecisionMirror._read (cognitive 21) backend/core/swarm_out_decisions.py:225 — DecisionMirror._read has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 5, 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 · swarm_out_results._usage (cognitive 21) · ×1
  • swarm_out_results._usage (cognitive 21) backend/core/swarm_out_results.py:1199 — swarm_out_results._usage has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 13, ternaries 3 (4 pts), if/else 3, 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 · swarm_out_wait_card._mapped (cognitive 21) · ×1
  • swarm_out_wait_card._mapped (cognitive 21) backend/core/swarm_out_wait_card.py:315 — swarm_out_wait_card._mapped has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 6, loops 1 (2 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · swarm_run.check_child_dispatch (cognitive 21) · ×1
  • swarm_run.check_child_dispatch (cognitive 21) backend/core/swarm_run.py:142 — swarm_run.check_child_dispatch has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13, boolean chains 7, 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 · symlink_target_guard._ln_destination (cognitive 21) · ×1
  • symlink_target_guard._ln_destination (cognitive 21) backend/core/symlink_target_guard.py:53 — symlink_target_guard._ln_destination has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 4, loops 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ContextHealthHook._resume_daily_canary (cognitive 21) · ×1
  • ContextHealthHook._resume_daily_canary (cognitive 21) backend/hooks/context_health_hook.py:499 — ContextHealthHook._resume_daily_canary has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 2, 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 · github_releases.fetch_github_releases (cognitive 21) · ×1
  • github_releases.fetch_github_releases (cognitive 21) backend/jobs/adapters/github_releases.py:48 — github_releases.fetch_github_releases has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (3 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · bedrock.converse_with_retry (cognitive 21) · ×1
  • bedrock.converse_with_retry (cognitive 21) backend/jobs/bedrock.py:380 — bedrock.converse_with_retry has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 2 (5 pts), loops 2 (3 pts), boolean chains 2, 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 · executor._handle_script (cognitive 21) · ×1
  • executor._handle_script (cognitive 21) REDACTED:1027 — executor._handle_script has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, ternaries 3 (4 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 · self_tune.extract_projects (cognitive 21) · ×1
  • self_tune.extract_projects (cognitive 21) backend/jobs/self_tune.py:61 — self_tune.extract_projects has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 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 · cdf_batch_eval.sample (cognitive 21) · ×1
  • cdf_batch_eval.sample (cognitive 21) backend/scripts/cdf_batch_eval.py:86 — cdf_batch_eval.sample has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 4 (11 pts), boolean chains 5, loops 3 (4 pts), if/else 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 · eval_runner.compare_repeats (cognitive 21) · ×1
  • eval_runner.compare_repeats (cognitive 21) backend/scripts/eval_runner.py:2498 — eval_runner.compare_repeats has cognitive complexity 21 (threshold 15). Drivers by points: loops 6 (9 pts), if/else 3 (8 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 · scenario_runner.parse_trajectory (cognitive 21) · ×1
  • scenario_runner.parse_trajectory (cognitive 21) backend/scripts/scenario_runner.py:72 — scenario_runner.parse_trajectory has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 2 (6 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · shipped_skills.shipped_files (cognitive 21) · ×1
  • shipped_skills.shipped_files (cognitive 21) backend/scripts/shipped_skills.py:49 — shipped_skills.shipped_files has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (7 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · design_system._generate_intelligent_overrides (cognitive 21) · ×1
  • design_system._generate_intelligent_overrides (cognitive 21) backend/skills/s_frontend-design/scripts/design_system.py:995 — design_system._generate_intelligent_overrides has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (19 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 · todo_db._build_linked_context (cognitive 21) · ×1
  • todo_db._build_linked_context (cognitive 21) backend/skills/s_radar-todo/scripts/todo_db.py:74 — todo_db._build_linked_context has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 10, if/else 10, 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 · MessageStore._mergePreservingInteractive (cognitive 21) · ×1
  • MessageStore._mergePreservingInteractive (cognitive 21) desktop/src/stores/MessageStore.ts:869 — MessageStore._mergePreservingInteractive has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 7, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 6). Of this number, 16 points are the body's own statements and 5 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 · turnView.toolCall (cognitive 21) · ×1
  • turnView.toolCall (cognitive 21) REDACTED:993 — turnView.toolCall has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (7 pts), boolean chains 5 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UserMessageView.UserMessageView (cognitive 21) · ×1
  • UserMessageView.UserMessageView (cognitive 21) desktop/src/pages/chat/components/UserMessageView.tsx:55 — UserMessageView.UserMessageView has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 12, if/else 5, ternaries 3 (4 pts) (nesting depth added 1). Of this number, 17 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · HistoryOverlay.HistoryContent (cognitive 21) · ×1
  • HistoryOverlay.HistoryContent (cognitive 21) desktop/src/components/layout/HistoryOverlay.tsx:60 — HistoryOverlay.HistoryContent has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 4 (7 pts), error handling 2 (nesting depth added 5). Most of this is not in the body itself: 6 of the 21 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 89, a function literal at line 115, a function literal at line 136, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · CdfUnitFeed.DecisionLine (cognitive 21) · ×1
  • CdfUnitFeed.DecisionLine (cognitive 21) desktop/src/components/layout/CdfUnitFeed.tsx:148 — CdfUnitFeed.DecisionLine has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 7 (16 pts), boolean chains 4, if/else 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 · BrainMapView.EvalPanel (cognitive 21) · ×1
  • BrainMapView.EvalPanel (cognitive 21) desktop/src/components/layout/BrainMapView.tsx:459 — BrainMapView.EvalPanel has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 9 (13 pts), boolean chains 6, if/else 2 (nesting depth added 4). Of this number, 20 points are the body's own statements and 1 belongs to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileViewer.FileViewerImpl · ×1
  • FileViewer.FileViewerImpl::renderActiveContent (cognitive 21) desktop/src/components/file-viewer/FileViewer.tsx:760 — FileViewer.FileViewerImpl::renderActiveContent has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 12, if/else 6, 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 · useVoiceRecorder.useVoiceRecorder.startRecording (cognitive 21) · ×1
  • useVoiceRecorder.useVoiceRecorder.startRecording (cognitive 21) desktop/src/hooks/useVoiceRecorder.ts:99 — useVoiceRecorder.useVoiceRecorder.startRecording has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 3 (6 pts), boolean chains 4, 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 · HistoryView.HistoryRow (cognitive 21) · ×1
  • HistoryView.HistoryRow (cognitive 21) desktop/src/components/swarm-out/HistoryView.tsx:248 — HistoryView.HistoryRow has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 15 (17 pts), boolean chains 3, if/else 1 (nesting depth added 2). Of this number, 18 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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 · project-agent-delivery-os-vp.html.renderFrame (cognitive 21) · ×1
  • project-agent-delivery-os-vp.html.renderFrame (cognitive 21) docs/design/project-agent-delivery-os-vp.html:690 — project-agent-delivery-os-vp.html.renderFrame has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 3 (6 pts), boolean chains 1 (nesting depth added 8). Of this number, 13 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · waitForReplyComplete (cognitive 21) · ×1
  • waitForReplyComplete (cognitive 21) backend/skills/s_browser-agent/wait-engine.mjs:144 — waitForReplyComplete has cognitive complexity 21 (threshold 15). Drivers by points: error handling 4 (8 pts), boolean chains 6, if/else 5, other 2 (nesting depth added 4). Of this number, 16 points are the body's own statements and 5 belong to 15 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 · app_manifest._declared_files (cognitive 20) · ×1
  • app_manifest._declared_files (cognitive 20) backend/core/app_manifest.py:216 — app_manifest._declared_files has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (5 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 · BackupManager._restore_impl (cognitive 20) · ×1
  • BackupManager._restore_impl (cognitive 20) backend/core/backup_manager.py:523 — BackupManager._restore_impl has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 4 (5 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 · brain_eval.health (cognitive 20) · ×1
  • brain_eval.health (cognitive 20) backend/core/brain_eval.py:158 — brain_eval.health has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 4 (5 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 · brain_knowledge._withdrawn (cognitive 20) · ×1
  • brain_knowledge._withdrawn (cognitive 20) backend/core/brain_knowledge.py:236 — brain_knowledge._withdrawn has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 7, if/else 4 (6 pts), ternaries 2 (4 pts), error handling 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · code_intel.resolve_router_prefixes (cognitive 20) · ×1
  • code_intel.resolve_router_prefixes (cognitive 20) backend/core/code_intel/__init__.py:214 — code_intel.resolve_router_prefixes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 3 (5 pts), boolean chains 2, loops 2, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GraphStore._migrate_schema (cognitive 20) · ×1
  • GraphStore._migrate_schema (cognitive 20) backend/core/code_intel/graph_store.py:412 — GraphStore._migrate_schema has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (7 pts), error handling 3 (5 pts), boolean chains 4, loops 1 (3 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 · impact.impact (cognitive 20) · ×1
  • impact.impact (cognitive 20) backend/core/code_intel/impact.py:148 — impact.impact has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, 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 · cognition._h3_units (cognitive 20) · ×1
  • cognition._h3_units (cognitive 20) backend/core/cognition.py:139 — cognition._h3_units has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 5, ternaries 2 (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 · context_injector._format_message (cognitive 20) · ×1
  • context_injector._format_message (cognitive 20) backend/core/context_injector.py:145 — context_injector._format_message has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 1, error handling 1, loops 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ddd_format.dangling_references (cognitive 20) · ×1
  • ddd_format.dangling_references (cognitive 20) backend/core/ddd_format.py:494 — ddd_format.dangling_references has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (6 pts), error handling 2, boolean chains 1, ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ddd_skill_registry.build_manifest (cognitive 20) · ×1
  • ddd_skill_registry.build_manifest (cognitive 20) backend/core/ddd_skill_registry.py:177 — ddd_skill_registry.build_manifest has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (6 pts), error handling 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 · engine_metrics.collect_memory_effectiveness (cognitive 20) · ×1
  • engine_metrics.collect_memory_effectiveness (cognitive 20) backend/core/engine_metrics.py:42 — engine_metrics.collect_memory_effectiveness has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, 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 · EvalService.get_session_quality (cognitive 20) · ×1
  • EvalService.get_session_quality (cognitive 20) backend/core/eval_service.py:452 — EvalService.get_session_quality has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, ternaries 6, if/else 3 (4 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 · hive_boot._ended_at (cognitive 20) · ×1
  • hive_boot._ended_at (cognitive 20) backend/core/hive_boot.py:105 — hive_boot._ended_at has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 3 (7 pts), if/else 3 (5 pts), error handling 1 (4 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 · store._create (cognitive 20) · ×1
  • store._create (cognitive 20) backend/core/ingestion/store.py:319 — store._create has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 2 (3 pts), boolean chains 2, 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 · LifecycleManager._check_ttl (cognitive 20) · ×1
  • LifecycleManager._check_ttl (cognitive 20) backend/core/lifecycle_manager.py:983 — LifecycleManager._check_ttl has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (18 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 · MemoryGuard.scan (cognitive 20) · ×1
  • MemoryGuard.scan (cognitive 20) backend/core/memory_guard.py:237 — MemoryGuard.scan has cognitive complexity 20 (threshold 15). Drivers by points: loops 9 (14 pts), ternaries 1 (3 pts), if/else 2, 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 · project_agent_draft._declared (cognitive 20) · ×1
  • project_agent_draft._declared (cognitive 20) backend/core/project_agent_draft.py:258 — project_agent_draft._declared has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 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 · answers._finding (cognitive 20) · ×1
  • answers._finding (cognitive 20) backend/core/run_protocol/answers.py:82 — answers._finding has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11, boolean chains 9. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · RunEngine._prepare_land_request (cognitive 20) · ×1
  • RunEngine._prepare_land_request (cognitive 20) backend/core/run_protocol/engine.py:2102 — RunEngine._prepare_land_request has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 6 (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 · lifecycle._partial_land (cognitive 20) · ×1
  • lifecycle._partial_land (cognitive 20) backend/core/run_protocol/lifecycle.py:654 — lifecycle._partial_land has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, if/else 6 (7 pts), ternaries 1 (2 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · schemas._consumers (cognitive 20) · ×1
  • schemas._consumers (cognitive 20) backend/core/run_protocol/schemas.py:398 — schemas._consumers has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 5, loops 3 (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 · run_worktree.repo_for_write (cognitive 20) · ×1
  • run_worktree.repo_for_write (cognitive 20) backend/core/run_worktree.py:1687 — run_worktree.repo_for_write has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 3, error handling 2 (3 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · security_hooks._command_as_run (cognitive 20) · ×1
  • security_hooks._command_as_run (cognitive 20) backend/core/security_hooks.py:1982 — security_hooks._command_as_run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 3 (7 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 · security_hooks._shell_reads_stdin (cognitive 20) · ×1
  • security_hooks._shell_reads_stdin (cognitive 20) backend/core/security_hooks.py:4780 — security_hooks._shell_reads_stdin has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 5, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · security_hooks._stdin_bodies (cognitive 20) · ×1
  • security_hooks._stdin_bodies (cognitive 20) backend/core/security_hooks.py:4874 — security_hooks._stdin_bodies has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (6 pts), ternaries 1 (4 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 · SessionUnit._check_mcp_health (cognitive 20) · ×1
  • SessionUnit._check_mcp_health (cognitive 20) backend/core/session_unit.py:3739 — SessionUnit._check_mcp_health has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 2, error handling 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 · SessionUnit._force_kill (cognitive 20) · ×1
  • SessionUnit._force_kill (cognitive 20) backend/core/session_unit.py:5102 — SessionUnit._force_kill has cognitive complexity 20 (threshold 15). Drivers by points: error handling 6 (14 pts), if/else 5 (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 · skill_listing._plugin_skill_dirs (cognitive 20) · ×1
  • skill_listing._plugin_skill_dirs (cognitive 20) backend/core/skill_listing.py:100 — skill_listing._plugin_skill_dirs has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 4 (7 pts), loops 2 (3 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 · SummarizationPipeline._format_conversation_for_llm (cognitive 20) · ×1
  • SummarizationPipeline._format_conversation_for_llm (cognitive 20) backend/core/summarization.py:710 — SummarizationPipeline._format_conversation_for_llm has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (4 pts), ternaries 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 · swarm_out_bridge._ask_record (cognitive 20) · ×1
  • swarm_out_bridge._ask_record (cognitive 20) REDACTED:171 — swarm_out_bridge._ask_record has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 3 (6 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 · swarm_out_card.card (cognitive 20) · ×1
  • swarm_out_card.card (cognitive 20) backend/core/swarm_out_card.py:205 — swarm_out_card.card has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · swarm_out_record.observed (cognitive 20) · ×1
  • swarm_out_record.observed (cognitive 20) backend/core/swarm_out_record.py:116 — swarm_out_record.observed has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5, 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 · ToDoManager.update (cognitive 20) · ×1
  • ToDoManager.update (cognitive 20) backend/core/todo_manager.py:338 — ToDoManager.update has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (16 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 · TurnChanges._finish (cognitive 20) · ×1
  • TurnChanges._finish (cognitive 20) backend/core/turn_changes.py:503 — TurnChanges._finish has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 pts), error handling 1 (2 pts), loops 2, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · turn_products.remote_action (cognitive 20) · ×1
  • turn_products.remote_action (cognitive 20) backend/core/turn_products.py:104 — turn_products.remote_action has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 3, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · executor._send_slack_dm (cognitive 20) · ×1
  • executor._send_slack_dm (cognitive 20) REDACTED:1528 — executor._send_slack_dm has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10, boolean chains 4, error handling 3 (4 pts), ternaries 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · brain_mistake_audit._render (cognitive 20) · ×1
  • brain_mistake_audit._render (cognitive 20) backend/jobs/handlers/brain_mistake_audit.py:573 — brain_mistake_audit._render has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 4 (8 pts), boolean chains 6, loops 3 (4 pts), if/else 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 · pipelines._acceptance (cognitive 20) · ×1
  • pipelines._acceptance (cognitive 20) backend/routers/pipelines.py:558 — pipelines._acceptance has cognitive complexity 20 (threshold 15). Drivers by points: if/else 2 (6 pts), ternaries 3 (6 pts), boolean chains 4, loops 2 (3 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workspace_api._get_git_status (cognitive 20) · ×1
  • workspace_api._get_git_status (cognitive 20) backend/routers/workspace_api.py:300 — workspace_api._get_git_status has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 6, error handling 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 · cdf_batch_eval.score (cognitive 20) · ×1
  • cdf_batch_eval.score (cognitive 20) backend/scripts/cdf_batch_eval.py:373 — cdf_batch_eval.score has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10, boolean chains 7, ternaries 3. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · check_migration_class.validate_enumeration_cmd (cognitive 20) · ×1
  • check_migration_class.validate_enumeration_cmd (cognitive 20) backend/scripts/check_migration_class.py:78 — check_migration_class.validate_enumeration_cmd has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 1 (3 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 · eval_runner.run_eval (cognitive 20) · ×1
  • eval_runner.run_eval (cognitive 20) backend/scripts/eval_runner.py:2122 — eval_runner.run_eval has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, ternaries 2 (3 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · migrate_followups_to_todos.repositories (cognitive 20) · ×1
  • migrate_followups_to_todos.repositories (cognitive 20) backend/scripts/migrate_followups_to_todos.py:277 — migrate_followups_to_todos.repositories has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 3 (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 · recall_replay._replay_session (cognitive 20) · ×1
  • recall_replay._replay_session (cognitive 20) backend/scripts/recall_replay.py:191 — recall_replay._replay_session has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 7, ternaries 2 (5 pts), error handling 1 (3 pts), loops 2 (3 pts), if/else 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 · stamp_golden_cases.stamp_all (cognitive 20) · ×1
  • stamp_golden_cases.stamp_all (cognitive 20) backend/scripts/stamp_golden_cases.py:32 — stamp_golden_cases.stamp_all has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), error handling 1 (2 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 · scan._load_routing (cognitive 20) · ×1
  • scan._load_routing (cognitive 20) backend/skills/s_context-hygiene/scripts/scan.py:81 — scan._load_routing has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 4 (6 pts), ternaries 2 (6 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 · DocxXMLEditor._inject_attributes_to_nodes (cognitive 20) · ×1
  • DocxXMLEditor._inject_attributes_to_nodes (cognitive 20) backend/skills/s_docx/scripts/document.py:116 — DocxXMLEditor._inject_attributes_to_nodes has cognitive complexity 20 (threshold 15). Drivers by points: loops 8 (16 pts), if/else 2 (4 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · verify_ddd_complete._check_knowledge (cognitive 20) · ×1
  • verify_ddd_complete._check_knowledge (cognitive 20) backend/skills/s_project-manager/scripts/verify_ddd_complete.py:239 — verify_ddd_complete._check_knowledge has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (10 pts), loops 3 (4 pts), error handling 2 (3 pts), ternaries 1 (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 · AttachedFileChips.AttachedFileChips (cognitive 20) · ×1
  • AttachedFileChips.AttachedFileChips (cognitive 20) desktop/src/components/chat/AttachedFileChips.tsx:176 — AttachedFileChips.AttachedFileChips has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4, match/switch 1, ternaries 1 (nesting depth added 5). Most of this is not in the body itself: 2 of the 20 points are its own statements and the rest belongs to 6 function items inside it that branch (handleContainerKeyDown, a function literal at line 200, handleContainerFocus, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · TurnCards.RunLine (cognitive 20) · ×1
  • TurnCards.RunLine (cognitive 20) desktop/src/pages/chat/components/TurnCards.tsx:175 — TurnCards.RunLine has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, ternaries 7 (10 pts) (nesting depth added 3). Of this number, 18 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · TurnZones.PhaseBody (cognitive 20) · ×1
  • TurnZones.PhaseBody (cognitive 20) desktop/src/pages/chat/components/TurnZones.tsx:771 — TurnZones.PhaseBody has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 7, ternaries 4, loops 1 (nesting depth added 1). Most of this is not in the body itself: 4 of the 20 points are its own statements and the rest belongs to 7 function items inside it that branch (renderItems, renderItems::columnRow, a function literal at line 820, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · CompactNotice.CompactChipImpl (cognitive 20) · ×1
  • CompactNotice.CompactChipImpl (cognitive 20) desktop/src/pages/chat/components/CompactNotice.tsx:125 — CompactNotice.CompactChipImpl has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 8, 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 · HiveBrains.HiveBrains (cognitive 20) · ×1
  • HiveBrains.HiveBrains (cognitive 20) desktop/src/components/settings/HiveBrains.tsx:58 — HiveBrains.HiveBrains has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 12, if/else 6, error handling 1, loops 1. Of this number, 13 points are the body's own statements and 7 belong to 4 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · JudgesTab.JudgesTab (cognitive 20) · ×1
  • JudgesTab.JudgesTab (cognitive 20) desktop/src/pages/eval/JudgesTab.tsx:10 — JudgesTab.JudgesTab has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 10, boolean chains 8, if/else 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 · ConnectAccount.SsoPick (cognitive 20) · ×1
  • ConnectAccount.SsoPick (cognitive 20) desktop/src/components/awsAccount/ConnectAccount.tsx:783 — ConnectAccount.SsoPick has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 10, boolean chains 9, if/else 1. Of this number, 12 points are the body's own statements and 8 belong to 4 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CanvasOutputRail.OutputRow (cognitive 20) · ×1
  • CanvasOutputRail.OutputRow (cognitive 20) desktop/src/components/file-viewer/CanvasOutputRail.tsx:72 — CanvasOutputRail.OutputRow has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 10 (12 pts), boolean chains 6, if/else 2 (nesting depth added 2). Of this number, 18 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · decks.list_decks (cognitive 19) · ×1
  • decks.list_decks (cognitive 19) backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/decks.py:267 — decks.list_decks has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (4 pts), error handling 2 (3 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 · engine_source._swap_in (cognitive 19) · ×1
  • engine_source._swap_in (cognitive 19) backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/engine_source.py:458 — engine_source._swap_in has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 3 (6 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pdftoppm_shim.main (cognitive 19) · ×1
  • pdftoppm_shim.main (cognitive 19) backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/pdftoppm_shim.py:95 — pdftoppm_shim.main has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (7 pts), error handling 6, ternaries 3, loops 2, 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 · aws_account._ada_creds (cognitive 19) · ×1
  • aws_account._ada_creds (cognitive 19) backend/core/aws_account.py:287 — aws_account._ada_creds has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (6 pts), error handling 3, ternaries 1 (2 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 · Evidence.check (cognitive 19) · ×1
  • Evidence.check (cognitive 19) backend/core/brain_bootstrap/apply.py:148 — Evidence.check has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 3, error handling 1 (2 pts), ternaries 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · apply.entry_contract (cognitive 19) · ×1
  • apply.entry_contract (cognitive 19) backend/core/brain_bootstrap/apply.py:295 — apply.entry_contract has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 3 (4 pts), loops 2 (3 pts), boolean chains 2, error handling 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 · docs._signals (cognitive 19) · ×1
  • docs._signals (cognitive 19) backend/core/brain_bootstrap/docs.py:186 — docs._signals has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3, 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 · packages.detect_packages (cognitive 19) · ×1
  • packages.detect_packages (cognitive 19) backend/core/brain_bootstrap/packages.py:169 — packages.detect_packages has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 3 (4 pts), ternaries 2 (4 pts), error handling 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 · brain_sync.unpack (cognitive 19) · ×1
  • brain_sync.unpack (cognitive 19) backend/core/brain_sync.py:288 — brain_sync.unpack has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, error handling 2, ternaries 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · parser._callee_name (cognitive 19) · ×1
  • parser._callee_name (cognitive 19) backend/core/code_intel/parser.py:1725 — parser._callee_name has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (7 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cognition.render_hit (cognitive 19) · ×1
  • cognition.render_hit (cognitive 19) backend/core/cognition.py:644 — cognition.render_hit has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 4 (8 pts), boolean chains 7, if/else 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 · context_recall.recall_context (cognitive 19) · ×1
  • context_recall.recall_context (cognitive 19) backend/core/context_recall.py:186 — context_recall.recall_context has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 3, boolean chains 1, error handling 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 · ddd_entry_lifecycle.render_ddd_unit (cognitive 19) · ×1
  • ddd_entry_lifecycle.render_ddd_unit (cognitive 19) backend/core/ddd_entry_lifecycle.py:329 — ddd_entry_lifecycle.render_ddd_unit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4, 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 · ddd_format._blocks (cognitive 19) · ×1
  • ddd_format._blocks (cognitive 19) backend/core/ddd_format.py:106 — ddd_format._blocks has cognitive complexity 19 (threshold 15). Drivers by points: loops 4 (10 pts), boolean chains 3, if/else 2 (3 pts), ternaries 1 (3 pts) (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 · ddd_format._close_fences (cognitive 19) · ×1
  • ddd_format._close_fences (cognitive 19) backend/core/ddd_format.py:146 — ddd_format._close_fences has cognitive complexity 19 (threshold 15). Drivers by points: loops 5 (10 pts), boolean chains 6, if/else 2 (3 pts) (nesting depth added 6). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · file_change_classifier._sed_in_place_targets (cognitive 19) · ×1
  • file_change_classifier._sed_in_place_targets (cognitive 19) backend/core/file_change_classifier.py:237 — file_change_classifier._sed_in_place_targets has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 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 · hive_diagnostics._target (cognitive 19) · ×1
  • hive_diagnostics._target (cognitive 19) backend/core/hive_diagnostics.py:181 — hive_diagnostics._target has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7, boolean chains 6, error handling 3, 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 · hive_files.report_paths (cognitive 19) · ×1
  • hive_files.report_paths (cognitive 19) backend/core/hive_files.py:139 — hive_files.report_paths has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 3 (7 pts), loops 4 (6 pts), boolean chains 3, if/else 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 · contracts_v2.route_unit (cognitive 19) · ×1
  • contracts_v2.route_unit (cognitive 19) backend/core/ingestion/contracts_v2.py:568 — contracts_v2.route_unit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2, 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 · gaps.withdraw_ticked (cognitive 19) · ×1
  • gaps.withdraw_ticked (cognitive 19) backend/core/ingestion/gaps.py:200 — gaps.withdraw_ticked has cognitive complexity 19 (threshold 15). Drivers by points: if/else 2 (6 pts), error handling 2 (5 pts), ternaries 2 (4 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 · relations_v2._general_brain (cognitive 19) · ×1
  • relations_v2._general_brain (cognitive 19) backend/core/ingestion/relations_v2.py:87 — relations_v2._general_brain has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (6 pts), error handling 2 (5 pts), boolean chains 3, ternaries 1 (3 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 · extract_llm.unit_schema (cognitive 19) · ×1
  • extract_llm.unit_schema (cognitive 19) backend/core/ingestion/sources/extract_llm.py:140 — extract_llm.unit_schema has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · s1_user.submit_units (cognitive 19) · ×1
  • s1_user.submit_units (cognitive 19) backend/core/ingestion/sources/s1_user.py:46 — s1_user.submit_units has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 4 (5 pts), boolean chains 2, error handling 1 (2 pts), loops 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 · s2_session.windows (cognitive 19) · ×1
  • s2_session.windows (cognitive 19) backend/core/ingestion/sources/s2_session.py:35 — s2_session.windows has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · needs_human_review._bound_worktree_roots (cognitive 19) · ×1
  • needs_human_review._bound_worktree_roots (cognitive 19) backend/core/needs_human_review.py:248 — needs_human_review._bound_worktree_roots has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 2 (5 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pipeline_stage_events.summary_block (cognitive 19) · ×1
  • pipeline_stage_events.summary_block (cognitive 19) backend/core/pipeline_stage_events.py:478 — pipeline_stage_events.summary_block has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (11 pts), boolean chains 3, loops 2 (3 pts), if/else 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 · RunEngine.write_projection (cognitive 19) · ×1
  • RunEngine.write_projection (cognitive 19) backend/core/run_protocol/engine.py:1117 — RunEngine.write_projection has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, loops 2 (3 pts), 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 · engine.repair_stale_projections (cognitive 19) · ×1
  • engine.repair_stale_projections (cognitive 19) backend/core/run_protocol/engine.py:386 — engine.repair_stale_projections has cognitive complexity 19 (threshold 15). Drivers by points: error handling 5 (12 pts), if/else 2 (5 pts), 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 · reflect_library._insert (cognitive 19) · ×1
  • reflect_library._insert (cognitive 19) backend/core/run_protocol/reflect_library.py:137 — reflect_library._insert has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3 (5 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 · run_worktree.release (cognitive 19) · ×1
  • run_worktree.release (cognitive 19) backend/core/run_worktree.py:1334 — run_worktree.release has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, ternaries 2 (4 pts), error handling 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · security_hooks._foreign_uncommitted (cognitive 19) · ×1
  • security_hooks._foreign_uncommitted (cognitive 19) backend/core/security_hooks.py:1657 — security_hooks._foreign_uncommitted has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (4 pts), boolean chains 3, 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 · security_hooks._skip_leading_wrappers (cognitive 19) · ×1
  • security_hooks._skip_leading_wrappers (cognitive 19) backend/core/security_hooks.py:2774 — security_hooks._skip_leading_wrappers has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 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 · security_hooks._session_run_state (cognitive 19) · ×1
  • security_hooks._session_run_state (cognitive 19) backend/core/security_hooks.py:3963 — security_hooks._session_run_state has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 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 · security_hooks._audit_strip_wrappers (cognitive 19) · ×1
  • security_hooks._audit_strip_wrappers (cognitive 19) backend/core/security_hooks.py:5533 — security_hooks._audit_strip_wrappers has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 1 (4 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · security_hooks._audit_bash_hit (cognitive 19) · ×1
  • security_hooks._audit_bash_hit (cognitive 19) backend/core/security_hooks.py:5561 — security_hooks._audit_bash_hit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, 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 · session_events.parse_cursors (cognitive 19) · ×1
  • session_events.parse_cursors (cognitive 19) backend/core/session_events.py:506 — session_events.parse_cursors has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 5, error handling 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 · session_landings._scan (cognitive 19) · ×1
  • session_landings._scan (cognitive 19) backend/core/session_landings.py:131 — session_landings._scan has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, ternaries 2 (3 pts), error handling 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 · shared_checkout.sibling_uncommitted (cognitive 19) · ×1
  • shared_checkout.sibling_uncommitted (cognitive 19) backend/core/shared_checkout.py:111 — shared_checkout.sibling_uncommitted has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 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 · SkillManager._scan_ddd_tier (cognitive 19) · ×1
  • SkillManager._scan_ddd_tier (cognitive 19) backend/core/skill_manager.py:708 — SkillManager._scan_ddd_tier has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 4 (7 pts), loops 2, 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 · StreamingOrchestrator._subagent_progress_event (cognitive 19) · ×1
  • StreamingOrchestrator._subagent_progress_event (cognitive 19) backend/core/streaming_orchestrator.py:1047 — StreamingOrchestrator._subagent_progress_event has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · subagent_transcript.read_final_text (cognitive 19) · ×1
  • subagent_transcript.read_final_text (cognitive 19) backend/core/subagent_transcript.py:76 — subagent_transcript.read_final_text has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, error handling 2 (3 pts), 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 · swarm_out._clean_decision (cognitive 19) · ×1
  • swarm_out._clean_decision (cognitive 19) backend/core/swarm_out.py:1156 — swarm_out._clean_decision has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 7, if/else 5 (6 pts), ternaries 3 (5 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 · swarm_out_remote.match_route (cognitive 19) · ×1
  • swarm_out_remote.match_route (cognitive 19) backend/core/swarm_out_remote.py:110 — swarm_out_remote.match_route 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 · swarm_out_results._take_check_records (cognitive 19) · ×1
  • swarm_out_results._take_check_records (cognitive 19) backend/core/swarm_out_results.py:795 — swarm_out_results._take_check_records has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 6 (9 pts), boolean chains 4, if/else 3 (4 pts), error handling 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · swarm_out_settle._code (cognitive 19) · ×1
  • swarm_out_settle._code (cognitive 19) backend/core/swarm_out_settle.py:286 — swarm_out_settle._code has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, error handling 1 (3 pts), 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.
D2 · Cognitive Complexity · swarm_out_settle._files_here (cognitive 19) · ×1
  • swarm_out_settle._files_here (cognitive 19) backend/core/swarm_out_settle.py:324 — swarm_out_settle._files_here has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 4, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SQLiteMessagesTable.update_permission_decision (cognitive 19) · ×1
  • SQLiteMessagesTable.update_permission_decision (cognitive 19) backend/database/sqlite.py:865 — SQLiteMessagesTable.update_permission_decision has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (3 pts), error handling 1 (2 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. This shape REPEATS in the file: one other method here (SQLiteMessagesTable.update_question_answers) 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 · SQLiteMessagesTable.update_question_answers (cognitive 19) · ×1
  • SQLiteMessagesTable.update_question_answers (cognitive 19) backend/database/sqlite.py:936 — SQLiteMessagesTable.update_question_answers has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (3 pts), error handling 1 (2 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. This shape REPEATS in the file: one other method here (SQLiteMessagesTable.update_permission_decision) 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 · user_data.render_user_data (cognitive 19) · ×1
  • user_data.render_user_data (cognitive 19) backend/hive/user_data.py:442 — user_data.render_user_data has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 3 (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 · session_health_probe.run_session_health_probe (cognitive 19) · ×1
  • session_health_probe.run_session_health_probe (cognitive 19) REDACTED:201 — session_health_probe.run_session_health_probe has cognitive complexity 19 (threshold 15). Drivers by points: error handling 3 (7 pts), boolean chains 5, if/else 3 (4 pts), ternaries 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 · skill_proposer._gather_skill_context (cognitive 19) · ×1
  • skill_proposer._gather_skill_context (cognitive 19) backend/jobs/handlers/skill_proposer.py:218 — skill_proposer._gather_skill_context has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (4 pts), error handling 1 (2 pts), ternaries 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 · main.write_backend_json (cognitive 19) · ×1
  • main.write_backend_json (cognitive 19) backend/main.py:313 — main.write_backend_json has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), error handling 3 (8 pts), boolean chains 1 (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 · pipelines.pipeline_analytics (cognitive 19) · ×1
  • pipelines.pipeline_analytics (cognitive 19) backend/routers/pipelines.py:391 — pipelines.pipeline_analytics has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2, 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 · system.get_system_status (cognitive 19) · ×1
  • system.get_system_status (cognitive 19) backend/routers/system.py:164 — system.get_system_status has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 4 (7 pts), error handling 5, if/else 4, boolean chains 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 · system._verify_bedrock (cognitive 19) · ×1
  • system._verify_bedrock (cognitive 19) backend/routers/system.py:467 — system._verify_bedrock has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, 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 · workspace.write_file (cognitive 19) · ×1
  • workspace.write_file (cognitive 19) backend/routers/workspace.py:752 — workspace.write_file has cognitive complexity 19 (threshold 15). Drivers by points: error handling 7 (11 pts), if/else 7 (8 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 · workspace_api.get_workspace_file (cognitive 19) · ×1
  • workspace_api.get_workspace_file (cognitive 19) backend/routers/workspace_api.py:1093 — workspace_api.get_workspace_file has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 4, error handling 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 · cdf_rehearsal_replay._items (cognitive 19) · ×1
  • cdf_rehearsal_replay._items (cognitive 19) backend/scripts/cdf_rehearsal_replay.py:131 — cdf_rehearsal_replay._items has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (5 pts), ternaries 2 (4 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 · gate_audit.main (cognitive 19) · ×1
  • gate_audit.main (cognitive 19) backend/scripts/gate_audit.py:40 — gate_audit.main has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 5 (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 · memory_relocate.plan (cognitive 19) · ×1
  • memory_relocate.plan (cognitive 19) backend/scripts/memory_relocate.py:134 — memory_relocate.plan has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 4 (8 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 · migrate_skills.extract_first_docstring (cognitive 19) · ×1
  • migrate_skills.extract_first_docstring (cognitive 19) backend/scripts/migrate_skills.py:185 — migrate_skills.extract_first_docstring has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (4 pts), error handling 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 · tool_call_glitch_metrics.daily_metrics (cognitive 19) · ×1
  • tool_call_glitch_metrics.daily_metrics (cognitive 19) backend/scripts/tool_call_glitch_metrics.py:115 — tool_call_glitch_metrics.daily_metrics has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 4 (6 pts), 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 · design_system.format_markdown (cognitive 19) · ×1
  • design_system.format_markdown (cognitive 19) backend/skills/s_frontend-design/scripts/design_system.py:422 — design_system.format_markdown has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 2, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SelfLoopsHealthEngine._check_coherence (cognitive 19) · ×1
  • SelfLoopsHealthEngine._check_coherence (cognitive 19) backend/skills/s_loops-health/scripts/loops_health_check.py:416 — SelfLoopsHealthEngine._check_coherence has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 9 (11 pts), if/else 3 (4 pts), error handling 1 (3 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 · todo_db.cmd_update (cognitive 19) · ×1
  • todo_db.cmd_update (cognitive 19) backend/skills/s_radar-todo/scripts/todo_db.py:337 — todo_db.cmd_update has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 1 (2 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 · ai_ready_helpers._build_file_tree (cognitive 19) · ×1
  • ai_ready_helpers._build_file_tree (cognitive 19) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:291 — ai_ready_helpers._build_file_tree has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 1 (2 pts), boolean chains 1, 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 · ai_ready_helpers._language_mix (cognitive 19) · ×1
  • ai_ready_helpers._language_mix (cognitive 19) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1914 — ai_ready_helpers._language_mix has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 2 (3 pts), loops 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 · MarkdownRenderer.MermaidDiagram (cognitive 19) · ×1
  • MarkdownRenderer.MermaidDiagram (cognitive 19) REDACTED:284 — MarkdownRenderer.MermaidDiagram has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 4 (5 pts), error handling 2, boolean chains 1 (nesting depth added 2). Most of this is not in the body itself: 3 of the 19 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 336, handleDownloadPng, a function literal at line 297, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · useChatStreamingLifecycle.cleanupStalePendingEntries (cognitive 19) · ×1
  • useChatStreamingLifecycle.cleanupStalePendingEntries (cognitive 19) desktop/src/hooks/useChatStreamingLifecycle.ts:885 — useChatStreamingLifecycle.cleanupStalePendingEntries has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 3 (7 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 · runReview.sections (cognitive 19) · ×1
  • runReview.sections (cognitive 19) desktop/src/components/swarm-out/runReview.ts:154 — runReview.sections has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (6 pts), ternaries 2 (4 pts), loops 1 (nesting depth added 4). Of this number, 17 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 · LiveDispatches.LiveDispatches (cognitive 19) · ×1
  • LiveDispatches.LiveDispatches (cognitive 19) desktop/src/components/swarm-out/LiveDispatches.tsx:330 — LiveDispatches.LiveDispatches has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 9 (10 pts), boolean chains 9 (nesting depth added 1). Of this number, 16 points are the body's own statements and 3 belong to 3 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 · CdfHealth.CdfHealth (cognitive 19) · ×1
  • CdfHealth.CdfHealth (cognitive 19) desktop/src/components/layout/CdfHealth.tsx:85 — CdfHealth.CdfHealth has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 10 (11 pts), boolean chains 6, if/else 2 (nesting depth added 1). Of this number, 17 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · PollinateOverlay.InsightsView (cognitive 19) · ×1
  • PollinateOverlay.InsightsView (cognitive 19) desktop/src/components/layout/PollinateOverlay.tsx:692 — PollinateOverlay.InsightsView has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 4 (5 pts), boolean chains 2, ternaries 1 (nesting depth added 6). Most of this is not in the body itself: 5 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 694). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · CasesTab.RunMenu (cognitive 19) · ×1
  • CasesTab.RunMenu (cognitive 19) desktop/src/pages/eval/CasesTab.tsx:133 — CasesTab.RunMenu has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (11 pts), boolean chains 6, if/else 2 (nesting depth added 6). Of this number, 16 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OnboardingPage.StepRestore (cognitive 19) · ×1
  • OnboardingPage.StepRestore (cognitive 19) desktop/src/pages/OnboardingPage.tsx:512 — OnboardingPage.StepRestore has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7, error handling 1, loops 1 (nesting depth added 3). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 3 function items inside it that branch (handleRestore, a function literal at line 531, a function literal at line 622). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · SkillsPage.SkillsPage (cognitive 19) · ×1
  • SkillsPage.SkillsPage (cognitive 19) desktop/src/pages/SkillsPage.tsx:78 — SkillsPage.SkillsPage has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (7 pts), boolean chains 6, error handling 3, if/else 3 (nesting depth added 2). Most of this is not in the body itself: 5 of the 19 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 206, a function literal at line 111, handleDeleteConfirm, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · useStreamingActivity.useStreamingActivity (cognitive 19) · ×1
  • useStreamingActivity.useStreamingActivity (cognitive 19) desktop/src/hooks/useStreamingActivity.ts:37 — useStreamingActivity.useStreamingActivity has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 3 (nesting depth added 4). None of this is in the body itself: all 19 points belong to 4 function literals inside it that branch (lines 52, 118, 88, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ariaPerceive (cognitive 19) · ×1
  • ariaPerceive (cognitive 19) backend/skills/s_browser-agent/aria-perceive.mjs:110 — ariaPerceive has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 7, ternaries 3 (4 pts), if/else 2 (3 pts), loops 3, error handling 2 (nesting depth added 2). Of this number, 13 points are the body's own statements and 6 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · decks._index_compose_dir (cognitive 18) · ×1
  • decks._index_compose_dir (cognitive 18) backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/decks.py:344 — decks._index_compose_dir has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 1 (3 pts), boolean chains 1, 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 · SlackChannelAdapter.update_message (cognitive 18) · ×1
  • SlackChannelAdapter.update_message (cognitive 18) REDACTED:1209 — SlackChannelAdapter.update_message has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (7 pts), error handling 3 (5 pts), ternaries 2 (4 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 · streaming.handle_tool_use (cognitive 18) · ×1
  • streaming.handle_tool_use (cognitive 18) backend/channels/streaming.py:344 — streaming.handle_tool_use has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 2 (4 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 · AppConfigManager.set_secret (cognitive 18) · ×1
  • AppConfigManager.set_secret (cognitive 18) REDACTED:305 — AppConfigManager.set_secret has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 6 (7 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · aws_detect_worker.main (cognitive 18) · ×1
  • aws_detect_worker.main (cognitive 18) backend/core/aws_detect_worker.py:18 — aws_detect_worker.main has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 6, error handling 4, if/else 3 (4 pts), ternaries 2 (4 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · docs.links (cognitive 18) · ×1
  • docs.links (cognitive 18) backend/core/brain_bootstrap/docs.py:137 — docs.links has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 4, 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 · cjk_index._expand_token (cognitive 18) · ×1
  • cjk_index._expand_token (cognitive 18) backend/core/cjk_index.py:98 — cjk_index._expand_token has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 2 (6 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 · build.ensure_graph (cognitive 18) · ×1
  • build.ensure_graph (cognitive 18) backend/core/code_intel/build.py:377 — build.ensure_graph has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 3, ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · interface.names_in_code (cognitive 18) · ×1
  • interface.names_in_code (cognitive 18) backend/core/code_intel/interface.py:898 — interface.names_in_code has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 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 · parser._call_parts (cognitive 18) · ×1
  • parser._call_parts (cognitive 18) backend/core/code_intel/parser.py:1780 — parser._call_parts has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (8 pts), boolean chains 6, if/else 4 (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 · context_injector._extract_user_directives (cognitive 18) · ×1
  • context_injector._extract_user_directives (cognitive 18) backend/core/context_injector.py:573 — context_injector._extract_user_directives has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, error handling 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 · ddd_bindings.describe_project_ddd_line (cognitive 18) · ×1
  • ddd_bindings.describe_project_ddd_line (cognitive 18) backend/core/ddd_bindings.py:860 — ddd_bindings.describe_project_ddd_line has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), error handling 2 (3 pts), ternaries 3, 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 · ddd_entry_lifecycle._scan_entry (cognitive 18) · ×1
  • ddd_entry_lifecycle._scan_entry (cognitive 18) backend/core/ddd_entry_lifecycle.py:509 — ddd_entry_lifecycle._scan_entry has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (5 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 · ddd_packager.emit_target_aim (cognitive 18) · ×1
  • ddd_packager.emit_target_aim (cognitive 18) backend/core/ddd_packager.py:1525 — ddd_packager.emit_target_aim has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 3, loops 3, ternaries 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · eval_followups._standing (cognitive 18) · ×1
  • eval_followups._standing (cognitive 18) backend/core/eval_followups.py:336 — eval_followups._standing has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, 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 · EvalService.get_lines (cognitive 18) · ×1
  • EvalService.get_lines (cognitive 18) backend/core/eval_service.py:350 — EvalService.get_lines has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 11, 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 · EvalService._merge_partition_cases (cognitive 18) · ×1
  • EvalService._merge_partition_cases (cognitive 18) backend/core/eval_service.py:1182 — EvalService._merge_partition_cases 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 · git_sync_engine._export_tables_sync (cognitive 18) · ×1
  • git_sync_engine._export_tables_sync (cognitive 18) backend/core/git_sync_engine.py:66 — git_sync_engine._export_tables_sync has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 2 (3 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 · git_sync_engine._import_tables_sync (cognitive 18) · ×1
  • git_sync_engine._import_tables_sync (cognitive 18) backend/core/git_sync_engine.py:209 — git_sync_engine._import_tables_sync has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 3 (6 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 · hive_boot._open_turn (cognitive 18) · ×1
  • hive_boot._open_turn (cognitive 18) backend/core/hive_boot.py:68 — hive_boot._open_turn has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, ternaries 4 (6 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 · hive_diagnostics.findings (cognitive 18) · ×1
  • hive_diagnostics.findings (cognitive 18) backend/core/hive_diagnostics.py:149 — hive_diagnostics.findings 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 · queries.review_health (cognitive 18) · ×1
  • queries.review_health (cognitive 18) backend/core/ingestion/queries.py:506 — queries.review_health has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 5, if/else 3 (5 pts), loops 4 (5 pts), ternaries 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 · withdrawn.records (cognitive 18) · ×1
  • withdrawn.records (cognitive 18) backend/core/ingestion/withdrawn.py:65 — withdrawn.records has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 5, error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · writer._recover_plan (cognitive 18) · ×1
  • writer._recover_plan (cognitive 18) backend/core/ingestion/writer.py:956 — writer._recover_plan has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 6, ternaries 3 (5 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · leak_transcript._clean_summary_record (cognitive 18) · ×1
  • leak_transcript._clean_summary_record (cognitive 18) backend/core/leak_transcript.py:100 — leak_transcript._clean_summary_record has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 4 (8 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 · library_mounts.judge_mount_kind (cognitive 18) · ×1
  • library_mounts.judge_mount_kind (cognitive 18) backend/core/library_mounts.py:409 — library_mounts.judge_mount_kind has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 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 · pipeline_stage_events._test_commands (cognitive 18) · ×1
  • pipeline_stage_events._test_commands (cognitive 18) backend/core/pipeline_stage_events.py:454 — pipeline_stage_events._test_commands has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 3 (7 pts), if/else 3 (5 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProductRegistry.lookup (cognitive 18) · ×1
  • ProductRegistry.lookup (cognitive 18) backend/core/product_registry.py:683 — ProductRegistry.lookup has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 3 (5 pts), loops 3 (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 · project_agent.source_problems (cognitive 18) · ×1
  • project_agent.source_problems (cognitive 18) backend/core/project_agent.py:444 — project_agent.source_problems has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (6 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 · _Builder.command_row (cognitive 18) · ×1
  • _Builder.command_row (cognitive 18) backend/core/project_agent_draft.py:311 — _Builder.command_row has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · prompt_builder._reaches_this_machine (cognitive 18) · ×1
  • prompt_builder._reaches_this_machine (cognitive 18) REDACTED:590 — prompt_builder._reaches_this_machine has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 6, if/else 5 (6 pts), error handling 4 (5 pts), loops 1 (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 · recall_multi._doc_blocks (cognitive 18) · ×1
  • recall_multi._doc_blocks (cognitive 18) backend/core/recall_multi.py:1052 — recall_multi._doc_blocks has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (4 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 · run_owner_gate._v1_mutation_check (cognitive 18) · ×1
  • run_owner_gate._v1_mutation_check (cognitive 18) backend/core/run_owner_gate.py:347 — run_owner_gate._v1_mutation_check has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 8 (9 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · RunEngine._knowledge_summary (cognitive 18) · ×1
  • RunEngine._knowledge_summary (cognitive 18) backend/core/run_protocol/engine.py:3458 — RunEngine._knowledge_summary has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, 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 · landing.execute_request (cognitive 18) · ×1
  • landing.execute_request (cognitive 18) backend/core/run_protocol/landing.py:686 — landing.execute_request has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (7 pts), if/else 6, boolean chains 3, error handling 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.
D2 · Cognitive Complexity · ReviewOrchestrator.r2_input (cognitive 18) · ×1
  • ReviewOrchestrator.r2_input (cognitive 18) backend/core/run_protocol/review.py:958 — ReviewOrchestrator.r2_input has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 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 · run_worktree.entry_main (cognitive 18) · ×1
  • run_worktree.entry_main (cognitive 18) backend/core/run_worktree.py:1643 — run_worktree.entry_main has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, ternaries 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 · security_hooks._is_v1_land_request (cognitive 18) · ×1
  • security_hooks._is_v1_land_request (cognitive 18) backend/core/security_hooks.py:532 — security_hooks._is_v1_land_request has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · security_hooks.bash_syntax_guard (cognitive 18) · ×1
  • security_hooks.bash_syntax_guard (cognitive 18) backend/core/security_hooks.py:6238 — security_hooks.bash_syntax_guard has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, 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 · session_landings._expand (cognitive 18) · ×1
  • session_landings._expand (cognitive 18) backend/core/session_landings.py:173 — session_landings._expand has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (7 pts), error handling 2 (4 pts), boolean chains 3, loops 2, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StreamingOrchestrator._pipeline_stage_events (cognitive 18) · ×1
  • StreamingOrchestrator._pipeline_stage_events (cognitive 18) backend/core/streaming_orchestrator.py:433 — StreamingOrchestrator._pipeline_stage_events has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 4, 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 · swarm_out._lost_rows (cognitive 18) · ×1
  • swarm_out._lost_rows (cognitive 18) backend/core/swarm_out.py:1712 — swarm_out._lost_rows has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 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 · swarm_out._check_answer (cognitive 18) · ×1
  • swarm_out._check_answer (cognitive 18) backend/core/swarm_out.py:2158 — swarm_out._check_answer has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · swarm_out_actor.discard_blocker (cognitive 18) · ×1
  • swarm_out_actor.discard_blocker (cognitive 18) backend/core/swarm_out_actor.py:288 — swarm_out_actor.discard_blocker has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, boolean chains 6, ternaries 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 · swarm_out_record.reverted (cognitive 18) · ×1
  • swarm_out_record.reverted (cognitive 18) backend/core/swarm_out_record.py:400 — swarm_out_record.reverted has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, error handling 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · swarm_out_record.actionable (cognitive 18) · ×1
  • swarm_out_record.actionable (cognitive 18) backend/core/swarm_out_record.py:490 — swarm_out_record.actionable has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (8 pts), loops 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 · swarm_out_results._interventions (cognitive 18) · ×1
  • swarm_out_results._interventions (cognitive 18) backend/core/swarm_out_results.py:279 — swarm_out_results._interventions 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 · TaskManager._handle_pending_interaction (cognitive 18) · ×1
  • TaskManager._handle_pending_interaction (cognitive 18) REDACTED:352 — TaskManager._handle_pending_interaction has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (3 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 · todo_stats.compute_history_stats (cognitive 18) · ×1
  • todo_stats.compute_history_stats (cognitive 18) backend/core/todo_stats.py:55 — todo_stats.compute_history_stats has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, ternaries 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 · worktree_write_gate._file_verdict (cognitive 18) · ×1
  • worktree_write_gate._file_verdict (cognitive 18) backend/core/worktree_write_gate.py:163 — worktree_write_gate._file_verdict has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, error handling 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 · daily_activity_hook._touches_session_file (cognitive 18) · ×1
  • daily_activity_hook._touches_session_file (cognitive 18) backend/hooks/daily_activity_hook.py:57 — daily_activity_hook._touches_session_file has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (3 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 · brain_mistake_audit._pipeline_findings (cognitive 18) · ×1
  • brain_mistake_audit._pipeline_findings (cognitive 18) backend/jobs/handlers/brain_mistake_audit.py:143 — brain_mistake_audit._pipeline_findings has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, if/else 2 (5 pts), loops 2 (3 pts), error handling 1 (2 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · scheduler.load_jobs (cognitive 18) · ×1
  • scheduler.load_jobs (cognitive 18) backend/jobs/scheduler.py:69 — scheduler.load_jobs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (7 pts), error handling 2 (5 pts), ternaries 1 (3 pts), loops 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 · self_tune.prune_unused_feeds (cognitive 18) · ×1
  • self_tune.prune_unused_feeds (cognitive 18) backend/jobs/self_tune.py:313 — self_tune.prune_unused_feeds has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (17 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 · swarm_out_remote.proxy (cognitive 18) · ×1
  • swarm_out_remote.proxy (cognitive 18) backend/routers/swarm_out_remote.py:121 — swarm_out_remote.proxy has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (7 pts), error handling 4 (6 pts), ternaries 3 (4 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 · system._probe_aws_profiles (cognitive 18) · ×1
  • system._probe_aws_profiles (cognitive 18) backend/routers/system.py:736 — system._probe_aws_profiles has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 5, ternaries 2 (4 pts), error handling 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 · cdf_batch_eval._review_html (cognitive 18) · ×1
  • cdf_batch_eval._review_html (cognitive 18) backend/scripts/cdf_batch_eval.py:281 — cdf_batch_eval._review_html has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 2 (5 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 · generate_app_execution_releases._validate_install_manifest (cognitive 18) · ×1
  • generate_app_execution_releases._validate_install_manifest (cognitive 18) backend/scripts/generate_app_execution_releases.py:81 — generate_app_execution_releases._validate_install_manifest has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, 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 · refresh_ai_docs.check_staleness (cognitive 18) · ×1
  • refresh_ai_docs.check_staleness (cognitive 18) backend/scripts/refresh_ai_docs.py:359 — refresh_ai_docs.check_staleness has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (17 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 · refresh_ai_docs.refresh (cognitive 18) · ×1
  • refresh_ai_docs.refresh (cognitive 18) backend/scripts/refresh_ai_docs.py:422 — refresh_ai_docs.refresh has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 3 (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 · task_checks._table (cognitive 18) · ×1
  • task_checks._table (cognitive 18) backend/scripts/task_checks.py:230 — task_checks._table has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 2 (4 pts), loops 2 (3 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 · task_checks._end_group (cognitive 18) · ×1
  • task_checks._end_group (cognitive 18) backend/scripts/task_checks.py:328 — task_checks._end_group has cognitive complexity 18 (threshold 15). Drivers by points: error handling 3 (8 pts), if/else 3 (6 pts), loops 2 (3 pts), ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tool_call_glitch_metrics._responses (cognitive 18) · ×1
  • tool_call_glitch_metrics._responses (cognitive 18) backend/scripts/tool_call_glitch_metrics.py:85 — tool_call_glitch_metrics._responses has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 6, error handling 2 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · uninstall_cleanup.main (cognitive 18) · ×1
  • uninstall_cleanup.main (cognitive 18) backend/scripts/uninstall_cleanup.py:71 — uninstall_cleanup.main has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (17 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 · design_system.format_master_md (cognitive 18) · ×1
  • design_system.format_master_md (cognitive 18) backend/skills/s_frontend-design/scripts/design_system.py:612 — design_system.format_master_md has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (15 pts), 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 · cross_format_check.check_naming_conventions (cognitive 18) · ×1
  • cross_format_check.check_naming_conventions (cognitive 18) backend/skills/s_pollinate/scripts/cross_format_check.py:180 — cross_format_check.check_naming_conventions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 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 · azure.synthesize (cognitive 18) · ×1
  • azure.synthesize (cognitive 18) backend/skills/s_pollinate/scripts/tts/backends/azure.py:9 — azure.synthesize has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ShapeData.__init__ (cognitive 18) · ×1
  • ShapeData.__init__ (cognitive 18) backend/skills/s_pptx/scripts/inventory.py:388 — ShapeData.__init__ has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9, if/else 3 (6 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 · ShapeData._get_default_font_size (cognitive 18) · ×1
  • ShapeData._get_default_font_size (cognitive 18) backend/skills/s_pptx/scripts/inventory.py:480 — ShapeData._get_default_font_size has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (4 pts), boolean chains 2, ternaries 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 · ai_ready_helpers.parse_git_gotchas (cognitive 18) · ×1
  • ai_ready_helpers.parse_git_gotchas (cognitive 18) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:96 — ai_ready_helpers.parse_git_gotchas has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 5 (6 pts), ternaries 1 (3 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 · ai_ready_helpers.incremental_update (cognitive 18) · ×1
  • ai_ready_helpers.incremental_update (cognitive 18) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:937 — ai_ready_helpers.incremental_update has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, boolean chains 4, error handling 4, 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 · ai_ready_helpers._expand_globs (cognitive 18) · ×1
  • ai_ready_helpers._expand_globs (cognitive 18) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1762 — ai_ready_helpers._expand_globs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), error handling 2 (5 pts), loops 2 (3 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 · ai_ready_helpers.detect_package_roots (cognitive 18) · ×1
  • ai_ready_helpers.detect_package_roots (cognitive 18) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1946 — ai_ready_helpers.detect_package_roots has cognitive complexity 18 (threshold 15). Drivers by points: error handling 2 (5 pts), if/else 3 (5 pts), loops 3 (4 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 · compaction.attachCompactions (cognitive 18) · ×1
  • compaction.attachCompactions (cognitive 18) desktop/src/pages/chat/compaction.ts:184 — compaction.attachCompactions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 6). Of this number, 13 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useChatStreamingLifecycle.useChatStreamingLifecycle.createCompleteHandler · ×1
  • useChatStreamingLifecycle.useChatStreamingLifecycle.createCompleteHandler::inner (cognitive 18) desktop/src/hooks/useChatStreamingLifecycle.ts:4416 — useChatStreamingLifecycle.useChatStreamingLifecycle.createCompleteHandler::inner has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 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 · turnView.splitSegments (cognitive 18) · ×1
  • turnView.splitSegments (cognitive 18) REDACTED:779 — turnView.splitSegments has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 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 · turnView.extractNextSteps (cognitive 18) · ×1
  • turnView.extractNextSteps (cognitive 18) REDACTED:1151 — turnView.extractNextSteps has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (5 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 · TurnZones.AgentsPanel (cognitive 18) · ×1
  • TurnZones.AgentsPanel (cognitive 18) desktop/src/pages/chat/components/TurnZones.tsx:612 — TurnZones.AgentsPanel has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 15, if/else 3. Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to 4 function items inside it that branch (isStopped, isRunning, a function literal at line 622, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · TurnZones.bodyItems (cognitive 18) · ×1
  • TurnZones.bodyItems (cognitive 18) desktop/src/pages/chat/components/TurnZones.tsx:699 — TurnZones.bodyItems has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (4 pts) (nesting depth added 8). Of this number, 14 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CompactNotice.CompactNoticeImpl (cognitive 18) · ×1
  • CompactNotice.CompactNoticeImpl (cognitive 18) desktop/src/pages/chat/components/CompactNotice.tsx:34 — CompactNotice.CompactNoticeImpl has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 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 · live.lessonsLine (cognitive 18) · ×1
  • live.lessonsLine (cognitive 18) desktop/src/components/swarm-out/live.ts:160 — live.lessonsLine has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 7, 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 · ProjectAgentView.ProjectAgentView (cognitive 18) · ×1
  • ProjectAgentView.ProjectAgentView (cognitive 18) desktop/src/components/layout/ProjectAgentView.tsx:43 — ProjectAgentView.ProjectAgentView has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 13, ternaries 4, if/else 1. Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 73, 103, 89). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · BrainHubHome.BrainHubHome (cognitive 18) · ×1
  • BrainHubHome.BrainHubHome (cognitive 18) desktop/src/components/layout/BrainHubHome.tsx:169 — BrainHubHome.BrainHubHome has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 12, if/else 3, ternaries 3. Of this number, 12 points are the body's own statements and 6 belong to 4 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CasesTab.ReleaseRecord (cognitive 18) · ×1
  • CasesTab.ReleaseRecord (cognitive 18) desktop/src/pages/eval/CasesTab.tsx:314 — CasesTab.ReleaseRecord has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8 (12 pts), boolean chains 4, if/else 2 (nesting depth added 4). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to 3 function items inside it that branch (cell, a function literal at line 343, a function literal at line 317). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · EvalOverlay.EvalOverlay (cognitive 18) · ×1
  • EvalOverlay.EvalOverlay (cognitive 18) desktop/src/pages/eval/EvalOverlay.tsx:33 — EvalOverlay.EvalOverlay has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 8, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 47, 64, 59, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · CanvasChanges.ChangesDetail (cognitive 18) · ×1
  • CanvasChanges.ChangesDetail (cognitive 18) desktop/src/components/file-viewer/CanvasChanges.tsx:323 — CanvasChanges.ChangesDetail has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9 (10 pts), boolean chains 7, if/else 1 (nesting depth added 1). Of this number, 16 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · fileClassification.determineDeliveryStrategy (cognitive 18) · ×1
  • fileClassification.determineDeliveryStrategy (cognitive 18) desktop/src/utils/fileClassification.ts:177 — fileClassification.determineDeliveryStrategy has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (14 pts), ternaries 1 (2 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 · steerChain.steerChain (cognitive 18) · ×1
  • steerChain.steerChain (cognitive 18) desktop/src/pages/chat/steerChain.ts:33 — steerChain.steerChain 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 · brain-demo.html.renderGuide (cognitive 18) · ×1
  • brain-demo.html.renderGuide (cognitive 18) docs/design/brain-demo.html:678 — brain-demo.html.renderGuide has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (13 pts), boolean chains 4, if/else 1 (nesting depth added 8). 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 · StreamRedactor._stable_point (cognitive 17) · ×1
  • StreamRedactor._stable_point (cognitive 17) backend/channels/egress_redactor.py:172 — StreamRedactor._stable_point has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, loops 3 (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 · install_backend_daemon._sync_bundle_staged (cognitive 17) · ×1
  • install_backend_daemon._sync_bundle_staged (cognitive 17) backend/channels/install_backend_daemon.py:97 — install_backend_daemon._sync_bundle_staged has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), error handling 4 (6 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 · bedrock_thinking_gateway.verify_sigv4 (cognitive 17) · ×1
  • bedrock_thinking_gateway.verify_sigv4 (cognitive 17) REDACTED:148 — bedrock_thinking_gateway.verify_sigv4 has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, boolean chains 5, error handling 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 · brain_knowledge._parse (cognitive 17) · ×1
  • brain_knowledge._parse (cognitive 17) backend/core/brain_knowledge.py:65 — brain_knowledge._parse has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 5, if/else 3 (5 pts), ternaries 2 (4 pts), error handling 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 · brain_sync.collect (cognitive 17) · ×1
  • brain_sync.collect (cognitive 17) backend/core/brain_sync.py:232 — brain_sync.collect has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, 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 · CliStreamReader._close_turn (cognitive 17) · ×1
  • CliStreamReader._close_turn (cognitive 17) backend/core/cli_stream_reader.py:596 — CliStreamReader._close_turn has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 1 (4 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · analysis.analyze_graph_store (cognitive 17) · ×1
  • analysis.analyze_graph_store (cognitive 17) backend/core/code_intel/analysis.py:67 — analysis.analyze_graph_store 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 · parser._is_entry_point (cognitive 17) · ×1
  • parser._is_entry_point (cognitive 17) backend/core/code_intel/parser.py:852 — parser._is_entry_point has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 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 · receivers._java_packages (cognitive 17) · ×1
  • receivers._java_packages (cognitive 17) backend/core/code_intel/receivers.py:296 — receivers._java_packages has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · receivers.module_aliases (cognitive 17) · ×1
  • receivers.module_aliases (cognitive 17) backend/core/code_intel/receivers.py:1132 — receivers.module_aliases has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cognition.record_library_refs (cognitive 17) · ×1
  • cognition.record_library_refs (cognitive 17) backend/core/cognition.py:537 — cognition.record_library_refs has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (6 pts), error handling 2 (4 pts), loops 2 (4 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 · CompactionGuard.work_summary (cognitive 17) · ×1
  • CompactionGuard.work_summary (cognitive 17) backend/core/compaction_guard.py:771 — CompactionGuard.work_summary has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (6 pts), if/else 2 (4 pts), error handling 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 · ddd_bindings.governed_repo_roots (cognitive 17) · ×1
  • ddd_bindings.governed_repo_roots (cognitive 17) backend/core/ddd_bindings.py:205 — ddd_bindings.governed_repo_roots has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 6, loops 3, 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 · ddd_packager.gate_provenance_leaks (cognitive 17) · ×1
  • ddd_packager.gate_provenance_leaks (cognitive 17) backend/core/ddd_packager.py:529 — ddd_packager.gate_provenance_leaks has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · engine_metrics._collect_session_stats (cognitive 17) · ×1
  • engine_metrics._collect_session_stats (cognitive 17) backend/core/engine_metrics.py:415 — engine_metrics._collect_session_stats has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (3 pts), error handling 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 · eval_followups._offline_regressions (cognitive 17) · ×1
  • eval_followups._offline_regressions (cognitive 17) backend/core/eval_followups.py:229 — eval_followups._offline_regressions has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 6, 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 · hive_return._bundle_fact (cognitive 17) · ×1
  • hive_return._bundle_fact (cognitive 17) backend/core/hive_return.py:172 — hive_return._bundle_fact has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), boolean chains 4, loops 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · materializer.iter_governed_files (cognitive 17) · ×1
  • materializer.iter_governed_files (cognitive 17) backend/core/ingestion/materializer.py:87 — materializer.iter_governed_files has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 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 · provenance.register_root (cognitive 17) · ×1
  • provenance.register_root (cognitive 17) backend/core/ingestion/provenance.py:85 — provenance.register_root has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 3 (4 pts), boolean chains 3, 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 · s7_review.signals (cognitive 17) · ×1
  • s7_review.signals (cognitive 17) backend/core/ingestion/sources/s7_review.py:93 — s7_review.signals has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (12 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 · LifecycleManager._maintenance_loop (cognitive 17) · ×1
  • LifecycleManager._maintenance_loop (cognitive 17) backend/core/lifecycle_manager.py:285 — LifecycleManager._maintenance_loop has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), error handling 3 (6 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 · LifecycleManager._cleanup_dead (cognitive 17) · ×1
  • LifecycleManager._cleanup_dead (cognitive 17) backend/core/lifecycle_manager.py:1163 — LifecycleManager._cleanup_dead has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (15 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 · LifecycleManager._process_cultivation_events (cognitive 17) · ×1
  • LifecycleManager._process_cultivation_events (cognitive 17) backend/core/lifecycle_manager.py:1438 — LifecycleManager._process_cultivation_events has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (5 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 · LifecycleManager._reap_by_pattern (cognitive 17) · ×1
  • LifecycleManager._reap_by_pattern (cognitive 17) backend/core/lifecycle_manager.py:1901 — LifecycleManager._reap_by_pattern has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ManifestLoader.ensure_dependencies (cognitive 17) · ×1
  • ManifestLoader.ensure_dependencies (cognitive 17) backend/core/manifest_loader.py:187 — ManifestLoader.ensure_dependencies has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (15 pts), error handling 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · pipeline_stage_events.read_stage_state (cognitive 17) · ×1
  • pipeline_stage_events.read_stage_state (cognitive 17) backend/core/pipeline_stage_events.py:165 — pipeline_stage_events.read_stage_state has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, boolean chains 6, 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 · PluginManager._detect_standalone_skill (cognitive 17) · ×1
  • PluginManager._detect_standalone_skill (cognitive 17) backend/core/plugin_manager.py:406 — PluginManager._detect_standalone_skill has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), error handling 2 (4 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · recall_multi._take_whole (cognitive 17) · ×1
  • recall_multi._take_whole (cognitive 17) backend/core/recall_multi.py:1140 — recall_multi._take_whole has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (8 pts), if/else 4 (7 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 · run_interventions.details (cognitive 17) · ×1
  • run_interventions.details (cognitive 17) backend/core/run_interventions.py:201 — run_interventions.details has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), error handling 1 (4 pts), boolean chains 2, 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 · audit.active_seconds (cognitive 17) · ×1
  • audit.active_seconds (cognitive 17) backend/core/run_protocol/audit.py:337 — audit.active_seconds has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 4 (8 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 · RunEngine._with_decisions (cognitive 17) · ×1
  • RunEngine._with_decisions (cognitive 17) backend/core/run_protocol/engine.py:1838 — RunEngine._with_decisions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 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 · events.add_event (cognitive 17) · ×1
  • events.add_event (cognitive 17) backend/core/run_protocol/events.py:599 — events.add_event has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, ternaries 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 · hook_bridge._applicable_statuses (cognitive 17) · ×1
  • hook_bridge._applicable_statuses (cognitive 17) backend/core/run_protocol/hook_bridge.py:372 — hook_bridge._applicable_statuses has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 2 (5 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · review.review_patterns (cognitive 17) · ×1
  • review.review_patterns (cognitive 17) backend/core/run_protocol/review.py:540 — review.review_patterns has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, error handling 2 (4 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 · AuditStore.append_batch (cognitive 17) · ×1
  • AuditStore.append_batch (cognitive 17) backend/core/run_protocol/store.py:409 — AuditStore.append_batch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (6 pts), loops 5 (6 pts), error handling 2, ternaries 2, boolean chains 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 · runtime_hooks._finding_row (cognitive 17) · ×1
  • runtime_hooks._finding_row (cognitive 17) backend/core/runtime_hooks.py:1102 — runtime_hooks._finding_row has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, if/else 3 (5 pts), error handling 1 (3 pts), 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 · security_hooks._git_dir_of (cognitive 17) · ×1
  • security_hooks._git_dir_of (cognitive 17) backend/core/security_hooks.py:1522 — security_hooks._git_dir_of has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 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 · security_hooks._segment_discards (cognitive 17) · ×1
  • security_hooks._segment_discards (cognitive 17) backend/core/security_hooks.py:1625 — security_hooks._segment_discards has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 8 (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 · security_hooks._cd_segment_target (cognitive 17) · ×1
  • security_hooks._cd_segment_target (cognitive 17) backend/core/security_hooks.py:4356 — security_hooks._cd_segment_target has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, ternaries 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 · security_hooks._audit_leading (cognitive 17) · ×1
  • security_hooks._audit_leading (cognitive 17) backend/core/security_hooks.py:5674 — security_hooks._audit_leading 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 · security_hooks._match_governance_tier (cognitive 17) · ×1
  • security_hooks._match_governance_tier (cognitive 17) backend/core/security_hooks.py:6469 — security_hooks._match_governance_tier has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 6, 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 · ServiceManager._health_monitor (cognitive 17) · ×1
  • ServiceManager._health_monitor (cognitive 17) backend/core/service_manager.py:343 — ServiceManager._health_monitor has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 2 (3 pts), 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 · session_changes.working_repo (cognitive 17) · ×1
  • session_changes.working_repo (cognitive 17) backend/core/session_changes.py:368 — session_changes.working_repo has cognitive complexity 17 (threshold 15). Drivers by points: if/else 2 (8 pts), loops 3 (6 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 · session_healing.build_rich_checkpoint (cognitive 17) · ×1
  • session_healing.build_rich_checkpoint (cognitive 17) backend/core/session_healing.py:867 — session_healing.build_rich_checkpoint has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, error handling 1 (2 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionRouter._compact_tool_results (cognitive 17) · ×1
  • SessionRouter._compact_tool_results (cognitive 17) backend/core/session_router.py:2513 — SessionRouter._compact_tool_results has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 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 · SessionRouter._acquire_channel_slot (cognitive 17) · ×1
  • SessionRouter._acquire_channel_slot (cognitive 17) backend/core/session_router.py:3137 — SessionRouter._acquire_channel_slot has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 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 · SessionRouter._steer_blocker (cognitive 17) · ×1
  • SessionRouter._steer_blocker (cognitive 17) backend/core/session_router.py:4553 — SessionRouter._steer_blocker has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, 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 · skill_health.build_health_map (cognitive 17) · ×1
  • skill_health.build_health_map (cognitive 17) backend/core/skill_health.py:113 — skill_health.build_health_map has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (10 pts), boolean chains 3, if/else 1 (2 pts), 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 · swarm_out_card.from_row (cognitive 17) · ×1
  • swarm_out_card.from_row (cognitive 17) backend/core/swarm_out_card.py:253 — swarm_out_card.from_row has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, ternaries 4 (6 pts), if/else 2 (3 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 · swarm_out_model.align (cognitive 17) · ×1
  • swarm_out_model.align (cognitive 17) backend/core/swarm_out_model.py:68 — swarm_out_model.align has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6, boolean chains 4, ternaries 4, error handling 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 · swarm_out_remote.iter_sse_lines (cognitive 17) · ×1
  • swarm_out_remote.iter_sse_lines (cognitive 17) backend/core/swarm_out_remote.py:224 — swarm_out_remote.iter_sse_lines has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts), ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _Writer._write (cognitive 17) · ×1
  • _Writer._write (cognitive 17) backend/core/usage_accounting.py:353 — _Writer._write has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 2 (4 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 · ContextHealthHook._extract_title (cognitive 17) · ×1
  • ContextHealthHook._extract_title (cognitive 17) backend/hooks/context_health_hook.py:1784 — ContextHealthHook._extract_title has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 1, 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 · TodoLifecycleHook._handle_implicit_matching (cognitive 17) · ×1
  • TodoLifecycleHook._handle_implicit_matching (cognitive 17) backend/hooks/todo_lifecycle_hook.py:206 — TodoLifecycleHook._handle_implicit_matching has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 1 (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 · executor._handle_maintenance (cognitive 17) · ×1
  • executor._handle_maintenance (cognitive 17) REDACTED:1142 — executor._handle_maintenance has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 1 (2 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · scheduler.validate_config (cognitive 17) · ×1
  • scheduler.validate_config (cognitive 17) backend/jobs/scheduler.py:752 — scheduler.validate_config has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 4 (6 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 · pollinate.pollinate_assets (cognitive 17) · ×1
  • pollinate.pollinate_assets (cognitive 17) backend/routers/pollinate.py:558 — pollinate.pollinate_assets has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 pts), error handling 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 · workspace_api._resolve_file_path (cognitive 17) · ×1
  • workspace_api._resolve_file_path (cognitive 17) backend/routers/workspace_api.py:878 — workspace_api._resolve_file_path has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, error handling 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 · workspace_config.update_mcp_configs (cognitive 17) · ×1
  • workspace_config.update_mcp_configs (cognitive 17) backend/routers/workspace_config.py:167 — workspace_config.update_mcp_configs has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 3 (5 pts), boolean chains 1, 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 · brain_cleanup.cleaned_text (cognitive 17) · ×1
  • brain_cleanup.cleaned_text (cognitive 17) backend/scripts/brain_cleanup.py:44 — brain_cleanup.cleaned_text has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · eval_runner.eval_recall_at_k (cognitive 17) · ×1
  • eval_runner.eval_recall_at_k (cognitive 17) backend/scripts/eval_runner.py:461 — eval_runner.eval_recall_at_k has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, error handling 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 · swarm_out._update_hive (cognitive 17) · ×1
  • swarm_out._update_hive (cognitive 17) backend/scripts/swarm_out.py:345 — swarm_out._update_hive has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DesignSystemGenerator._select_best_match (cognitive 17) · ×1
  • DesignSystemGenerator._select_best_match (cognitive 17) backend/skills/s_frontend-design/scripts/design_system.py:122 — DesignSystemGenerator._select_best_match has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 4 (6 pts), boolean chains 2, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · generate_tts._hard_split (cognitive 17) · ×1
  • generate_tts._hard_split (cognitive 17) backend/skills/s_pollinate/scripts/generate_tts.py:39 — generate_tts._hard_split has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 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 · generate_tts.chunk_text (cognitive 17) · ×1
  • generate_tts.chunk_text (cognitive 17) backend/skills/s_pollinate/scripts/generate_tts.py:75 — generate_tts.chunk_text has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (6 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 · inventory.extract_text_inventory (cognitive 17) · ×1
  • inventory.extract_text_inventory (cognitive 17) backend/skills/s_pptx/scripts/inventory.py:914 — inventory.extract_text_inventory has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (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 · thumbnail.create_grid (cognitive 17) · ×1
  • thumbnail.create_grid (cognitive 17) backend/skills/s_pptx/scripts/thumbnail.py:321 — thumbnail.create_grid has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (4 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 · mcp_validation.validate_env_no_system_db (cognitive 17) · ×1
  • mcp_validation.validate_env_no_system_db (cognitive 17) backend/utils/mcp_validation.py:27 — mcp_validation.validate_env_no_system_db has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 2 (5 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 · backendIssue.slowed (cognitive 17) · ×1
  • backendIssue.slowed (cognitive 17) desktop/src/hooks/backendIssue.ts:78 — backendIssue.slowed has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 6 (12 pts), boolean chains 3, if/else 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 · ErrorBoundary.ApiError (cognitive 17) · ×1
  • ErrorBoundary.ApiError (cognitive 17) desktop/src/components/common/ErrorBoundary.tsx:185 — ErrorBoundary.ApiError has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, boolean chains 7. Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (getErrorIcon, getErrorColor). 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 · canvasSession.load (cognitive 17) · ×1
  • canvasSession.load (cognitive 17) desktop/src/services/canvasSession.ts:256 — canvasSession.load has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 2 (5 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 7). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (run, a function literal at line 277). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · useUnifiedTabState.useUnifiedTabState.closeTab (cognitive 17) · ×1
  • useUnifiedTabState.useUnifiedTabState.closeTab (cognitive 17) desktop/src/hooks/useUnifiedTabState.ts:681 — useUnifiedTabState.useUnifiedTabState.closeTab has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), error handling 2 (5 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnZones.TurnZoneList (cognitive 17) · ×1
  • TurnZones.TurnZoneList (cognitive 17) desktop/src/pages/chat/components/TurnZones.tsx:972 — TurnZones.TurnZoneList has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, ternaries 4 (7 pts), match/switch 1 (nesting depth added 3). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to one function literal inside it that branches (line 979). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · live.stateLabel (cognitive 17) · ×1
  • live.stateLabel (cognitive 17) desktop/src/components/swarm-out/live.ts:180 — live.stateLabel has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 6 (15 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 · index.Tabs (cognitive 17) · ×1
  • index.Tabs (cognitive 17) desktop/src/components/overlay/index.tsx:62 — index.Tabs has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (13 pts), boolean chains 3, if/else 1 (nesting depth added 6). None of this is in the body itself: all 17 points belong to 2 function items inside it that branch (onKey, a function literal at line 81). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · AssistantMessageView.BackgroundFinishedCard (cognitive 17) · ×1
  • AssistantMessageView.BackgroundFinishedCard (cognitive 17) desktop/src/pages/chat/components/AssistantMessageView.tsx:78 — AssistantMessageView.BackgroundFinishedCard has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 8 (11 pts), boolean chains 3, if/else 3 (nesting depth added 3). None of this is in the body itself: all 17 points belong to 3 function items inside it that branch (a function literal at line 98, fmtS, a function literal at line 90). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · BrainLearnedView.BrainLearnedView (cognitive 17) · ×1
  • BrainLearnedView.BrainLearnedView (cognitive 17) desktop/src/components/layout/BrainLearnedView.tsx:54 — BrainLearnedView.BrainLearnedView has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, ternaries 6 (7 pts), if/else 2 (nesting depth added 1). Of this number, 15 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · hiveComponents.AccountCard (cognitive 17) · ×1
  • hiveComponents.AccountCard (cognitive 17) REDACTED:461 — hiveComponents.AccountCard has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (8 pts), boolean chains 6, error handling 2, if/else 1 (nesting depth added 3). Of this number, 14 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkspaceOverlay.WorkspaceOverlay (cognitive 17) · ×1
  • WorkspaceOverlay.WorkspaceOverlay (cognitive 17) desktop/src/components/workspace-explorer/WorkspaceOverlay.tsx:93 — WorkspaceOverlay.WorkspaceOverlay has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (5 pts), ternaries 4 (nesting depth added 1). Most of this is not in the body itself: 5 of the 17 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 122, 117, 108, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · useUnifiedAttachments.useUnifiedAttachments.addWorkspaceFiles (cognitive 17) · ×1
  • useUnifiedAttachments.useUnifiedAttachments.addWorkspaceFiles (cognitive 17) desktop/src/hooks/useUnifiedAttachments.ts:313 — useUnifiedAttachments.useUnifiedAttachments.addWorkspaceFiles has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 1 (3 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 · TSCCModules.RecallTab (cognitive 17) · ×1
  • TSCCModules.RecallTab (cognitive 17) desktop/src/pages/chat/components/TSCCModules.tsx:364 — TSCCModules.RecallTab has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (5 pts), ternaries 2 (3 pts), loops 1 (nesting depth added 2). Of this number, 12 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ChatInput.ChatInput · ×1
  • ChatInput.ChatInput::handleKeyDown (cognitive 17) desktop/src/pages/chat/components/ChatInput.tsx:696 — ChatInput.ChatInput::handleKeyDown has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7 (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. This shape REPEATS in the file: one other method here (ChatInput.ChatInput) 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 · firstNonNull (cognitive 17) · ×1
  • firstNonNull (cognitive 17) backend/skills/s_browser-agent/wait-engine.mjs:323 — firstNonNull 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). None of this is in the body itself: all 17 points belong to 3 function literals inside it that branch (lines 324, 328, 333). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · library.list_styles (cognitive 16) · ×1
  • library.list_styles (cognitive 16) backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/library.py:173 — library.list_styles has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 3 (8 pts), if/else 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 · ChannelGateway.resolve_approval (cognitive 16) · ×1
  • ChannelGateway.resolve_approval (cognitive 16) backend/channels/gateway.py:582 — ChannelGateway.resolve_approval has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 3, 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 · aws_account._from_profile (cognitive 16) · ×1
  • aws_account._from_profile (cognitive 16) backend/core/aws_account.py:654 — aws_account._from_profile has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 6, 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 · aws_account.run_capability_checks (cognitive 16) · ×1
  • aws_account.run_capability_checks (cognitive 16) backend/core/aws_account.py:864 — aws_account.run_capability_checks has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (5 pts), boolean chains 4, error handling 3 (4 pts), loops 1 (2 pts), ternaries 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · docs._inline_tier1 (cognitive 16) · ×1
  • docs._inline_tier1 (cognitive 16) backend/core/brain_bootstrap/docs.py:283 — docs._inline_tier1 has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 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 · brain_knowledge.knowledge (cognitive 16) · ×1
  • brain_knowledge.knowledge (cognitive 16) backend/core/brain_knowledge.py:183 — brain_knowledge.knowledge has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 3 (4 pts), boolean chains 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 · brain_sync_host._row (cognitive 16) · ×1
  • brain_sync_host._row (cognitive 16) backend/core/brain_sync_host.py:173 — brain_sync_host._row has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (7 pts), boolean chains 5, if/else 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 · CliStreamReader._on_echo (cognitive 16) · ×1
  • CliStreamReader._on_echo (cognitive 16) backend/core/cli_stream_reader.py:444 — CliStreamReader._on_echo has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, 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 · build.rebuild (cognitive 16) · ×1
  • build.rebuild (cognitive 16) backend/core/code_intel/build.py:138 — build.rebuild has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 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 · changed._hunks (cognitive 16) · ×1
  • changed._hunks (cognitive 16) backend/core/code_intel/changed.py:222 — changed._hunks has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (12 pts), if/else 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 · changed.symbols_touched (cognitive 16) · ×1
  • changed.symbols_touched (cognitive 16) backend/core/code_intel/changed.py:276 — changed.symbols_touched has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 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 · changed._still_reachable (cognitive 16) · ×1
  • changed._still_reachable (cognitive 16) backend/core/code_intel/changed.py:414 — changed._still_reachable 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 · changed._project_graph_for (cognitive 16) · ×1
  • changed._project_graph_for (cognitive 16) backend/core/code_intel/changed.py:613 — changed._project_graph_for has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, 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 · freshness.check_freshness (cognitive 16) · ×1
  • freshness.check_freshness (cognitive 16) backend/core/code_intel/freshness.py:55 — freshness.check_freshness has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, error handling 3, 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 · interface.bare_calls (cognitive 16) · ×1
  • interface.bare_calls (cognitive 16) backend/core/code_intel/interface.py:816 — interface.bare_calls 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 · local_roots.classify_starter (cognitive 16) · ×1
  • local_roots.classify_starter (cognitive 16) backend/core/code_intel/local_roots.py:168 — local_roots.classify_starter has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 3, ternaries 1 (2 pts), error handling 1, 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 · parser._sql_call_edges (cognitive 16) · ×1
  • parser._sql_call_edges (cognitive 16) backend/core/code_intel/parser.py:2126 — parser._sql_call_edges has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (3 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · community_data.parse_sources (cognitive 16) · ×1
  • community_data.parse_sources (cognitive 16) backend/core/community_data.py:203 — community_data.parse_sources has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 5, if/else 3 (5 pts), ternaries 2 (4 pts), error handling 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · context_injector._build_checkpoint (cognitive 16) · ×1
  • context_injector._build_checkpoint (cognitive 16) backend/core/context_injector.py:881 — context_injector._build_checkpoint has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · daily_activity_writer._sanitize_summary_injection (cognitive 16) · ×1
  • daily_activity_writer._sanitize_summary_injection (cognitive 16) backend/core/daily_activity_writer.py:458 — daily_activity_writer._sanitize_summary_injection has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 1, 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 · heartbeat._pending_c_wait (cognitive 16) · ×1
  • heartbeat._pending_c_wait (cognitive 16) backend/core/heartbeat.py:203 — heartbeat._pending_c_wait has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 4, loops 2, error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · hive_bundle.seal_bundles (cognitive 16) · ×1
  • hive_bundle.seal_bundles (cognitive 16) backend/core/hive_bundle.py:110 — hive_bundle.seal_bundles has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 2 (5 pts), error handling 2 (4 pts), if/else 2 (4 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 · hive_records._valid_entry (cognitive 16) · ×1
  • hive_records._valid_entry (cognitive 16) backend/core/hive_records.py:743 — hive_records._valid_entry 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 · hive_return._bundle_header (cognitive 16) · ×1
  • hive_return._bundle_header (cognitive 16) backend/core/hive_return.py:257 — hive_return._bundle_header has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 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 · hive_return.land (cognitive 16) · ×1
  • hive_return.land (cognitive 16) backend/core/hive_return.py:560 — hive_return.land has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 5, error handling 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 · library_health.apply_action (cognitive 16) · ×1
  • library_health.apply_action (cognitive 16) backend/core/library_health.py:190 — library_health.apply_action has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 2 (4 pts), boolean chains 2, loops 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 · LifecycleManager._check_orphan_sessions (cognitive 16) · ×1
  • LifecycleManager._check_orphan_sessions (cognitive 16) backend/core/lifecycle_manager.py:1041 — LifecycleManager._check_orphan_sessions 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 · ManifestLoader.load (cognitive 16) · ×1
  • ManifestLoader.load (cognitive 16) backend/core/manifest_loader.py:142 — ManifestLoader.load has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 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 · north_star._every_turn_sizes (cognitive 16) · ×1
  • north_star._every_turn_sizes (cognitive 16) backend/core/north_star.py:157 — north_star._every_turn_sizes has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 3 (6 pts), if/else 3 (5 pts), boolean chains 3, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _Builder.tool_rows (cognitive 16) · ×1
  • _Builder.tool_rows (cognitive 16) backend/core/project_agent_draft.py:347 — _Builder.tool_rows has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 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 · project_agent_session.advance_pipeline_pin (cognitive 16) · ×1
  • project_agent_session.advance_pipeline_pin (cognitive 16) backend/core/project_agent_session.py:156 — project_agent_session.advance_pipeline_pin has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 4, ternaries 3, error handling 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · recall_multi._graph_codeintel_hits (cognitive 16) · ×1
  • recall_multi._graph_codeintel_hits (cognitive 16) backend/core/recall_multi.py:342 — recall_multi._graph_codeintel_hits has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), ternaries 3 (5 pts), boolean chains 3, error handling 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · repo_guidance._bash_dirs (cognitive 16) · ×1
  • repo_guidance._bash_dirs (cognitive 16) backend/core/repo_guidance.py:272 — repo_guidance._bash_dirs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 2 (5 pts), ternaries 2 (5 pts), boolean chains 4, error handling 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RetryManager._inject_abandon_continuation (cognitive 16) · ×1
  • RetryManager._inject_abandon_continuation (cognitive 16) backend/core/retry_manager.py:696 — RetryManager._inject_abandon_continuation has cognitive complexity 16 (threshold 15). Drivers by points: error handling 4 (6 pts), if/else 6, boolean chains 4 (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 · run_index._scan (cognitive 16) · ×1
  • run_index._scan (cognitive 16) backend/core/run_index.py:93 — run_index._scan has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), error handling 2 (4 pts), boolean chains 3, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · audit._critical_path (cognitive 16) · ×1
  • audit._critical_path (cognitive 16) backend/core/run_protocol/audit.py:122 — audit._critical_path has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · audit._commands (cognitive 16) · ×1
  • audit._commands (cognitive 16) backend/core/run_protocol/audit.py:196 — audit._commands has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RunEngine._answered_decisions (cognitive 16) · ×1
  • RunEngine._answered_decisions (cognitive 16) backend/core/run_protocol/engine.py:1809 — RunEngine._answered_decisions has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 4 (7 pts), 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 · RunEngine._audit_facts (cognitive 16) · ×1
  • RunEngine._audit_facts (cognitive 16) backend/core/run_protocol/engine.py:3382 — RunEngine._audit_facts has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 5, ternaries 3 (4 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AuditStore.copy_to_session (cognitive 16) · ×1
  • AuditStore.copy_to_session (cognitive 16) backend/core/run_protocol/store.py:530 — AuditStore.copy_to_session has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), error handling 2 (4 pts), 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 · run_worktree.last_activity (cognitive 16) · ×1
  • run_worktree.last_activity (cognitive 16) backend/core/run_worktree.py:1734 — run_worktree.last_activity has cognitive complexity 16 (threshold 15). Drivers by points: error handling 2 (5 pts), if/else 2 (4 pts), loops 2 (3 pts), ternaries 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 · security_hooks._mktemp_assignment (cognitive 16) · ×1
  • security_hooks._mktemp_assignment (cognitive 16) backend/core/security_hooks.py:201 — security_hooks._mktemp_assignment has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 5, 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 · security_hooks._command_session_link (cognitive 16) · ×1
  • security_hooks._command_session_link (cognitive 16) backend/core/security_hooks.py:5083 — security_hooks._command_session_link has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 4, 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 · security_hooks._audit_substitutions (cognitive 16) · ×1
  • security_hooks._audit_substitutions (cognitive 16) backend/core/security_hooks.py:5617 — security_hooks._audit_substitutions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 2 (4 pts), ternaries 1 (3 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 · security_hooks._audit_split_redirects (cognitive 16) · ×1
  • security_hooks._audit_split_redirects (cognitive 16) backend/core/security_hooks.py:5642 — security_hooks._audit_split_redirects has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 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 · ServiceManager.start_all (cognitive 16) · ×1
  • ServiceManager.start_all (cognitive 16) backend/core/service_manager.py:123 — ServiceManager.start_all has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 1 (2 pts), loops 2, boolean chains 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 · SessionRouter._on_unit_state_change (cognitive 16) · ×1
  • SessionRouter._on_unit_state_change (cognitive 16) backend/core/session_router.py:3511 — SessionRouter._on_unit_state_change has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 2 (4 pts), boolean chains 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 · SessionRouter._task_repo_facts (cognitive 16) · ×1
  • SessionRouter._task_repo_facts (cognitive 16) backend/core/session_router.py:4382 — SessionRouter._task_repo_facts has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (5 pts), error handling 4, ternaries 2 (3 pts), boolean chains 2, 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 · SessionRouter._interrupt_session_writes (cognitive 16) · ×1
  • SessionRouter._interrupt_session_writes (cognitive 16) backend/core/session_router.py:5941 — SessionRouter._interrupt_session_writes has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (8 pts), if/else 5, 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, 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 · StreamingOrchestrator._compaction_events (cognitive 16) · ×1
  • StreamingOrchestrator._compaction_events (cognitive 16) backend/core/streaming_orchestrator.py:957 — StreamingOrchestrator._compaction_events has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 2 (4 pts), boolean chains 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 · swarm_out.run_refresh_loop (cognitive 16) · ×1
  • swarm_out.run_refresh_loop (cognitive 16) backend/core/swarm_out.py:1649 — swarm_out.run_refresh_loop has cognitive complexity 16 (threshold 15). Drivers by points: error handling 4 (8 pts), if/else 3 (6 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 · DecisionMirror._close (cognitive 16) · ×1
  • DecisionMirror._close (cognitive 16) backend/core/swarm_out_decisions.py:306 — DecisionMirror._close has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 4, error handling 2 (3 pts), 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 · swarm_out_wake.candidates (cognitive 16) · ×1
  • swarm_out_wake.candidates (cognitive 16) backend/core/swarm_out_wake.py:77 — swarm_out_wake.candidates 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 · swarm_run_conductor.end_children (cognitive 16) · ×1
  • swarm_run_conductor.end_children (cognitive 16) backend/core/swarm_run_conductor.py:82 — swarm_run_conductor.end_children has cognitive complexity 16 (threshold 15). Drivers by points: error handling 3 (5 pts), if/else 2 (4 pts), loops 3, boolean chains 2, 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 · swarm_workspace_manager._assert_ai_instruction_sentinels (cognitive 16) · ×1
  • swarm_workspace_manager._assert_ai_instruction_sentinels (cognitive 16) backend/core/swarm_workspace_manager.py:113 — swarm_workspace_manager._assert_ai_instruction_sentinels has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), error handling 2 (5 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 · tool_summarizer._mask_named (cognitive 16) · ×1
  • tool_summarizer._mask_named (cognitive 16) backend/core/tool_summarizer.py:91 — tool_summarizer._mask_named has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 5, ternaries 2 (3 pts), loops 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 · _PoolBorrow.__aenter__ (cognitive 16) · ×1
  • _PoolBorrow.__aenter__ (cognitive 16) backend/database/sqlite.py:299 — _PoolBorrow.__aenter__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 3 (7 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DailyActivityExtractionHook._summarize_day (cognitive 16) · ×1
  • DailyActivityExtractionHook._summarize_day (cognitive 16) backend/hooks/daily_activity_hook.py:637 — DailyActivityExtractionHook._summarize_day has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 3, error handling 1 (2 pts), loops 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 · hacker_news.fetch_hacker_news (cognitive 16) · ×1
  • hacker_news.fetch_hacker_news (cognitive 16) backend/jobs/adapters/hacker_news.py:22 — hacker_news.fetch_hacker_news has cognitive complexity 16 (threshold 15). Drivers by points: if/else 2 (6 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · executor._purge_terminal_todos (cognitive 16) · ×1
  • executor._purge_terminal_todos (cognitive 16) REDACTED:1810 — executor._purge_terminal_todos has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (5 pts), boolean chains 3, error handling 2 (3 pts), loops 2 (3 pts), ternaries 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · signal_digest._write_l4_json (cognitive 16) · ×1
  • signal_digest._write_l4_json (cognitive 16) backend/jobs/handlers/signal_digest.py:507 — signal_digest._write_l4_json has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), error handling 1 (2 pts), loops 2, 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 · skill_proposer._find_existing_skill (cognitive 16) · ×1
  • skill_proposer._find_existing_skill (cognitive 16) backend/jobs/handlers/skill_proposer.py:173 — skill_proposer._find_existing_skill has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · artifacts._parse_git_log (cognitive 16) · ×1
  • artifacts._parse_git_log (cognitive 16) backend/routers/artifacts.py:105 — artifacts._parse_git_log has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 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 · chat.cmd_permission_continue (cognitive 16) · ×1
  • chat.cmd_permission_continue (cognitive 16) backend/routers/chat.py:1599 — chat.cmd_permission_continue has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), error handling 3 (5 pts), ternaries 3 (4 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 · ddd_brain._recent_activity (cognitive 16) · ×1
  • ddd_brain._recent_activity (cognitive 16) backend/routers/ddd_brain.py:580 — ddd_brain._recent_activity has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), error handling 2 (4 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 · pipelines.list_pipelines (cognitive 16) · ×1
  • pipelines.list_pipelines (cognitive 16) backend/routers/pipelines.py:269 — pipelines.list_pipelines has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), 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 · pipelines._card_facts (cognitive 16) · ×1
  • pipelines._card_facts (cognitive 16) backend/routers/pipelines.py:351 — pipelines._card_facts has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 10, boolean chains 3, if/else 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 · pollinate._build_card (cognitive 16) · ×1
  • pollinate._build_card (cognitive 16) backend/routers/pollinate.py:490 — pollinate._build_card 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 · artifact_cli._release_marker_authorizes_head (cognitive 16) · ×1
  • artifact_cli._release_marker_authorizes_head (cognitive 16) backend/scripts/artifact_cli.py:115 — artifact_cli._release_marker_authorizes_head has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, 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 · artifact_cli.cmd_bind (cognitive 16) · ×1
  • artifact_cli.cmd_bind (cognitive 16) backend/scripts/artifact_cli.py:341 — artifact_cli.cmd_bind has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, error handling 2 (3 pts), boolean chains 2, ternaries 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 · backfill_cjk_escapes.audit_unlisted_columns (cognitive 16) · ×1
  • backfill_cjk_escapes.audit_unlisted_columns (cognitive 16) backend/scripts/backfill_cjk_escapes.py:259 — backfill_cjk_escapes.audit_unlisted_columns has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), error handling 2 (5 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 · cdf_batch_eval.aggregate (cognitive 16) · ×1
  • cdf_batch_eval.aggregate (cognitive 16) backend/scripts/cdf_batch_eval.py:244 — cdf_batch_eval.aggregate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (4 pts), ternaries 1 (2 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 · clean_daily_activity._parse_entry (cognitive 16) · ×1
  • clean_daily_activity._parse_entry (cognitive 16) backend/scripts/clean_daily_activity.py:107 — clean_daily_activity._parse_entry has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · eval_runner._eval_trajectory_tool_strict (cognitive 16) · ×1
  • eval_runner._eval_trajectory_tool_strict (cognitive 16) backend/scripts/eval_runner.py:1505 — eval_runner._eval_trajectory_tool_strict has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 1 (2 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 · knowledge_usage_report._hint_text (cognitive 16) · ×1
  • knowledge_usage_report._hint_text (cognitive 16) backend/scripts/knowledge_usage_report.py:49 — knowledge_usage_report._hint_text has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 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 · meta_shape_migrate.candidates (cognitive 16) · ×1
  • meta_shape_migrate.candidates (cognitive 16) backend/scripts/meta_shape_migrate.py:51 — meta_shape_migrate.candidates has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · migrate_followups_to_todos.review_closed (cognitive 16) · ×1
  • migrate_followups_to_todos.review_closed (cognitive 16) backend/scripts/migrate_followups_to_todos.py:604 — migrate_followups_to_todos.review_closed has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (6 pts), loops 1, 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 · swarm_out._call (cognitive 16) · ×1
  • swarm_out._call (cognitive 16) backend/scripts/swarm_out.py:111 — swarm_out._call has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (6 pts), error handling 4 (5 pts), boolean chains 3, ternaries 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 · task_checks._read_github_env (cognitive 16) · ×1
  • task_checks._read_github_env (cognitive 16) backend/scripts/task_checks.py:170 — task_checks._read_github_env has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 2 (4 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 · SelfLoopsHealthEngine._check_brain_safety (cognitive 16) · ×1
  • SelfLoopsHealthEngine._check_brain_safety (cognitive 16) backend/skills/s_loops-health/scripts/loops_health_check.py:471 — SelfLoopsHealthEngine._check_brain_safety has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7, error handling 2 (3 pts), boolean chains 2, if/else 2, loops 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 · geo_score.main (cognitive 16) · ×1
  • geo_score.main (cognitive 16) backend/skills/s_pollinate/scripts/geo_score.py:345 — geo_score.main has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), loops 2 (5 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 · publish_to_pages.generate_index (cognitive 16) · ×1
  • publish_to_pages.generate_index (cognitive 16) backend/skills/s_pollinate/scripts/publish_to_pages.py:176 — publish_to_pages.generate_index has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (5 pts), ternaries 3 (5 pts), boolean chains 3, 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 · SlidePreview.scrubExternalRefs (cognitive 16) · ×1
  • SlidePreview.scrubExternalRefs (cognitive 16) REDACTED:228 — SlidePreview.scrubExternalRefs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 2 (3 pts), ternaries 1 (3 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 · html2pptx.html2pptx (cognitive 16) · ×1
  • html2pptx.html2pptx (cognitive 16) backend/skills/s_pptx/scripts/html2pptx.js:896 — html2pptx.html2pptx has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 4, ternaries 2 (3 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 · MarkdownRenderer.MermaidModal (cognitive 16) · ×1
  • MarkdownRenderer.MermaidModal (cognitive 16) REDACTED:101 — MarkdownRenderer.MermaidModal has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 4). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 121, 166, 165, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · MarkdownRenderer.isWorkspaceFilePath (cognitive 16) · ×1
  • MarkdownRenderer.isWorkspaceFilePath (cognitive 16) REDACTED:714 — MarkdownRenderer.isWorkspaceFilePath has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 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 · TurnZones.StageGroup (cognitive 16) · ×1
  • TurnZones.StageGroup (cognitive 16) desktop/src/pages/chat/components/TurnZones.tsx:898 — TurnZones.StageGroup has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, ternaries 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 · ReturnPanel.ReturnPanel (cognitive 16) · ×1
  • ReturnPanel.ReturnPanel (cognitive 16) desktop/src/components/swarm-out/ReturnPanel.tsx:29 — ReturnPanel.ReturnPanel has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, ternaries 4 (6 pts), if/else 2, error handling 1 (nesting depth added 2). Of this number, 10 points are the body's own statements and 6 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runReview.machineChecks (cognitive 16) · ×1
  • runReview.machineChecks (cognitive 16) desktop/src/components/swarm-out/runReview.ts:303 — runReview.machineChecks has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (8 pts), if/else 6, boolean chains 2 (nesting depth added 3). Of this number, 14 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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 · LibraryOverlay.AddFolderButton · ×1
  • LibraryOverlay.AddFolderButton::onClick (cognitive 16) desktop/src/components/layout/LibraryOverlay.tsx:345 — LibraryOverlay.AddFolderButton::onClick has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 3 (9 pts), boolean chains 3, error handling 2 (3 pts), if/else 1 (nesting depth added 7). 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 · BrainMap.BrainMap (cognitive 16) · ×1
  • BrainMap.BrainMap (cognitive 16) desktop/src/components/layout/BrainMap.tsx:156 — BrainMap.BrainMap has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 10 (13 pts), boolean chains 3 (nesting depth added 3). Of this number, 9 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · JobsRunsOverlay.JobDetailDrawer (cognitive 16) · ×1
  • JobsRunsOverlay.JobDetailDrawer (cognitive 16) desktop/src/components/layout/JobsRunsOverlay.tsx:296 — JobsRunsOverlay.JobDetailDrawer has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, ternaries 5 (6 pts), if/else 3 (nesting depth added 1). Of this number, 12 points are the body's own statements and 4 belong to 4 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · OverviewTab.ReleaseChecks (cognitive 16) · ×1
  • OverviewTab.ReleaseChecks (cognitive 16) desktop/src/pages/eval/OverviewTab.tsx:137 — OverviewTab.ReleaseChecks has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (11 pts), boolean chains 5 (nesting depth added 3). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 164, 142, 153, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ConnectAccount.MoreWays (cognitive 16) · ×1
  • ConnectAccount.MoreWays (cognitive 16) desktop/src/components/awsAccount/ConnectAccount.tsx:840 — ConnectAccount.MoreWays has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (5 pts), ternaries 3 (nesting depth added 1). Of this number, 8 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · useCanvasHost.useCanvasHost.getCanvasSnapshotFor (cognitive 16) · ×1
  • useCanvasHost.useCanvasHost.getCanvasSnapshotFor (cognitive 16) desktop/src/hooks/useCanvasHost.ts:469 — useCanvasHost.useCanvasHost.getCanvasSnapshotFor has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (10 pts), boolean chains 4, if/else 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 · TSCCModules.PromptTab (cognitive 16) · ×1
  • TSCCModules.PromptTab (cognitive 16) desktop/src/pages/chat/components/TSCCModules.tsx:551 — TSCCModules.PromptTab has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 9 (12 pts), boolean chains 2, error handling 1, if/else 1 (nesting depth added 3). Of this number, 13 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · TSCCPopoverButton.TSCCPopoverButton (cognitive 16) · ×1
  • TSCCPopoverButton.TSCCPopoverButton (cognitive 16) desktop/src/pages/chat/components/TSCCPopoverButton.tsx:64 — TSCCPopoverButton.TSCCPopoverButton has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, boolean chains 4, ternaries 3 (4 pts) (nesting depth added 1). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 106, 83, 73, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Medium advisory (unsound) · ×1
  • REDACTED
D35 · Change Coupling · Change-coupling hub · ×1
  • Change-coupling hub: BrainHubHome.tsx → ddd_brain.py, BrainMap.tsx, BrainMapView.tsx desktop/src/components/layout/BrainHubHome.tsx — `desktop/src/components/layout/BrainHubHome.tsx` changes together with 3 other files — `backend/routers/ddd_brain.py`, `desktop/src/components/layout/BrainMap.tsx`, `desktop/src/components/layout/BrainMapView.tsx` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Edited copy of a member (27 corresponding lines) · ×1
  • Edited copy of a member (27 corresponding lines) backend/core/ddd_job_registry.py:234 — backend/core/ddd_job_registry.py:234-260 | backend/core/ddd_skill_registry.py:299-327 — 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 · Members sharing a duplicated core (12 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (12 members, 50+ identical tokens) backend/skills/s_docx/ooxml/scripts/validation/base.py:187 — backend/skills/s_docx/ooxml/scripts/validation/base.py:187-275 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:73-122 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:125-171 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:217-261 | backend/skills/s_docx/ooxml/scripts/validation/pptx.py:78-119 | backend/skills/s_docx/ooxml/scripts/validation/pptx.py:129-201 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:187-278 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:73-122 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:125-171 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:217-261 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:78-119 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:129-201 — These 12 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 12 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 12 times.
D4 · Code Duplication · Members sharing a duplicated core (11 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (11 members, 50+ identical tokens) backend/database/sqlite.py:1308 — backend/database/sqlite.py:1308-1316 | backend/database/sqlite.py:1424-1432 | backend/database/sqlite.py:1525-1533 | backend/database/sqlite.py:1669-1677 | backend/database/sqlite.py:1721-1729 | backend/database/sqlite.py:1757-1765 | backend/database/sqlite.py:1846-1854 | backend/database/sqlite.py:1857-1868 | backend/database/sqlite.py:1966-1974 | backend/database/sqlite.py:1977-1985 | backend/database/sqlite.py:2078-2086 — These 11 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 11 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 11 times.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (6 members, 50+ identical tokens) backend/skills/s_context-hygiene/scripts/scan.py:59 — backend/skills/s_context-hygiene/scripts/scan.py:59-66 | backend/skills/s_loops-health/scripts/loops_health_check.py:32-39 | backend/skills/s_pollinate/scripts/generate_shorts.py:40-47 | backend/skills/s_pollinate/scripts/publish_to_pages.py:47-54 | backend/skills/s_pollinate/scripts/render_style_thumbnails.py:19-26 | backend/skills/s_project-manager/scripts/verify_ddd_complete.py:64-71 — 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 · Duplicated block (117 lines × 2) · ×1
  • Duplicated block (117 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:523 — backend/skills/s_docx/ooxml/scripts/validation/base.py:523-639 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:526-642 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (109 lines × 2) · ×1
  • Duplicated block (109 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:278 — backend/skills/s_docx/ooxml/scripts/validation/base.py:278-386 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:281-389 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (96 lines × 2) · ×1
  • Duplicated block (96 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:389 — backend/skills/s_docx/ooxml/scripts/validation/base.py:389-484 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:392-487 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (90 lines × 2) · ×1
  • Duplicated block (90 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/redlining.py:23 — backend/skills/s_docx/ooxml/scripts/validation/redlining.py:23-112 | backend/skills/s_pptx/ooxml/scripts/validation/redlining.py:23-112 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/redlining.py` and `backend/skills/s_pptx/ooxml/scripts/validation/redlining.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 245 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (76 lines × 2) · ×1
  • Duplicated block (76 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/redlining.py:140 — backend/skills/s_docx/ooxml/scripts/validation/redlining.py:140-215 | backend/skills/s_pptx/ooxml/scripts/validation/redlining.py:140-215 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/redlining.py` and `backend/skills/s_pptx/ooxml/scripts/validation/redlining.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 245 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (73 lines × 2) · ×1
  • Duplicated block (73 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/pptx.py:129 — backend/skills/s_docx/ooxml/scripts/validation/pptx.py:129-201 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:129-201 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/pptx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/pptx.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 298 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (68 lines × 2) · ×1
  • Duplicated block (68 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/pptx.py:244 — backend/skills/s_docx/ooxml/scripts/validation/pptx.py:244-311 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:244-311 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/pptx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/pptx.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 298 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (64 lines × 2) · ×1
  • Duplicated block (64 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:206 — backend/skills/s_docx/ooxml/scripts/validation/base.py:206-269 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:209-272 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `backend/skills/s_pptx/ooxml/scripts/validation/base.py:207` calls `isinstance` and `backend/skills/s_docx/ooxml/scripts/validation/base.py:204` 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 (57 lines × 2) · ×1
  • Duplicated block (57 lines × 2) backend/core/daemon_guard.py:354 — backend/core/daemon_guard.py:354-410 | desktop/resources/daemon/daemon_guard.py:354-410 — before extracting anything, compare `backend/core/daemon_guard.py` and `desktop/resources/daemon/daemon_guard.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (51 lines × 2) · ×1
  • Duplicated block (51 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:689 — backend/skills/s_docx/ooxml/scripts/validation/base.py:689-739 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:692-742 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (49 lines × 2) · ×1
  • Duplicated block (49 lines × 2) backend/skills/s_docx/ooxml/scripts/validate.py:17 — backend/skills/s_docx/ooxml/scripts/validate.py:17-65 | backend/skills/s_pptx/ooxml/scripts/validate.py:17-65 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validate.py` and `backend/skills/s_pptx/ooxml/scripts/validate.py` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (47 lines × 2) · ×1
  • Duplicated block (47 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/pptx.py:29 — backend/skills/s_docx/ooxml/scripts/validation/pptx.py:29-75 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:29-75 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/pptx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/pptx.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 298 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (46 lines × 2) · ×1
  • Duplicated block (46 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/docx.py:25 — backend/skills/s_docx/ooxml/scripts/validation/docx.py:25-70 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:25-70 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/docx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/docx.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 244 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (45 lines × 2) · ×1
  • Duplicated block (45 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:642 — backend/skills/s_docx/ooxml/scripts/validation/base.py:642-686 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:645-689 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (42 lines × 2) · ×1
  • Duplicated block (42 lines × 2) backend/skills/s_docx/ooxml/scripts/pack.py:46 — backend/skills/s_docx/ooxml/scripts/pack.py:46-87 | backend/skills/s_pptx/ooxml/scripts/pack.py:46-87 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/pack.py` and `backend/skills/s_pptx/ooxml/scripts/pack.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 127 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (40 lines × 2) · ×1
  • Duplicated block (40 lines × 2) backend/skills/s_docx/ooxml/scripts/pack.py:91 — backend/skills/s_docx/ooxml/scripts/pack.py:91-130 | backend/skills/s_pptx/ooxml/scripts/pack.py:91-130 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/pack.py` and `backend/skills/s_pptx/ooxml/scripts/pack.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 127 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (33–39 lines × 2) · ×1
  • Duplicated block (33–39 lines × 2) backend/core/skill_manager.py:1116 — backend/core/skill_manager.py:1116-1154 | backend/core/skill_manager.py:1213-1245 — both copies are in the same file, so extract the 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 (24–38 lines × 2) · ×1
  • Duplicated block (24–38 lines × 2) backend/core/library_mounts.py:541 — backend/core/library_mounts.py:541-564 | backend/core/library_mounts.py:601-638 — both copies are in the same file, so extract the 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 (37 lines × 2) · ×1
  • Duplicated block (37 lines × 2) backend/hooks/evolution_maintenance_hook.py:50 — backend/hooks/evolution_maintenance_hook.py:50-86 | backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:74-110 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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 (36 lines × 2) · ×1
  • Duplicated block (36 lines × 2) backend/routers/chat.py:733 — backend/routers/chat.py:733-768 | backend/routers/chat.py:1713-1748 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/routers/chat.py:733` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (31–33 lines × 2) · ×1
  • Duplicated block (31–33 lines × 2) backend/database/sqlite.py:3387 — backend/database/sqlite.py:3387-3417 | backend/database/sqlite.py:3439-3471 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/database/sqlite.py:3387` it does not close everything it opens, so those 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 (33 lines × 2) · ×1
  • Duplicated block (33 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/docx.py:217 — backend/skills/s_docx/ooxml/scripts/validation/docx.py:217-249 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:217-249 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/docx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/docx.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 244 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 `backend/skills/s_docx/ooxml/scripts/validation/docx.py:217` it does not close everything it opens, so those exact 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 (29–31 lines × 2) · ×1
  • Duplicated block (29–31 lines × 2) backend/core/streaming_orchestrator.py:2789 — backend/core/streaming_orchestrator.py:2789-2817 | backend/core/streaming_orchestrator.py:2998-3028 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/core/streaming_orchestrator.py:2789` it does not close everything it opens, so those 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–31 lines × 2) · ×1
  • Duplicated block (26–31 lines × 2) backend/routers/workspace.py:485 — backend/routers/workspace.py:485-515 | backend/routers/workspace.py:591-616 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (30 lines × 2) · ×1
  • Duplicated block (30 lines × 2) backend/core/plugin_manager.py:208 — backend/core/plugin_manager.py:208-237 | backend/core/plugin_manager.py:974-1003 — both copies are in the same file, so extract the 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 (26–29 lines × 2) · ×1
  • Duplicated block (26–29 lines × 2) REDACTED:1108 — REDACTED:1108-1133 | REDACTED:1230-1258 — both copies are in the same file, so extract the 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 (29 lines × 2) · ×1
  • Duplicated block (29 lines × 2) backend/core/session_hooks.py:518 — backend/core/session_hooks.py:518-546 | backend/core/session_hooks.py:573-601 — both copies are in the same file, so extract the 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 (25–29 lines × 2) · ×1
  • Duplicated block (25–29 lines × 2) backend/scripts/eval_runner.py:690 — backend/scripts/eval_runner.py:690-718 | backend/scripts/eval_runner.py:818-842 — both copies are in the same file, so extract the 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 (28 lines × 2) · ×1
  • Duplicated block (28 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:157 — backend/skills/s_docx/ooxml/scripts/validation/base.py:157-184 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:157-184 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (19–27 lines × 2) · ×1
  • Duplicated block (19–27 lines × 2) backend/core/knowledge_store.py:721 — backend/core/knowledge_store.py:721-747 | backend/core/knowledge_store.py:771-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. The matched lines also transfer control out of the body holding them, 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, `backend/core/knowledge_store.py:750` calls `debug`, `_fts5_fallback_search` and `backend/core/knowledge_store.py:790` 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 (22–27 lines × 2) · ×1
  • Duplicated block (22–27 lines × 2) backend/database/sqlite.py:3719 — backend/database/sqlite.py:3719-3745 | backend/database/sqlite.py:3768-3789 — both copies are in the same file, so extract the 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, `backend/database/sqlite.py:3790` calls `fetchone`, `execute` and `backend/database/sqlite.py:3746` 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 (27 lines × 2) · ×1
  • Duplicated block (27 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:128 — backend/skills/s_docx/ooxml/scripts/validation/base.py:128-154 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:128-154 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (24–25 lines × 2) · ×1
  • Duplicated block (24–25 lines × 2) backend/core/ddd_job_registry.py:234 — backend/core/ddd_job_registry.py:234-257 | backend/core/ddd_skill_registry.py:299-323 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 `backend/core/ddd_job_registry.py:234` it does not close everything it opens, so those exact 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, `backend/core/ddd_skill_registry.py:324` calls `isinstance`, `get` and `backend/core/ddd_job_registry.py:258` 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 (21–25 lines × 2) · ×1
  • Duplicated block (21–25 lines × 2) REDACTED:273 — REDACTED:273-297 | REDACTED:389-409 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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, `REDACTED:268` calls `get`, `update` and `REDACTED:388` 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 (25 lines × 2) · ×1
  • Duplicated block (25 lines × 2) backend/routers/workspace_api.py:2035 — backend/routers/workspace_api.py:2035-2059 | backend/routers/workspace_api.py:2115-2139 — both copies are in the same file, so extract the 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 (23–24 lines × 3) · ×1
  • Duplicated block (23–24 lines × 3) backend/database/sqlite.py:827 — backend/database/sqlite.py:827-850 | backend/database/sqlite.py:867-890 | backend/database/sqlite.py:938-960 — 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 (15–23 lines × 2) · ×1
  • Duplicated block (15–23 lines × 2) backend/database/sqlite.py:3656 — backend/database/sqlite.py:3656-3678 | backend/database/sqlite.py:3750-3764 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (20–22 lines × 2) · ×1
  • Duplicated block (20–22 lines × 2) backend/skills/s_frontend-design/scripts/design_system.py:461 — backend/skills/s_frontend-design/scripts/design_system.py:461-482 | backend/skills/s_frontend-design/scripts/design_system.py:647-666 — both copies are in the same file, so extract the 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 (11–21 lines × 3) · ×1
  • Duplicated block (11–21 lines × 3) backend/routers/hive.py:635 — backend/routers/hive.py:635-648 | backend/routers/hive.py:713-723 | backend/routers/hive.py:749-769 — 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 (13–21 lines × 3) · ×1
  • Duplicated block (13–21 lines × 3) backend/skills/s_notify/notify.py:86 — backend/skills/s_notify/notify.py:86-106 | backend/skills/s_notify/notify.py:110-122 | backend/skills/s_notify/notify.py:126-138 — 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 (20–21 lines × 2) · ×1
  • Duplicated block (20–21 lines × 2) backend/core/attention_authority.py:340 — backend/core/attention_authority.py:340-359 | backend/core/attention_authority.py:364-384 — both copies are in the same file, so extract the 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 (12–21 lines × 2) · ×1
  • Duplicated block (12–21 lines × 2) backend/core/chat_thread_manager.py:90 — backend/core/chat_thread_manager.py:90-101 | backend/core/todo_manager.py:610-630 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (17–21 lines × 2) · ×1
  • Duplicated block (17–21 lines × 2) backend/core/recall_multi.py:1297 — backend/core/recall_multi.py:1297-1317 | backend/core/recall_multi.py:1332-1348 — both copies are in the same file, so extract the 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 (20 lines × 2) · ×1
  • Duplicated block (20 lines × 2) backend/routers/workspace.py:346 — backend/routers/workspace.py:346-365 | backend/routers/workspace.py:435-454 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14–20 lines × 2) · ×1
  • Duplicated block (14–20 lines × 2) backend/skills/s_estimate-tokens/scripts/estimate_tokens.py:92 — backend/skills/s_estimate-tokens/scripts/estimate_tokens.py:92-111 | backend/skills/s_library/scripts/library.py:30-43 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, 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–19 lines × 2) · ×1
  • Duplicated block (11–19 lines × 2) backend/core/resource_monitor.py:478 — backend/core/resource_monitor.py:478-488 | backend/core/resource_monitor.py:595-613 — both copies are in the same file, so extract the 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 (17–18 lines × 2) · ×1
  • Duplicated block (17–18 lines × 2) backend/core/session_unit.py:2941 — backend/core/session_unit.py:2941-2958 | backend/core/session_unit.py:5520-5536 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/core/session_unit.py:2941` it begins part-way through the construct above it, so those 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–18 lines × 2) · ×1
  • Duplicated block (14–18 lines × 2) backend/middleware/error_handler.py:98 — backend/middleware/error_handler.py:98-115 | backend/middleware/error_handler.py:144-157 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/middleware/error_handler.py:98` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `exc` to `RequestValidationError` in one and `ValidationError` 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 (15–17 lines × 3) · ×1
  • Duplicated block (15–17 lines × 3) backend/skills/s_frontend-design/scripts/design_system.py:718 — backend/skills/s_frontend-design/scripts/design_system.py:718-732 | backend/skills/s_frontend-design/scripts/design_system.py:751-765 | backend/skills/s_frontend-design/scripts/design_system.py:781-797 — 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) · ×1
  • Duplicated block (12–17 lines × 2) backend/core/voice_synthesize.py:329 — backend/core/voice_synthesize.py:329-345 | backend/skills/s_pollinate/scripts/tts/backends/polly.py:173-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.
D4 · Code Duplication · Duplicated block (14–16 lines × 4) · ×1
  • Duplicated block (14–16 lines × 4) backend/scripts/artifact_cli.py:562 — backend/scripts/artifact_cli.py:562-576 | backend/scripts/artifact_cli.py:588-603 | backend/scripts/artifact_cli.py:614-627 | backend/scripts/artifact_cli.py:711-724 — 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 (14–16 lines × 3) · ×1
  • Duplicated block (14–16 lines × 3) backend/core/context_injector.py:385 — backend/core/context_injector.py:385-400 | backend/core/context_injector.py:423-438 | backend/core/context_injector.py:459-472 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `backend/core/context_injector.py:458` calls `set` and `backend/core/context_injector.py:384` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (13–16 lines × 2) · ×1
  • Duplicated block (13–16 lines × 2) backend/hive/provisioner.py:1272 — backend/hive/provisioner.py:1272-1284 | backend/hive/provisioner.py:1408-1423 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (14–16 lines × 2) · ×1
  • Duplicated block (14–16 lines × 2) REDACTED:100 — REDACTED:100-115 | REDACTED:133-146 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:100` it begins part-way through the construct above it, so those exact 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–15 lines × 3) · ×1
  • Duplicated block (13–15 lines × 3) backend/database/sqlite.py:3629 — backend/database/sqlite.py:3629-3643 | backend/database/sqlite.py:3715-3727 | backend/database/sqlite.py:3746-3758 — 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 (14–15 lines × 2) · ×1
  • Duplicated block (14–15 lines × 2) backend/core/streaming_orchestrator.py:1677 — backend/core/streaming_orchestrator.py:1677-1690 | backend/core/streaming_orchestrator.py:1942-1956 — both copies are in the same file, so extract the 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 (9–15 lines × 2) · ×1
  • Duplicated block (9–15 lines × 2) backend/skills/s_loops-health/scripts/loops_health_check.py:367 — backend/skills/s_loops-health/scripts/loops_health_check.py:367-375 | backend/skills/s_loops-health/scripts/loops_health_check.py:419-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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `backend/skills/s_loops-health/scripts/loops_health_check.py:416` calls `_check_coherence`, `_read_safe` and `backend/skills/s_loops-health/scripts/loops_health_check.py:362` 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 (14 lines × 6) · ×1
  • Duplicated block (14 lines × 6) backend/skills/s_docx/ooxml/scripts/validation/docx.py:103 — backend/skills/s_docx/ooxml/scripts/validation/docx.py:103-116 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:152-165 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:242-255 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:103-116 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:152-165 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:242-255 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/docx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/docx.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 244 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 `backend/skills/s_docx/ooxml/scripts/validation/docx.py:103` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–14 lines × 2) · ×1
  • Duplicated block (12–14 lines × 2) backend/channels/streaming.py:312 — backend/channels/streaming.py:312-325 | backend/channels/streaming.py:365-376 — both copies are in the same file, so extract the 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 (11–14 lines × 2) · ×1
  • Duplicated block (11–14 lines × 2) backend/database/sqlite.py:594 — backend/database/sqlite.py:594-604 | backend/database/sqlite.py:2009-2022 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/database/sqlite.py:594` it does not close everything it opens, so those 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–14 lines × 2) · ×1
  • Duplicated block (13–14 lines × 2) backend/skills/s_docx/scripts/document.py:404 — backend/skills/s_docx/scripts/document.py:404-416 | backend/skills/s_docx/scripts/document.py:507-520 — both copies are in the same file, so extract the 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 (13 lines × 10) · ×1
  • Duplicated block (13 lines × 10) backend/skills/s_docx/ooxml/scripts/validation/base.py:263 — backend/skills/s_docx/ooxml/scripts/validation/base.py:263-275 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:110-122 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:159-171 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:249-261 | backend/skills/s_docx/ooxml/scripts/validation/pptx.py:107-119 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:266-278 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:110-122 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:159-171 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:249-261 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:107-119 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (11–13 lines × 4) · ×1
  • Duplicated block (11–13 lines × 4) backend/database/sqlite.py:3632 — backend/database/sqlite.py:3632-3644 | backend/database/sqlite.py:3661-3673 | backend/database/sqlite.py:3718-3728 | backend/database/sqlite.py:3749-3759 — 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, `backend/database/sqlite.py:3648` calls `execute`, `fetchall` and `backend/database/sqlite.py:3761` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11–13 lines × 2) · ×1
  • Duplicated block (11–13 lines × 2) backend/core/ddd_job_registry.py:138 — backend/core/ddd_job_registry.py:138-148 | backend/core/ddd_skill_registry.py:192-204 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (9–12 lines × 11) · ×1
  • Duplicated block (9–12 lines × 11) backend/database/sqlite.py:1308 — backend/database/sqlite.py:1308-1316 | backend/database/sqlite.py:1424-1432 | backend/database/sqlite.py:1525-1533 | backend/database/sqlite.py:1669-1677 | backend/database/sqlite.py:1721-1729 | backend/database/sqlite.py:1757-1765 | backend/database/sqlite.py:1846-1854 | backend/database/sqlite.py:1857-1868 | backend/database/sqlite.py:1966-1974 | backend/database/sqlite.py:1977-1985 | backend/database/sqlite.py:2078-2086 — all 11 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (12 lines × 8) · ×1
  • Duplicated block (12 lines × 8) backend/database/sqlite.py:3621 — backend/database/sqlite.py:3621-3632 | backend/database/sqlite.py:3641-3652 | backend/database/sqlite.py:3678-3689 | backend/database/sqlite.py:3690-3702 | backend/database/sqlite.py:3703-3718 | backend/database/sqlite.py:3798-3810 | backend/database/sqlite.py:3811-3823 | backend/database/sqlite.py:3824-3844 — 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.
D4 · Code Duplication · Duplicated block (12 lines × 6) · ×1
  • Duplicated block (12 lines × 6) backend/skills/s_frontend-design/scripts/design_system.py:515 — backend/skills/s_frontend-design/scripts/design_system.py:515-526 | backend/skills/s_frontend-design/scripts/design_system.py:686-697 | backend/skills/s_frontend-design/scripts/design_system.py:745-756 | backend/skills/s_frontend-design/scripts/design_system.py:790-801 | backend/skills/s_frontend-design/scripts/design_system.py:902-915 | backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:528-541 — 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.
D4 · Code Duplication · Duplicated block (11–12 lines × 3) · ×1
  • Duplicated block (11–12 lines × 3) backend/skills/s_estimate-tokens/scripts/estimate_tokens.py:58 — backend/skills/s_estimate-tokens/scripts/estimate_tokens.py:58-68 | backend/skills/s_estimate-tokens/scripts/estimate_tokens.py:104-115 | backend/skills/s_library/scripts/library.py:37-47 — 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.
D4 · Code Duplication · Duplicated block (10–12 lines × 2) · ×1
  • Duplicated block (10–12 lines × 2) backend/routers/eval.py:257 — backend/routers/eval.py:257-268 | backend/routers/eval.py:291-300 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9–11 lines × 3) · ×1
  • Duplicated block (9–11 lines × 3) backend/routers/channels.py:320 — backend/routers/channels.py:320-328 | backend/routers/channels.py:370-378 | backend/routers/channels.py:388-398 — 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 `backend/routers/channels.py:388` it begins part-way through the construct above it, so those exact 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–11 lines × 3) · ×1
  • Duplicated block (8–11 lines × 3) backend/skills/s_pollinate/scripts/check_rpv.py:65 — backend/skills/s_pollinate/scripts/check_rpv.py:65-72 | backend/skills/s_pollinate/scripts/check_rpv.py:141-148 | backend/skills/s_pollinate/scripts/check_rpv.py:168-178 — 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 (9–11 lines × 2) · ×1
  • Duplicated block (9–11 lines × 2) backend/core/app_provenance.py:139 — backend/core/app_provenance.py:139-147 | backend/core/app_provenance.py: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.
D4 · Code Duplication · Duplicated block (8–11 lines × 2) · ×1
  • Duplicated block (8–11 lines × 2) backend/routers/chat.py:341 — backend/routers/chat.py:341-351 | backend/routers/todos.py:493-500 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (10–11 lines × 2) · ×1
  • Duplicated block (10–11 lines × 2) backend/skills/s_pollinate/scripts/tts/backends/azure.py:25 — backend/skills/s_pollinate/scripts/tts/backends/azure.py:25-34 | backend/skills/s_pollinate/scripts/tts/backends/polly.py:274-284 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `backend/skills/s_pollinate/scripts/tts/backends/azure.py:22` calls `get` and `backend/skills/s_pollinate/scripts/tts/backends/polly.py:272` 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 (10 lines × 10) · ×1
  • Duplicated block (10 lines × 10) backend/skills/s_docx/ooxml/scripts/validation/docx.py:107 — backend/skills/s_docx/ooxml/scripts/validation/docx.py:107-116 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:156-165 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:246-255 | backend/skills/s_docx/ooxml/scripts/validation/pptx.py:104-113 | backend/skills/s_docx/ooxml/scripts/validation/pptx.py:183-192 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:107-116 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:156-165 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:246-255 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:104-113 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:183-192 — there are 10 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 10 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `backend/skills/s_docx/ooxml/scripts/validation/docx.py:107` it begins part-way through the construct above it, so those 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) backend/database/sqlite.py:602 — backend/database/sqlite.py:602-609 | backend/database/sqlite.py:1782-1790 | backend/database/sqlite.py:2019-2028 | backend/database/sqlite.py:2067-2075 — 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 `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 (9–10 lines × 4) · ×1
  • Duplicated block (9–10 lines × 4) backend/skills/s_docx/scripts/document.py:320 — backend/skills/s_docx/scripts/document.py:320-328 | backend/skills/s_docx/scripts/document.py:401-409 | backend/skills/s_docx/scripts/document.py:504-513 | backend/skills/s_docx/scripts/document.py:561-570 — 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, `backend/skills/s_docx/scripts/document.py:573` calls `getElementsByTagName` and `backend/skills/s_docx/scripts/document.py:412` 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–10 lines × 5) · ×1
  • Duplicated block (7–10 lines × 5) backend/skills/s_frontend-design/scripts/design_system.py:911 — backend/skills/s_frontend-design/scripts/design_system.py:911-920 | backend/skills/s_frontend-design/scripts/design_system.py:922-931 | backend/skills/s_frontend-design/scripts/design_system.py:933-942 | backend/skills/s_frontend-design/scripts/design_system.py:944-953 | backend/skills/s_frontend-design/scripts/design_system.py:954-960 — 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. 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–10 lines × 2) · ×1
  • Duplicated block (7–10 lines × 2) REDACTED:1934 — REDACTED:1934-1940 | REDACTED:2019-2028 — both copies are in the same file, so extract the 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 (9 lines × 12) · ×1
  • Duplicated block (9 lines × 12) backend/skills/s_docx/ooxml/scripts/validation/base.py:262 — backend/skills/s_docx/ooxml/scripts/validation/base.py:262-270 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:109-117 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:158-166 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:248-256 | backend/skills/s_docx/ooxml/scripts/validation/pptx.py:106-114 | backend/skills/s_docx/ooxml/scripts/validation/pptx.py:185-193 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:265-273 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:109-117 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:158-166 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:248-256 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:106-114 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:185-193 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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 (9 lines × 10) · ×1
  • Duplicated block (9 lines × 10) backend/database/sqlite.py:3616 — backend/database/sqlite.py:3616-3624 | backend/database/sqlite.py:3628-3636 | backend/database/sqlite.py:3685-3693 | backend/database/sqlite.py:3698-3706 | backend/database/sqlite.py:3714-3722 | backend/database/sqlite.py:3745-3753 | backend/database/sqlite.py:3793-3801 | backend/database/sqlite.py:3806-3814 | backend/database/sqlite.py:3819-3827 | backend/database/sqlite.py:3840-3848 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backend/database/sqlite.py:3628` calls `execute`, `fetchall` and `backend/database/sqlite.py:3640` 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 × 3) · ×1
  • Duplicated block (8–9 lines × 3) backend/skills/s_pollinate/scripts/tts/backends/azure.py:26 — backend/skills/s_pollinate/scripts/tts/backends/azure.py:26-33 | backend/skills/s_pollinate/scripts/tts/backends/edge.py:24-31 | backend/skills/s_pollinate/scripts/tts/backends/polly.py:275-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 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, `backend/skills/s_pollinate/scripts/tts/backends/azure.py:22` calls `get` and `backend/skills/s_pollinate/scripts/tts/backends/polly.py:272` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×1
  • Duplicated block (8–9 lines × 2) backend/core/run_protocol/schemas.py:264 — backend/core/run_protocol/schemas.py:264-272 | backend/core/run_protocol/schemas.py:411-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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (7–9 lines × 2) · ×1
  • Duplicated block (7–9 lines × 2) backend/skills/s_frontend-design/scripts/design_system.py:816 — backend/skills/s_frontend-design/scripts/design_system.py:816-822 | backend/skills/s_frontend-design/scripts/design_system.py:829-837 — both copies are in the same file, so extract the 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 (3–8 lines × 3) · ×1
  • Duplicated block (3–8 lines × 3) backend/core/run_protocol/audit.py:948 — backend/core/run_protocol/audit.py:948-955 | backend/core/run_protocol/engine.py:94-101 | backend/core/run_protocol/landing.py:481-483 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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. 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 × 6) · ×1
  • Duplicated block (7 lines × 6) backend/skills/s_context-hygiene/scripts/scan.py:59 — backend/skills/s_context-hygiene/scripts/scan.py:59-65 | backend/skills/s_loops-health/scripts/loops_health_check.py:32-38 | backend/skills/s_pollinate/scripts/generate_shorts.py:40-46 | backend/skills/s_pollinate/scripts/publish_to_pages.py:47-53 | backend/skills/s_pollinate/scripts/render_style_thumbnails.py:19-25 | backend/skills/s_project-manager/scripts/verify_ddd_complete.py:64-70 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 6 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 6 times. Read the line range as the matched WINDOW rather than a finished unit: at `backend/skills/s_context-hygiene/scripts/scan.py:59` it begins part-way through the construct above it, so those exact 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 (7 lines × 3) · ×1
  • Duplicated block (7 lines × 3) backend/jobs/scheduler.py:573 — backend/jobs/scheduler.py:573-579 | backend/jobs/scheduler.py:603-609 | backend/jobs/scheduler.py:621-627 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `backend/jobs/scheduler.py:619` calls `set` and `backend/jobs/scheduler.py:598` 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–7 lines × 2) · ×1
  • Duplicated block (6–7 lines × 2) backend/core/code_intel/graph_store.py:774 — backend/core/code_intel/graph_store.py:774-780 | backend/core/code_intel/graph_store.py:843-848 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `backend/core/code_intel/graph_store.py:774` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 4) · ×1
  • Duplicated block (6 lines × 4) backend/skills/s_pollinate/scripts/check_rpv.py:25 — backend/skills/s_pollinate/scripts/check_rpv.py:25-30 | backend/skills/s_pollinate/scripts/check_rpv.py:67-72 | backend/skills/s_pollinate/scripts/check_rpv.py:143-148 | backend/skills/s_pollinate/scripts/check_rpv.py:171-178 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backend/skills/s_pollinate/scripts/check_rpv.py:31` calls `get` and `backend/skills/s_pollinate/scripts/check_rpv.py:149` 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) backend/skills/s_frontend-design/scripts/design_system.py:439 — backend/skills/s_frontend-design/scripts/design_system.py:439-443 | backend/skills/s_frontend-design/scripts/design_system.py:455-458 | backend/skills/s_frontend-design/scripts/design_system.py:491-495 — 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.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×1
  • Duplicated block (5 lines × 4) backend/core/ingestion/sources/s3_run.py:36 — backend/core/ingestion/sources/s3_run.py:36-40 | backend/core/ingestion/sources/s4_code.py:48-52 | backend/core/ingestion/sources/s5_metrics.py:21-25 | backend/core/ingestion/sources/s6_external.py:19-23 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (16–18 lines × 2) · ×1
  • Duplicated block (16–18 lines × 2) desktop/src-tauri/src/lib.rs:2849 — desktop/src-tauri/src/lib.rs:2849-2866 | desktop/src-tauri/src/lib.rs:2912-2927 — both copies are in the same file, so extract the 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 (53–55 lines × 2) · ×1
  • Duplicated block (53–55 lines × 2) backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:378 — backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:378-430 | backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:485-539 — both copies are in the same file, so extract the 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 (35–43 lines × 2) · ×1
  • Duplicated block (35–43 lines × 2) backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:223 — backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:223-257 | backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:284-326 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:329` calls `match` and `backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:258` 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 (19–23 lines × 2) · ×1
  • Duplicated block (19–23 lines × 2) scripts/smoke_e2e.py:164 — scripts/smoke_e2e.py:164-186 | scripts/smoke_e2e.py:490-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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D8 · Code Coverage · Coverage not measured · ×1
  • Coverage not measured — JavaScript/TypeScript suite — Coverage NOT MEASURED: the JavaScript/TypeScript half could not be measured — desktop/ runs vitest but declares no coverage provider, so the suite can run and still produce no lcov — add `@vitest/coverage-v8` (or `@vitest/coverage-istanbul`) as a devDependency. Coverage is excluded from the score rather than counted as a near-zero. The named suite step is one the repository's maintainers can perform; once it passes, the real number is measured on the next scan. Alternatively, commit the lcov/Cobertura report your CI produces and it is read without a re-run.
P7 · Outbound HTTP resilience · Outbound HTTP without resilience · ×1
  • Outbound HTTP without resilience backend/core/run_protocol/findings.py:398 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
R10 · Code Duplication · Duplication concentrated across 13 sibling directories (45 clone groups) · ×1
  • Duplication concentrated across 13 sibling directories (45 clone groups) desktop/src/components/layout/PipelineRunCard.tsx:99 — 45 duplicated blocks under desktop/src/components/ have copies in at least two of the sibling directories awsAccount, chat, common, file-viewer, layout, modals (+7 more sibling(s) not listed) — 21 of them are reported below, and 24 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 45 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 45 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 45 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 8 sibling directories (44 clone groups) · ×1
  • Duplication concentrated across 8 sibling directories (44 clone groups) desktop/src/components/settings/BackupTab.tsx:21 — 44 duplicated blocks under desktop/src/ have copies in at least two of the sibling directories components, contexts, hooks, pages, services, stores (+2 more sibling(s) not listed) — 20 of them are reported below, and 24 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 44 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 44 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 44 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplicated block with local edits (127 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (127 matched lines × 2 locations) desktop/src/components/common/Dropdown.tsx:32 — desktop/src/components/common/Dropdown.tsx:32 · desktop/src/components/common/MultiSelect.tsx:37 — the two spans are one implementation copied and then locally edited — 669 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (78 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (78 matched lines × 2 locations) desktop/src/components/layout/PipelineRunCard.tsx:99 — desktop/src/components/layout/PipelineRunCard.tsx:99 · desktop/src/components/swarm-out/RunOverlay.tsx:767 — the two spans are one implementation copied and then locally edited — 1001 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (69 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (69 matched lines × 2 locations) desktop/src/components/settings/BackupTab.tsx:21 — desktop/src/components/settings/BackupTab.tsx:21 · desktop/src/pages/OnboardingPage.tsx:513 — the two spans are one implementation copied and then locally edited — 478 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (62 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (62 matched lines × 2 locations) desktop/src/components/file-viewer/renderers/CsvRenderer.tsx:16 — desktop/src/components/file-viewer/renderers/CsvRenderer.tsx:16 · desktop/src/components/file-viewer/renderers/PdfRenderer.tsx:22 — the two spans are one implementation copied and then locally edited — 377 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (61 lines × 2 locations) · ×1
  • Duplicated block (61 lines × 2 locations) desktop/src/components/workspace/FileBrowser.tsx:161 — desktop/src/components/workspace/FileBrowser.tsx:161 · desktop/src/components/workspace/FolderPickerModal.tsx:156 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
R10 · Code Duplication · Duplicated block with local edits (40 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (40 matched lines × 2 locations) desktop/src/components/layout/PipelineOverlay.tsx:100 — desktop/src/components/layout/PipelineOverlay.tsx:100 · desktop/src/components/swarm-out/RunList.tsx:90 — the two spans are one implementation copied and then locally edited — 459 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (39 lines × 2 locations) · ×1
  • Duplicated block (39 lines × 2 locations) desktop/src/components/file-viewer/FileViewerPanel.tsx:588 — desktop/src/components/file-viewer/FileViewerPanel.tsx:588 · desktop/src/components/file-viewer/FileViewerPanel.tsx:632 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block with local edits (38 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (38 matched lines × 2 locations) desktop/src/components/common/CommentPopover.tsx:131 — desktop/src/components/common/CommentPopover.tsx:131 · desktop/src/components/common/FileEditorCore.tsx:349 — the two spans are one implementation copied and then locally edited — 221 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (37 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (37 matched lines × 2 locations) desktop/src/services/tasks.ts:18 — desktop/src/services/tasks.ts:18 · desktop/src/services/todos.ts:31 — the two spans are one implementation copied and then locally edited — 345 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (36 lines × 2 locations) · ×1
  • Duplicated block (36 lines × 2 locations) desktop/src/hooks/useChatStreamingLifecycle.ts:2253 — desktop/src/hooks/useChatStreamingLifecycle.ts:2253 · desktop/src/hooks/useStreamingActivity.ts:42 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
R10 · Code Duplication · Duplicated block (34 lines × 2 locations) · ×1
  • Duplicated block (34 lines × 2 locations) desktop/src/pages/chat/components/ChatInput.tsx:826 — desktop/src/pages/chat/components/ChatInput.tsx:826 · desktop/src/pages/chat/components/ChatInput.tsx:865 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (32 lines × 2 locations) · ×1
  • Duplicated block (32 lines × 2 locations) desktop/src/components/layout/CMBrainOverlay.tsx:936 — desktop/src/components/layout/CMBrainOverlay.tsx:936 · desktop/src/components/layout/CMBrainOverlay.tsx:980 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (30 lines × 3 locations) · ×1
  • Duplicated block (30 lines × 3 locations) desktop/src/pages/SkillsPage.tsx:470 — desktop/src/pages/SkillsPage.tsx:470 · desktop/src/pages/SkillsPage.tsx:580 · desktop/src/pages/SkillsPage.tsx:748 — 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.
R10 · Code Duplication · Duplicated block (28 lines × 2 locations) · ×1
  • Duplicated block (28 lines × 2 locations) desktop/src/components/file-viewer/renderers/AudioRenderer.tsx:15 — desktop/src/components/file-viewer/renderers/AudioRenderer.tsx:15 · desktop/src/components/file-viewer/renderers/VideoRenderer.tsx:15 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
R10 · Code Duplication · Duplicated block (26 lines × 2 locations) · ×1
  • Duplicated block (26 lines × 2 locations) backend/skills/s_pollinate/templates/remotion/components/ShortCTACard.tsx:10 — backend/skills/s_pollinate/templates/remotion/components/ShortCTACard.tsx:10 · backend/skills/s_pollinate/templates/remotion/components/ShortIntroCard.tsx:11 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block with local edits (25 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (25 matched lines × 2 locations) desktop/src/pages/chat/components/CompactNotice.tsx:37 — desktop/src/pages/chat/components/CompactNotice.tsx:37 · desktop/src/pages/chat/components/CompactNotice.tsx:129 — the two spans are one implementation copied and then locally edited — 262 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (20 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (20 matched lines × 2 locations) desktop/src/components/common/BackendStartupOverlay.tsx:412 — desktop/src/components/common/BackendStartupOverlay.tsx:412 · desktop/src/components/common/BackendStartupOverlay.tsx:464 — the two spans are one implementation copied and then locally edited — 104 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (19 lines × 2 locations) · ×1
  • Duplicated block (19 lines × 2 locations) backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:135 — backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:135 · backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:166 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (17 lines × 2 locations) · ×1
  • Duplicated block (17 lines × 2 locations) backend/skills/s_pollinate/templates/remotion/components/animations.tsx:134 — backend/skills/s_pollinate/templates/remotion/components/animations.tsx:134 · backend/skills/s_pollinate/templates/remotion/components/animations.tsx:153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R2 · Cyclomatic Complexity · Complex function inner (cyclomatic 314, cognitive 522) · ×1
  • Complex function inner (cyclomatic 314, cognitive 522) desktop/src/hooks/useChatStreamingLifecycle.ts:2688 — inner has cyclomatic complexity 314 and cognitive complexity 522; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function main (cyclomatic 115, cognitive 152) · ×1
  • Complex function main (cyclomatic 115, cognitive 152) backend/skills/s_browser-agent/browser-agent.mjs:393 — main has cyclomatic complexity 115 and cognitive complexity 152; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function FileEditorCore (cyclomatic 102, cognitive 86) · ×1
  • Complex function FileEditorCore (cyclomatic 102, cognitive 86) desktop/src/components/common/FileEditorCore.tsx:688 — FileEditorCore has cyclomatic complexity 102 and cognitive complexity 86; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function ConnectAccount (cyclomatic 93, cognitive 88) · ×1
  • Complex function ConnectAccount (cyclomatic 93, cognitive 88) desktop/src/components/awsAccount/ConnectAccount.tsx:110 — ConnectAccount has cyclomatic complexity 93 and cognitive complexity 88; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 76, cognitive 128) · ×1
  • Complex function (anonymous) (cyclomatic 76, cognitive 128) backend/skills/s_pptx/scripts/html2pptx.js:534 — (anonymous) has cyclomatic complexity 76 and cognitive complexity 128; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function reconcile (cyclomatic 73, cognitive 115) · ×1
  • Complex function reconcile (cyclomatic 73, cognitive 115) desktop/src/hooks/useChatStreamingLifecycle.ts:1265 — reconcile has cyclomatic complexity 73 and cognitive complexity 115; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function AwsAccountTab (cyclomatic 71, cognitive 65) · ×1
  • Complex function AwsAccountTab (cyclomatic 71, cognitive 65) desktop/src/components/settings/AwsAccountTab.tsx:41 — AwsAccountTab has cyclomatic complexity 71 and cognitive complexity 65; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 67, cognitive 93) · ×1
  • Complex function (anonymous) (cyclomatic 67, cognitive 93) REDACTED:484 — (anonymous) has cyclomatic complexity 67 and cognitive complexity 93; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function AssistantMessageView (cyclomatic 65, cognitive 56) · ×1
  • Complex function AssistantMessageView (cyclomatic 65, cognitive 56) desktop/src/pages/chat/components/AssistantMessageView.tsx:226 — AssistantMessageView has cyclomatic complexity 65 and cognitive complexity 56; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function AgentRow (cyclomatic 60, cognitive 50) · ×1
  • Complex function AgentRow (cyclomatic 60, cognitive 50) desktop/src/pages/chat/components/TurnZones.tsx:513 — AgentRow has cyclomatic complexity 60 and cognitive complexity 50; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function ChatInput (cyclomatic 58, cognitive 54) · ×1
  • Complex function ChatInput (cyclomatic 58, cognitive 54) desktop/src/pages/chat/components/ChatInput.tsx:173 — ChatInput has cyclomatic complexity 58 and cognitive complexity 54; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function FileViewerPanelImpl (cyclomatic 58, cognitive 51) · ×1
  • Complex function FileViewerPanelImpl (cyclomatic 58, cognitive 51) desktop/src/components/file-viewer/FileViewerPanel.tsx:181 — FileViewerPanelImpl has cyclomatic complexity 58 and cognitive complexity 51; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function DispatchCard (cyclomatic 57, cognitive 42) · ×1
  • Complex function DispatchCard (cyclomatic 57, cognitive 42) desktop/src/pages/chat/components/DispatchCard.tsx:160 — DispatchCard has cyclomatic complexity 57 and cognitive complexity 42; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function deriveTurnView (cyclomatic 56, cognitive 72) · ×1
  • Complex function deriveTurnView (cyclomatic 56, cognitive 72) REDACTED:314 — deriveTurnView has cyclomatic complexity 56 and cognitive complexity 72; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function fetchFileContent (cyclomatic 54, cognitive 84) · ×1
  • Complex function fetchFileContent (cyclomatic 54, cognitive 84) desktop/src/components/file-viewer/FileViewer.tsx:321 — fetchFileContent has cyclomatic complexity 54 and cognitive complexity 84; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function CaseDetailView (cyclomatic 53, cognitive 50) · ×1
  • Complex function CaseDetailView (cyclomatic 53, cognitive 50) desktop/src/pages/eval/CasesTab.tsx:368 — CaseDetailView has cyclomatic complexity 53 and cognitive complexity 50; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function RunOverlay (cyclomatic 50, cognitive 45) · ×1
  • Complex function RunOverlay (cyclomatic 50, cognitive 45) desktop/src/components/swarm-out/RunOverlay.tsx:653 — RunOverlay has cyclomatic complexity 50 and cognitive complexity 45; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function labelBash (cyclomatic 49, cognitive 80) · ×1
  • Complex function labelBash (cyclomatic 49, cognitive 80) REDACTED:872 — labelBash has cyclomatic complexity 49 and cognitive complexity 80; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function CommandPanel (cyclomatic 49, cognitive 49) · ×1
  • Complex function CommandPanel (cyclomatic 49, cognitive 49) desktop/src/components/swarm-out/RunOverlay.tsx:337 — CommandPanel has cyclomatic complexity 49 and cognitive complexity 49; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 48, cognitive 50) · ×1
  • Complex function (anonymous) (cyclomatic 48, cognitive 50) desktop/src/hooks/useChatStreamingLifecycle.ts:3997 — (anonymous) has cyclomatic complexity 48 and cognitive complexity 50; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files · desktop/src/hooks/useChatStreamingLifecycle.ts · ×1
  • desktop/src/hooks/useChatStreamingLifecycle.ts: 4726 lines of code desktop/src/hooks/useChatStreamingLifecycle.ts:1 — desktop/src/hooks/useChatStreamingLifecycle.ts has 4726 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/pages/ChatPage.tsx · ×1
  • desktop/src/pages/ChatPage.tsx: 2917 lines of code desktop/src/pages/ChatPage.tsx:1 — desktop/src/pages/ChatPage.tsx has 2917 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/components/common/FileEditorCore.tsx · ×1
  • desktop/src/components/common/FileEditorCore.tsx: 2150 lines of code desktop/src/components/common/FileEditorCore.tsx:1 — desktop/src/components/common/FileEditorCore.tsx has 2150 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/types/index.ts · ×1
  • desktop/src/types/index.ts: 1663 lines of code desktop/src/types/index.ts:1 — desktop/src/types/index.ts has 1663 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/stores/MessageStore.ts · ×1
  • desktop/src/stores/MessageStore.ts: 1300 lines of code desktop/src/stores/MessageStore.ts:1 — desktop/src/stores/MessageStore.ts has 1300 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/components/layout/BrainHub.tsx · ×1
  • desktop/src/components/layout/BrainHub.tsx: 1243 lines of code desktop/src/components/layout/BrainHub.tsx:1 — desktop/src/components/layout/BrainHub.tsx has 1243 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · REDACTED · ×1
  • REDACTED: 1132 lines of code REDACTED:1 — REDACTED has 1132 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/components/layout/ToDoOverlay.tsx · ×1
  • desktop/src/components/layout/ToDoOverlay.tsx: 1131 lines of code desktop/src/components/layout/ToDoOverlay.tsx:1 — desktop/src/components/layout/ToDoOverlay.tsx has 1131 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/components/layout/CMBrainOverlay.tsx · ×1
  • desktop/src/components/layout/CMBrainOverlay.tsx: 1099 lines of code desktop/src/components/layout/CMBrainOverlay.tsx:1 — desktop/src/components/layout/CMBrainOverlay.tsx has 1099 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/pages/chat/components/ChatInput.tsx · ×1
  • desktop/src/pages/chat/components/ChatInput.tsx: 1062 lines of code desktop/src/pages/chat/components/ChatInput.tsx:1 — desktop/src/pages/chat/components/ChatInput.tsx has 1062 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · REDACTED · ×1
  • REDACTED: 1041 lines of code REDACTED:1 — REDACTED has 1041 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/pages/SkillsPage.tsx · ×1
  • desktop/src/pages/SkillsPage.tsx: 1007 lines of code desktop/src/pages/SkillsPage.tsx:1 — desktop/src/pages/SkillsPage.tsx has 1007 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/pages/chat/components/TurnZones.tsx · ×1
  • desktop/src/pages/chat/components/TurnZones.tsx: 994 lines of code desktop/src/pages/chat/components/TurnZones.tsx:1 — desktop/src/pages/chat/components/TurnZones.tsx has 994 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/services/chat.ts · ×1
  • desktop/src/services/chat.ts: 984 lines of code desktop/src/services/chat.ts:1 — desktop/src/services/chat.ts has 984 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/components/layout/ThreeColumnLayout.tsx · ×1
  • desktop/src/components/layout/ThreeColumnLayout.tsx: 983 lines of code desktop/src/components/layout/ThreeColumnLayout.tsx:1 — desktop/src/components/layout/ThreeColumnLayout.tsx has 983 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/hooks/useUnifiedTabState.ts · ×1
  • desktop/src/hooks/useUnifiedTabState.ts: 977 lines of code desktop/src/hooks/useUnifiedTabState.ts:1 — desktop/src/hooks/useUnifiedTabState.ts has 977 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/components/awsAccount/ConnectAccount.tsx · ×1
  • desktop/src/components/awsAccount/ConnectAccount.tsx: 974 lines of code desktop/src/components/awsAccount/ConnectAccount.tsx:1 — desktop/src/components/awsAccount/ConnectAccount.tsx has 974 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/components/file-viewer/FileViewer.tsx · ×1
  • desktop/src/components/file-viewer/FileViewer.tsx: 959 lines of code desktop/src/components/file-viewer/FileViewer.tsx:1 — desktop/src/components/file-viewer/FileViewer.tsx has 959 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/components/workspace-explorer/VirtualizedTree.tsx · ×1
  • desktop/src/components/workspace-explorer/VirtualizedTree.tsx: 942 lines of code desktop/src/components/workspace-explorer/VirtualizedTree.tsx:1 — desktop/src/components/workspace-explorer/VirtualizedTree.tsx has 942 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/pages/chat/components/TabView.tsx · ×1
  • desktop/src/pages/chat/components/TabView.tsx: 930 lines of code desktop/src/pages/chat/components/TabView.tsx:1 — desktop/src/pages/chat/components/TabView.tsx has 930 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/components/file-viewer/FileViewerPanel.tsx · ×1
  • desktop/src/components/file-viewer/FileViewerPanel.tsx: 902 lines of code desktop/src/components/file-viewer/FileViewerPanel.tsx:1 — desktop/src/components/file-viewer/FileViewerPanel.tsx has 902 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/components/swarm-out/RunOverlay.tsx · ×1
  • desktop/src/components/swarm-out/RunOverlay.tsx: 895 lines of code desktop/src/components/swarm-out/RunOverlay.tsx:1 — desktop/src/components/swarm-out/RunOverlay.tsx has 895 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/hooks/useCanvasHost.ts · ×1
  • desktop/src/hooks/useCanvasHost.ts: 822 lines of code desktop/src/hooks/useCanvasHost.ts:1 — desktop/src/hooks/useCanvasHost.ts has 822 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · backend/skills/s_browser-agent/browser-agent.mjs · ×1
  • backend/skills/s_browser-agent/browser-agent.mjs: 792 lines of code backend/skills/s_browser-agent/browser-agent.mjs:1 — backend/skills/s_browser-agent/browser-agent.mjs has 792 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/components/layout/PollinateOverlay.tsx · ×1
  • desktop/src/components/layout/PollinateOverlay.tsx: 775 lines of code desktop/src/components/layout/PollinateOverlay.tsx:1 — desktop/src/components/layout/PollinateOverlay.tsx has 775 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/pages/chat/components/TSCCModules.tsx · ×1
  • desktop/src/pages/chat/components/TSCCModules.tsx: 738 lines of code desktop/src/pages/chat/components/TSCCModules.tsx:1 — desktop/src/pages/chat/components/TSCCModules.tsx has 738 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/components/layout/CapabilitiesOverlay.tsx · ×1
  • desktop/src/components/layout/CapabilitiesOverlay.tsx: 715 lines of code desktop/src/components/layout/CapabilitiesOverlay.tsx:1 — desktop/src/components/layout/CapabilitiesOverlay.tsx has 715 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · REDACTED · ×1
  • REDACTED: 701 lines of code REDACTED:1 — REDACTED has 701 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/contexts/ExplorerContext.tsx · ×1
  • desktop/src/contexts/ExplorerContext.tsx: 690 lines of code desktop/src/contexts/ExplorerContext.tsx:1 — desktop/src/contexts/ExplorerContext.tsx has 690 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/pages/OnboardingPage.tsx · ×1
  • desktop/src/pages/OnboardingPage.tsx: 682 lines of code desktop/src/pages/OnboardingPage.tsx:1 — desktop/src/pages/OnboardingPage.tsx has 682 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/pages/eval/CasesTab.tsx · ×1
  • desktop/src/pages/eval/CasesTab.tsx: 650 lines of code desktop/src/pages/eval/CasesTab.tsx:1 — desktop/src/pages/eval/CasesTab.tsx has 650 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/pages/chat/turnZones.ts · ×1
  • desktop/src/pages/chat/turnZones.ts: 649 lines of code desktop/src/pages/chat/turnZones.ts:1 — desktop/src/pages/chat/turnZones.ts has 649 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/components/common/BackendStartupOverlay.tsx · ×1
  • desktop/src/components/common/BackendStartupOverlay.tsx: 641 lines of code desktop/src/components/common/BackendStartupOverlay.tsx:1 — desktop/src/components/common/BackendStartupOverlay.tsx has 641 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx · ×1
  • backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx: 638 lines of code backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx:1 — backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx has 638 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/pages/chat/components/AssistantMessageView.tsx · ×1
  • desktop/src/pages/chat/components/AssistantMessageView.tsx: 628 lines of code desktop/src/pages/chat/components/AssistantMessageView.tsx:1 — desktop/src/pages/chat/components/AssistantMessageView.tsx has 628 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/components/swarm-out/live.ts · ×1
  • desktop/src/components/swarm-out/live.ts: 615 lines of code desktop/src/components/swarm-out/live.ts:1 — desktop/src/components/swarm-out/live.ts has 615 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/components/layout/ArtifactsOverlay.tsx · ×1
  • desktop/src/components/layout/ArtifactsOverlay.tsx: 606 lines of code desktop/src/components/layout/ArtifactsOverlay.tsx:1 — desktop/src/components/layout/ArtifactsOverlay.tsx has 606 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/pages/chat/turnControls.ts · ×1
  • desktop/src/pages/chat/turnControls.ts: 605 lines of code desktop/src/pages/chat/turnControls.ts:1 — desktop/src/pages/chat/turnControls.ts has 605 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · REDACTED · ×1
  • REDACTED: 565 lines of code REDACTED:1 — REDACTED has 565 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · desktop/src/components/terminal/TerminalPanel.tsx · ×1
  • desktop/src/components/terminal/TerminalPanel.tsx: 535 lines of code desktop/src/components/terminal/TerminalPanel.tsx:1 — desktop/src/components/terminal/TerminalPanel.tsx has 535 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R7 · Dead Code · Dead file (~274 LoC) · ×1
  • Dead file (~274 LoC) desktop/src/components/workspace/FileBrowser.tsx — no import path from any entry point (91 application, 16 tooling, 532 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~125 LoC) · ×1
  • Dead file (~125 LoC) backend/skills/s_browser-agent/test-aria-perceive.mjs — no import path from any entry point (91 application, 16 tooling, 532 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~101 LoC) · ×1
  • Dead file (~101 LoC) desktop/src/components/modals/ConvertToTaskModal.tsx — no import path from any entry point (91 application, 16 tooling, 532 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~24 LoC) · ×1
  • Dead file (~24 LoC) desktop/src/pages/chat/runDocMeta.ts — no import path from any entry point (91 application, 16 tooling, 532 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~18 LoC) · ×1
  • Dead file (~18 LoC) desktop/src/components/settings/SkillsTab.tsx — no import path from any entry point (91 application, 16 tooling, 532 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~13 LoC) · ×1
  • Dead file (~13 LoC) desktop/src/components/modals/index.ts — no import path from any entry point (91 application, 16 tooling, 532 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R8 · Dependency Hygiene · Unlisted import 'unified' · ×1
  • Unlisted import 'unified' REDACTED:21 — Imported only as a TYPE and declared in no reachable package.json. The import is erased at compile time, so nothing is installed and no runtime resolution depends on it — but type-checking a clean clone will fail. Declare the typings it resolves through (or the package itself) in the owning package.json.
R8 · Dependency Hygiene · Unused dependency '@tauri-apps/plugin-notification' · ×1
  • Unused dependency '@tauri-apps/plugin-notification' — Declared in desktop/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
X1 · Async correctness · Blocking `time.sleep` inside an `async def` · ×1
  • Blocking `time.sleep` inside an `async def` backend/skills/s_pollinate/scripts/tts/backends/edge.py:78 — This `async def` runs on the event loop's thread, and `time.sleep` blocks that thread: for the whole delay no other coroutine, request or callback on the loop makes progress — the Python form of blocking on a task. Use `await asyncio.sleep(…)`, which suspends only this coroutine. Where the blocking work is not a sleep but a synchronous call that cannot be made async, move it off the loop with `await asyncio.to_thread(…)` (or `loop.run_in_executor(…)`).
X24 · Document value interpolated into markup unescaped · Document value reaches a markup attribute unescaped · ×1
  • Document value reaches a markup attribute unescaped backend/skills/s_browser-agent/browser-agent.mjs:292 — `displayText.substring(0,80)` carries text this program read out of a document — an attribute or a text node, which the DOM hands back already decoded, so an entity its author wrote is a live character again — and it is written straight into the text of an element of markup built here with nothing escaping it on the way. The value is chosen by whoever authored that document, not by this program, so it can close the attribute or element it sits in and open another — a crafted document becomes markup in what this code renders. Escape `displayText.substring(0,80)` at this site, or validate it against the shape the position accepts before interpolating it.
X28 · Index access outside its own emptiness guard · Index access outside its own emptiness guard · ×1
  • Index access outside its own emptiness guard backend/core/pipeline_command.py:105 — This condition tests `prog` for emptiness and then indexes it on a branch that test does not reach. `prog[0]` is evaluated whenever the guarded half is false — which includes the case the guard exists to anticipate, `prog` being empty — so an empty `prog` indexes position 0 of nothing and throws. This same condition already shows the intended bracketing: `prog[1]` sits INSIDE the guard. Either the guard is load-bearing, in which case this access escapes it and crashes, or `prog` cannot be empty here, in which case the guard beside it is dead code — the condition is wrong under both readings. Move the parenthesis so the emptiness test brackets every access to `prog`.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×1
  • Swallowed exception (caught, then discarded) desktop/src/hooks/useChatStreamingLifecycle.ts:899 — `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.
Minor — 265 finding(s)
D24 · Comment Value · redundant comment · ×53
  • redundant comment desktop/src/__tests__/streaming-lifecycle-preservation.test.ts:132 — "── Req 3.3: ask_user_question pauses streaming ──" repeats the code it sits on: 6 of its 6 words (req, ask, user, question, pauses, streaming) are already in `describe('Observation: ask_user_question pauses streaming (Req 3.3)', () =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/__tests__/streaming-lifecycle-preservation.test.ts:150 — "── Req 3.4: cmd_permission_request pauses streaming ──" repeats the code it sits on: 6 of its 6 words (req, cmd, permission, request, pauses, streaming) are already in `describe('Observation: cmd_permission_request pauses streaming (Req 3.4)', () =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/__tests__/streaming-lifecycle-preservation.test.ts:186 — "── Req 3.6: Stop button aborts stream ──" repeats the code it sits on: 5 of its 5 words (req, stop, button, aborts, stream) are already in `describe('Observation: Stop button aborts stream (Req 3.6)', () =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/__tests__/streaming-lifecycle-preservation.test.ts:266 — "── Req 3.8: ToolUseBlock shows tool name ──" repeats the code it sits on: 6 of its 6 words (req, tool, use, block, shows, name) are already in `describe('Observation: ToolUseBlock shows tool name (Req 3.8)', () =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/__tests__/tool-display-bugs/sse-case-conversion.test.ts:68 — "tool_result block converted" repeats the code it sits on: 4 of its 4 words (tool, result, block, converted) are already in `const toolResultBlock = converted[1];`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/__tests__/useChatStreamingLifecycle.test.ts:1541 — "Create a stream handler for background tab-a" repeats the code it sits on: 4 of its 5 words (create, stream, handler, tab) are already in `const bgHandler = result.current.createStreamHandler(bgMsgId, 'tab-a');`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/__tests__/useChatStreamingLifecycle.test.ts:1922 — "Create handler for tab-closed, then close it" repeats the code it sits on: 4 of its 5 words (create, handler, tab, closed) are already in `const handler = result.current.createStreamHandler(msgId, 'tab-closed');`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/__tests__/useChatStreamingLifecycle.test.ts:2902 — "Missing pendingQuestion.toolUseId" repeats the code it sits on: 5 of its 6 words (pending, question, tool, use, id) are already in `window.sessionStorage.setItem(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/components/chat/AttachedFileChips.test.tsx:217 — "Property: Chip SHALL have title attribute with file path" repeats the code it sits on: 5 of its 6 words (chip, title, attribute, file, path) are already in `expect(chip.getAttribute('title')).toBe(file.path || 'Path unavailable');`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/components/chat/AttachedFileChips.test.tsx:410 — "Simulate Enter key on close button" repeats the code it sits on: 4 of its 5 words (enter, key, close, button) are already in `fireEvent.keyDown(closeButton!, { key: 'Enter' });`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/components/chat/AttachedFileChips.tsx:100 — "Handle keyboard events on the close button" repeats the code it sits on: 5 of its 5 words (handle, keyboard, events, close, button) are already in `const handleCloseButtonKeyDown = useCallback((e: React.KeyboardEvent) =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/components/chat/SwarmAgent.property.test.tsx:159 — "Property: SwarmAgent SHALL have isDefault: true" repeats the code it sits on: 4 of its 5 words (swarm, agent, default, true) are already in `expect(isDefaultAgent(swarmAgent)).toBe(true);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/components/common/AgentFormModal.tsx:177 — "Create mode - create new agent" repeats the code it sits on: 4 of its 4 words (create, mode, new, agent) are already in `const newAgent: AgentCreateRequest = {`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/components/common/FileEditorCore.tsx:314 — 5 comments in this file only repeat the code they sit on (lines 314, 484, 685, 952, 991), for example "SelectionCommentPopover". Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/components/common/ReviewModeGutter.tsx:74 — "Find the active comment (for editing)" repeats the code it sits on: 4 of its 4 words (find, active, comment, editing) are already in `const activeComment = editingCommentId`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/components/layout/ArtifactsOverlay.test.tsx:338 — "Starred chip is the FIRST child of the chip row" repeats the code it sits on: 5 of its 5 words (starred, chip, first, child, row) are already in `expect(chipRow.firstElementChild).toBe(screen.getByTestId('artifacts-chip-Starred'));`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/components/layout/ThreeColumnLayout.property.test.tsx:116 — "Mock Tauri window API" repeats the code it sits on: 4 of its 4 words (mock, tauri, window, api) are already in `vi.mock('@tauri-apps/api/window', () => ({`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/components/layout/ThreeColumnLayout.property.test.tsx:150 — "Dispatch resize event" repeats the code it sits on: 3 of its 3 words (dispatch, resize, event) are already in `window.dispatchEvent(new Event('resize'));`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/components/layout/ThreeColumnLayout.regions.test.tsx:58 — "Mock Tauri window API" repeats the code it sits on: 4 of its 4 words (mock, tauri, window, api) are already in `vi.mock('@tauri-apps/api/window', () => ({`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/components/layout/ThreeColumnLayout.regions.test.tsx:65 — "Mock Tauri fs plugin" repeats the code it sits on: 4 of its 4 words (mock, tauri, fs, plugin) are already in `vi.mock('@tauri-apps/plugin-fs', () => ({`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/components/layout/ThreeColumnLayout.regions.test.tsx:126 — "Mock localStorage" repeats the code it sits on: 3 of its 3 words (mock, local, storage) are already in `class MockLocalStorage`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/components/layout/ThreeColumnLayout.test.tsx:50 — "Mock Tauri window API" repeats the code it sits on: 4 of its 4 words (mock, tauri, window, api) are already in `vi.mock('@tauri-apps/api/window', () => ({`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/components/layout/ThreeColumnLayout.test.tsx:57 — "Mock Tauri fs plugin" repeats the code it sits on: 4 of its 4 words (mock, tauri, fs, plugin) are already in `vi.mock('@tauri-apps/plugin-fs', () => ({`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/components/layout/ThreeColumnLayout.test.tsx:118 — "Mock localStorage" repeats the code it sits on: 3 of its 3 words (mock, local, storage) are already in `class MockLocalStorage`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment desktop/src/components/layout/ThreeColumnLayout.tsx:36 — "Left sidebar width constant" repeats the code it sits on: 4 of its 4 words (left, sidebar, width, constant) are already in `const LEFT_SIDEBAR_WIDTH = LAYOUT_CONSTANTS.LEFT_SIDEBAR_WIDTH;`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • + 28 more in this group — see findings.md.
X4 · Structured logging · Interpolated log message defeats structured logging · ×40
  • Interpolated log message defeats structured logging backend/main.py:148 — `info` at line 148 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/main.py:614 — `info` at line 614 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/main.py:616 — `error` at line 616 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/main.py:631 — `warning` at line 631 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/main.py:799 — `info` at line 799 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/main.py:1036 — `info` at line 1036 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/main.py:1037 — `info` at line 1037 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/main.py:1038 — `info` at line 1038 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/main.py:1039 — `info` at line 1039 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/utils/bundle_paths.py:85 — `debug` at line 85 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/utils/bundle_paths.py:91 — `debug` at line 91 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/utils/bundle_paths.py:95 — `debug` at line 95 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/utils/bundle_paths.py:97 — `debug` at line 97 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/utils/bundle_paths.py:124 — `debug` at line 124 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/utils/bundle_paths.py:130 — `debug` at line 130 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/utils/bundle_paths.py:135 — `debug` at line 135 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/utils/bundle_paths.py:137 — `info` at line 137 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/utils/bundle_paths.py:145 — `warning` at line 145 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:72 — `warning` at line 72 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:80 — `warning` at line 80 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:84 — `warning` at line 84 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:120 — `warning` at line 120 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:124 — `warning` at line 124 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:305 — `warning` at line 305 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:339 — `warning` at line 339 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
  • + 15 more in this group — see findings.md.
X7 · Silent fallback defaults · Silent fallback default on parse failure · ×35
  • Silent fallback default on parse failure backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/engine_source.py:336 — `read_source_marker` 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.
  • Silent fallback default on parse failure backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/paths.py:142 — `read_engine_config` 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.
  • Silent fallback default on parse failure backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/routes.py:732 — `_icon_provisioned` 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.
  • Silent fallback default on parse failure backend/channels/gateway.py:139 — `_parse_json_list` returns `[]` when `(json.JSONDecodeError, TypeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure backend/core/addressing.py:493 — `matches` returns `[]` when `(OSError, UnicodeDecodeError, IndexError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure backend/core/aws_account.py:641 — `_ada_args` returns `{}` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure backend/core/aws_account.py:685 — `_user_credentials_sections` returns `[]` when `(configparser.Error, OSError, UnicodeDecodeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure backend/core/brain_bootstrap/commands.py:136 — `_package_json` returns `[]` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure backend/core/code_intel/build.py:82 — `_int` (in `parser_outdated`) returns `0` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure backend/core/code_intel/route_parser.py:338 — `_derive_nextjs_path` returns `'/'` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure backend/core/ddd_health.py:225 — `_load_last_scores` returns `{}` when `(json.JSONDecodeError, OSError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure backend/core/ddd_packager.py:1007 — `_read_aim` returns `{}` when `(OSError, json.JSONDecodeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure backend/core/ddd_packager.py:1031 — `_skill_description` returns `''` when `(SkillParseError, 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.
  • Silent fallback default on parse failure backend/core/ddd_skill_registry.py:164 — `_read_native_skills` returns `set()` when `(json.JSONDecodeError, 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.
  • Silent fallback default on parse failure backend/core/egress_proxy.py:72 — `public_addresses` returns `[]` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure backend/core/file_change_classifier.py:304 — `parse_bash_delete_targets` returns `[]` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure backend/core/hive_files.py:265 — `_load` 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.
  • Silent fallback default on parse failure backend/core/hive_files.py:276 — `placed` returns `[]` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure backend/core/ingestion/gaps.py:102 — `run_query` returns `''` when `(OSError, UnicodeDecodeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure backend/core/ingestion/gaps.py:180 — `close_gap` returns `'stale'` when `(StaleRevision, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure backend/core/ingestion/pipeline_v2.py:472 — `requeue_parked` returns `0` when `(KeyError, TypeError, ValueError, json.JSONDecodeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure backend/core/ingestion/relations_v2.py:71 — `_entries_of` 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.
  • Silent fallback default on parse failure backend/core/main_dirty_scan.py:87 — `_load_seen` 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.
  • Silent fallback default on parse failure backend/core/north_star.py:280 — `headline_for_prompt` returns `''` when `(OSError, ValueError, KeyError, TypeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure backend/core/pipeline_stage_events.py:465 — `_test_commands` returns `[]` when `(OSError, ValueError, AttributeError)` 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.
  • + 10 more in this group — see findings.md.
D10 · Test Quality · Mock-dominated test · ×27
  • Mock-dominated test: AC3: the desktop account step has a "Configure later" control that completes onboarding desktop/src/pages/__tests__/OnboardingPage.test.tsx:221 — This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: AC5 (Hive): a FAILED verify persists NO config (updateAPIConfiguration not called) desktop/src/pages/__tests__/OnboardingPage.test.tsx:237 — This test sets up 5 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: AC5 (Hive): a SUCCESSFUL verify persists config AFTER verify desktop/src/pages/__tests__/OnboardingPage.test.tsx:250 — This test sets up 5 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: double-clicking "Configure later" fires onboarding-complete only ONCE desktop/src/pages/__tests__/OnboardingPage.test.tsx:292 — This test sets up 4 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: on the command panel it fetches at once and says when it landed desktop/src/components/swarm-out/ReturnPanel.test.tsx:56 — This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: a command key pressed in a layer above the card is not the card's desktop/src/components/swarm-out/runReview.test.tsx:452 — This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: successful Bedrock API Key verify persists the token via persistBearerToken + sets method desktop/src/components/settings/__tests__/AuthConfigPanel.test.tsx:119 — This test sets up 4 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: failed verify does NOT persist config desktop/src/components/settings/__tests__/AuthConfigPanel.test.tsx:231 — This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: successful verify passes the attempted override to verifyAuth, then persists desktop/src/components/settings/__tests__/AuthConfigPanel.test.tsx:241 — This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: a missing Hive permission offers the template to copy desktop/src/components/settings/__tests__/AwsAccountTab.test.tsx:192 — This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: changing the main region writes aws_region and checks the account there desktop/src/components/settings/__tests__/AwsAccountTab.test.tsx:297 — This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: Escape on one of its buttons cancels the comment and leaves the editor open desktop/src/components/settings/__tests__/hiveDialogs.escape.test.tsx:58 — This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: a Brain still setting up shows Continue setup, which sends the resume prompt and closes the Hub desktop/src/components/layout/BrainMapView.test.tsx:309 — This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: toggle fires updateSource with flipped enabled, then refetches desktop/src/components/layout/CommunityOverlay.test.tsx:246 — This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: changing tier fires updateSource with the new tier desktop/src/components/layout/CommunityOverlay.test.tsx:259 — This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: delete requires a SECOND confirm click before deleteSource fires desktop/src/components/layout/CommunityOverlay.test.tsx:270 — This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: add form submits addSource and refetches desktop/src/components/layout/CommunityOverlay.test.tsx:284 — This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: Resume in tab calls onResume and closes when it lands (true) desktop/src/components/layout/HistoryOverlay.test.tsx:107 — This test sets up 4 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: row text fills the chat input with the prompt (not sent) and closes desktop/src/components/layout/NeedYouOverlay.test.tsx:92 — This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: ↑ sends the prompt now and closes desktop/src/components/layout/NeedYouOverlay.test.tsx:102 — This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: any other item fills or sends its prompt desktop/src/components/layout/NeedsYouRow.test.tsx:60 — This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: AC4: on click, captures and passes the File to onCaptured desktop/src/components/chat/ScreenshotButton.test.tsx:17 — This test sets up 3 test doubles (for example `vi.fn`) against 2 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: AC5: on capture failure, calls onError (not onCaptured) — no crash desktop/src/components/chat/ScreenshotButton.test.tsx:31 — This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: a working key goes to its secret route, never with the settings desktop/src/components/awsAccount/__tests__/ConnectAccount.test.tsx:398 — This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 5 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: a check that comes back without its region is not asked again (no loop) desktop/src/components/awsAccount/__tests__/HiveSetupStep.test.tsx:87 — This test sets up 3 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • + 2 more in this group — see findings.md.
X10 · Duplicated predicate · Duplicated predicate · ×25
  • Duplicated predicate desktop/src/pages/SkillsPage.tsx:1063 — `!block.questions || !Array.isArray(block.questions) || block.questions.length === 0` appears character-identically in 2 files — desktop/src/pages/SkillsPage.tsx, desktop/src/pages/chat/components/ContentBlockRenderer.tsx. 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 desktop/src/components/swarm-out/SwarmOutDashboard.tsx:40 — `!el || typeof ResizeObserver === 'undefined'` appears character-identically in 2 files — desktop/src/components/swarm-out/SwarmOutDashboard.tsx, desktop/src/pages/chat/components/TabView.tsx. 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 desktop/src/components/layout/pipelineRows.ts:150 — `(b.count - a.count) || a.brain.localeCompare(b.brain)` appears character-identically in 2 files — desktop/src/components/layout/pipelineRows.ts, desktop/src/components/swarm-out/runReview.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate desktop/src/hooks/useChatStreamingLifecycle.ts:4700 — `b.type === 'text' || b.type === 'thinking'` appears character-identically in 3 files — desktop/src/hooks/useChatStreamingLifecycle.ts, desktop/src/pages/chat/components/TabView.tsx, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate desktop/src/pages/chat/components/StageDocs.tsx:29 — `d.encoding === 'utf-8' && typeof d.content === 'string'` appears character-identically in 2 files — desktop/src/pages/chat/components/StageDocs.tsx, desktop/src/services/pollinate.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate desktop/src/components/common/Dropdown.tsx:42 — `dropdownRef.current && !dropdownRef.current.contains(event.target as Node)` appears character-identically in 2 files — desktop/src/components/common/Dropdown.tsx, desktop/src/components/common/MultiSelect.tsx. 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 desktop/src/components/file-viewer/renderers/PdfRenderer.tsx:170 — `e.key === 'ArrowLeft' || e.key === 'ArrowUp'` appears character-identically in 2 files — desktop/src/components/file-viewer/renderers/PdfRenderer.tsx, desktop/src/pages/eval/ui.tsx. 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 desktop/src/components/file-viewer/renderers/PdfRenderer.tsx:173 — `e.key === 'ArrowRight' || e.key === 'ArrowDown'` appears character-identically in 2 files — desktop/src/components/file-viewer/renderers/PdfRenderer.tsx, desktop/src/pages/eval/ui.tsx. 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 desktop/src/components/common/CommentPopover.tsx:122 — `e.key === 'Enter' && (e.metaKey || e.ctrlKey)` appears character-identically in 4 files — desktop/src/components/common/CommentPopover.tsx, desktop/src/components/common/FileEditorCore.tsx, desktop/src/components/swarm-out/RunOverlay.tsx, desktop/src/components/swarm-out/SwarmOutWaitCard.tsx. 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 desktop/src/components/layout/PipelineOverlay.tsx:97 — `e.target === e.currentTarget && (e.key === 'Enter' || e.key === ' ')` appears character-identically in 3 files — desktop/src/components/layout/PipelineOverlay.tsx, desktop/src/components/swarm-out/HistoryView.tsx, desktop/src/components/swarm-out/RunList.tsx. 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 backend/skills/s_browser-agent/browser-agent.mjs:795 — `el && el.getAttribute('aria-busy') !== 'true'` appears character-identically in 2 files — backend/skills/s_browser-agent/browser-agent.mjs, backend/skills/s_browser-agent/wait-engine.mjs. 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 desktop/src/hooks/useChatStreamingLifecycle.ts:3345 — `event.type === 'ask_user_question' && event.questions && event.toolUseId` appears character-identically in 2 files — desktop/src/hooks/useChatStreamingLifecycle.ts, desktop/src/pages/SkillsPage.tsx. 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 desktop/src/hooks/useChatStreamingLifecycle.ts:3317 — `event.type === 'assistant' && event.content` appears character-identically in 2 files — desktop/src/hooks/useChatStreamingLifecycle.ts, desktop/src/pages/SkillsPage.tsx. 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 desktop/src/hooks/useChatStreamingLifecycle.ts:3154 — `event.type === 'session_start' && event.sessionId` appears character-identically in 2 files — desktop/src/hooks/useChatStreamingLifecycle.ts, desktop/src/pages/SkillsPage.tsx. 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 desktop/src/components/layout/JobsRunsOverlay.tsx:59 — `j.consecutiveFailures > 0 || j.lastStatus === 'failed'` appears character-identically in 2 files — desktop/src/components/layout/JobsRunsOverlay.tsx, desktop/src/hooks/useJobsRuns.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate desktop/src/components/swarm-out/RunOverlay.tsx:189 — `p.replace(/[/\\]+$/, '').split(/[/\\]/).pop() || p` appears character-identically in 2 files — desktop/src/components/swarm-out/RunOverlay.tsx, desktop/src/pages/chat/components/ItemRows.tsx. 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 desktop/src/components/common/CommentPopover.tsx:136 — `popoverRef.current && !popoverRef.current.contains(e.target as Node)` appears character-identically in 2 files — desktop/src/components/common/CommentPopover.tsx, desktop/src/components/common/FileEditorCore.tsx. 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 desktop/src/components/terminal/TerminalPanel.tsx:110 — `ref.current && !ref.current.contains(e.target as Node)` appears character-identically in 2 files — desktop/src/components/terminal/TerminalPanel.tsx, desktop/src/pages/eval/CasesTab.tsx. 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 desktop/src/components/workspace/FileBrowser.tsx:22 — `size >= 1024 && unitIndex < units.length - 1` appears character-identically in 2 files — desktop/src/components/workspace/FileBrowser.tsx, desktop/src/components/workspace/FilePreviewModal.tsx. 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 desktop/src/components/layout/CommunityOverlay.tsx:257 — `typeof detail === 'string' && detail.trim()` appears character-identically in 2 files — desktop/src/components/layout/CommunityOverlay.tsx, desktop/src/services/api.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate desktop/src/pages/chat/compaction.ts:36 — `typeof v === 'number' && Number.isFinite(v)` appears character-identically in 3 files — desktop/src/pages/chat/compaction.ts, desktop/src/services/pipelines.ts, desktop/src/stores/backgroundAgentsStore.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate desktop/src/contexts/ThemeContext.tsx:32 — `typeof window === 'undefined' || typeof window.matchMedia !== 'function'` appears character-identically in 2 files — desktop/src/contexts/ThemeContext.tsx, desktop/src/hooks/usePrefersReducedMotion.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate backend/skills/s_pollinate/scripts/deck_notes_injector.py:120 — `"".join(filter(str.isdigit, p.stem)) or "0"` appears character-identically in 2 files — backend/skills/s_pollinate/scripts/deck_notes_injector.py, backend/skills/s_pptx/scripts/style-extract.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 backend/core/security_hooks.py:2791 — `"=" in t and t.split("=", 1)[0].replace("_", "").isalnum() and not t.startswith("-")` appears character-identically in 2 files — backend/core/security_hooks.py, backend/core/shell_segments.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 backend/skills/s_docx/ooxml/scripts/validation/base.py:614 — `"_rels" in file_path.parts or "docProps" in file_path.parts` appears character-identically in 2 files — backend/skills/s_docx/ooxml/scripts/validation/base.py, backend/skills/s_pptx/ooxml/scripts/validation/base.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.
X6 · Hand-rolled structured-format parsing · Hand-rolled JSON/XML parsing via regex · ×18
  • Hand-rolled JSON/XML parsing via regex backend/skills/s_pollinate/scripts/convergence_gate.py:70 — 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 Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex backend/skills/s_pollinate/scripts/convergence_gate.py:81 — 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 Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex backend/skills/s_pollinate/scripts/convergence_gate.py:99 — 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 Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex backend/skills/s_pollinate/scripts/convergence_gate.py:114 — 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 Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex backend/skills/s_pollinate/scripts/convergence_gate.py:138 — 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 Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex backend/skills/s_pollinate/scripts/font_link_backfill.py:161 — 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 Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex backend/jobs/adapters/github_trending.py:35 — 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 Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex backend/core/memory_guard.py:204 — 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 Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex backend/core/pipeline_stage_events.py:129 — 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 Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex backend/core/runtime_hooks.py:586 — 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 Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex backend/core/runtime_hooks.py:1183 — 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 Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex backend/core/session_utils.py:558 — 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 Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex backend/core/session_utils.py:587 — 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 Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex backend/core/session_utils.py:590 — 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 Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex backend/core/session_utils.py:591 — 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 Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex backend/core/session_utils.py:630 — 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 Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/library.py:57 — 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 Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex backend/apps/pptx-maker/package/upstream/kirocrew/src/kiro_crew/apps/builtins/pptx_maker/backend/library.py:58 — 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 Python code already uses a real parser in the same package; use it here too.
M4 · Documentation accuracy · README/code drift · ×5
  • README/code drift README.md:202 — README.md names React 19, but the manifest declares `react` ^18.3.0. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/README.md:9 — docs/README.md links to `SwarmAI-Architecture-Design.pdf`, but `docs/SwarmAI-Architecture-Design.pdf` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/README.md:10 — docs/README.md links to `Self-Evolution-Harness-Design.pdf`, but `docs/Self-Evolution-Harness-Design.pdf` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/README.md:11 — docs/README.md links to `Memory-Management-Design.pdf`, but `docs/Memory-Management-Design.pdf` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/README.md:23 — docs/README.md links to `AIDLC-Phase3-Design.pdf`, but `docs/AIDLC-Phase3-Design.pdf` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
R7 · Dead Code · Unused export 'default' · ×5
  • Unused export 'default' backend/skills/s_pollinate/templates/remotion/Thumbnail.tsx:105 — Nothing imports this binding — it is safe to review for removal.
  • Unused export 'default' backend/skills/s_pollinate/templates/remotion/Video.tsx:360 — Nothing imports this binding — it is safe to review for removal.
  • Unused export 'default' desktop/src/components/chat/AttachedFileChips.tsx:273 — Nothing imports this binding — it is safe to review for removal.
  • Unused export 'default' desktop/src/components/chat/ChatDropZone.tsx:150 — Nothing imports this binding — it is safe to review for removal.
  • Unused export 'default' desktop/src/components/layout/BottomBar.tsx:166 — Nothing imports this binding — it is safe to review for removal.
X7 · Silent fallback defaults · Silent fallback default in catch · ×5
  • Silent fallback default in catch backend/core/context_injector.py:255 — `_find_last_user_text` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch backend/core/context_injector.py:498 — `_estimate_session_timespan` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch backend/core/ddd_bindings.py:264 — `classify_project` swallows every exception into `return 'none'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch backend/core/library_mounts.py:460 — `judge_mount_kind` swallows every exception into `return 'docs'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch backend/core/recall_multi.py:338 — `_signature_line` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
AX6 · Interface segregation · Fat interface · ×3
  • Fat interface: UseUnifiedTabStateReturn (16 required operations) desktop/src/hooks/useUnifiedTabState.ts:382 — `UseUnifiedTabStateReturn` declares 16 required operations: `addTab`, `addHiveTab`, `closeTab`, `selectTab`, `updateTabTitle`, `updateTabSessionId`, `setTabIsNew`, `getTabState`, `updateTabState`, `updateTabStatus`, `restoreTab`, `initTabState`, `cleanupTabState`, `removeInvalidTabs`, `restoreFromFile`, `fetchMaxTabs`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: ChatStreamingLifecycle (18 required operations) desktop/src/hooks/useChatStreamingLifecycle.ts:934 — `ChatStreamingLifecycle` declares 18 required operations: `setLocalSending`, `applyActivity`, `rebindActivity`, `noteSend`, `applyServerQueue`, `syncQueuedBadges`, `rebindQueue`, `clearPendingStreamTab`, `bumpStreamingDerivation`, `incrementStreamGen`, `createStreamHandler`, `createCompleteHandler`, `createDisconnectHandler`, `createErrorHandler`, `removePendingStateForSession`, `clearContextWarning`, `refreshContextUsage`, `cancelBusyWait`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: TurnControlDeps (21 required operations) desktop/src/pages/chat/turnControls.ts:43 — `TurnControlDeps` declares 21 required operations: `tabs`, `activeTabId`, `agentId`, `options`, `buildContent`, `initTab`, `setLocalSending`, `incrementStreamGen`, `setTabStatus`, `titleFromFirstMessage`, `updateTab`, `noteSend`, `editorContext`, `pluginCommand`, `rebindQueue`, `syncQueuedBadges`, `setMessages`, `clearPendingQuestion`, `clearPendingPermission`, `dismissNotice`, `newClientId`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
D29 · Static Analysis (SAST) · REDACTED · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D7 · Architectural Integrity · Classify ADR enforcement · ×3
  • Classify ADR enforcement: 1. Serialize transfers per account with Postgres advisory locks backend/templates/eval/fixtures/workspace/repos/ledgerd/docs/adr/0001-postgres-advisory-locks.md — This record carries no `enforcement:` field, so nothing says whether the decision is checked by anything or is upheld by convention alone — and an unclassified record is counted as UNENFORCED in this dimension's score, which is the same bucket as a rule known to have no check behind it. If this is a mechanizable rule, add an analyzer/test (or `enforcement: analyzer|test`); if it's a design decision, mark `enforcement: not-applicable` so it isn't counted as unenforced.
  • Classify ADR enforcement: 2. Require an Idempotency-Key on POST /transfers backend/templates/eval/fixtures/workspace/repos/ledgerd/docs/adr/0002-idempotency-keys.md — This record carries no `enforcement:` field, so nothing says whether the decision is checked by anything or is upheld by convention alone — and an unclassified record is counted as UNENFORCED in this dimension's score, which is the same bucket as a rule known to have no check behind it. If this is a mechanizable rule, add an analyzer/test (or `enforcement: analyzer|test`); if it's a design decision, mark `enforcement: not-applicable` so it isn't counted as unenforced.
  • Classify ADR enforcement: 3. Replace the HTTP API with gRPC backend/templates/eval/fixtures/workspace/repos/ledgerd/docs/adr/0003-grpc-api.md — This record carries no `enforcement:` field, so nothing says whether the decision is checked by anything or is upheld by convention alone — and an unclassified record is counted as UNENFORCED in this dimension's score, which is the same bucket as a rule known to have no check behind it. If this is a mechanizable rule, add an analyzer/test (or `enforcement: analyzer|test`); if it's a design decision, mark `enforcement: not-applicable` so it isn't counted as unenforced.
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Low CVE · ×2
  • REDACTED
  • REDACTED
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 2 of 5 project(s) overshoot their size bounds, lowering Project Cohesion to 2.0/10. The most over is `backend` (256687 LoC, 1556 module-visible types across 49 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
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M3 · Folder & project structure · No src/ separation · ×1
  • No src/ separation — Production code isn't grouped under a src/ folder — it's spread across several top-level directories, so there's no one place that says 'this is the product'.
P2 · Observability · Logging is not universal · ×1
  • Logging is not universal — Only 1/3 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `desktop/src-tauri`.
P3 · Security & performance tooling · No SAST · ×1
  • No SAST REDACTED:4 — No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 43315 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 backend/skills/s_browser-agent/package.json:5 — `backend/skills/s_browser-agent/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
R7 · Dead Code · Unused export 'AudioWaveform' · ×1
  • Unused export 'AudioWaveform' backend/skills/s_pollinate/templates/remotion/components/AudioWaveform.tsx:19 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'CodeBlock' · ×1
  • Unused export 'CodeBlock' backend/skills/s_pollinate/templates/remotion/components/CodeBlock.tsx:5 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'ComparisonCard' · ×1
  • Unused export 'ComparisonCard' backend/skills/s_pollinate/templates/remotion/components/ComparisonCard.tsx:5 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'DataBar' · ×1
  • Unused export 'DataBar' backend/skills/s_pollinate/templates/remotion/components/DataBar.tsx:5 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'DataTable' · ×1
  • Unused export 'DataTable' backend/skills/s_pollinate/templates/remotion/components/DataTable.tsx:5 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'DiagramReveal' · ×1
  • Unused export 'DiagramReveal' backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:390 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'ErrorBoundary' · ×1
  • Unused export 'ErrorBoundary' backend/skills/s_pollinate/templates/remotion/components/ErrorBoundary.tsx:15 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'FeatureGrid' · ×1
  • Unused export 'FeatureGrid' backend/skills/s_pollinate/templates/remotion/components/FeatureGrid.tsx:5 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'FlowChart' · ×1
  • Unused export 'FlowChart' backend/skills/s_pollinate/templates/remotion/components/FlowChart.tsx:130 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'LottieAnimation' · ×1
  • Unused export 'LottieAnimation' backend/skills/s_pollinate/templates/remotion/components/LottieAnimation.tsx:23 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'MediaGrid' · ×1
  • Unused export 'MediaGrid' backend/skills/s_pollinate/templates/remotion/components/MediaSection.tsx:83 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'QuoteBlock' · ×1
  • Unused export 'QuoteBlock' backend/skills/s_pollinate/templates/remotion/components/QuoteBlock.tsx:5 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'SplitLayout' · ×1
  • Unused export 'SplitLayout' backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx:30 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'StatHighlight' · ×1
  • Unused export 'StatHighlight' backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx:124 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'ZigzagCards' · ×1
  • Unused export 'ZigzagCards' backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx:206 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'CenteredShowcase' · ×1
  • Unused export 'CenteredShowcase' backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx:318 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'MetricsRow' · ×1
  • Unused export 'MetricsRow' backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx:387 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'StepProgress' · ×1
  • Unused export 'StepProgress' backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx:511 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'ShortCTACard' · ×1
  • Unused export 'ShortCTACard' backend/skills/s_pollinate/templates/remotion/components/ShortCTACard.tsx:5 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'ShortIntroCard' · ×1
  • Unused export 'ShortIntroCard' backend/skills/s_pollinate/templates/remotion/components/ShortIntroCard.tsx:4 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'StatCounter' · ×1
  • Unused export 'StatCounter' backend/skills/s_pollinate/templates/remotion/components/StatCounter.tsx:6 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'Timeline' · ×1
  • Unused export 'Timeline' backend/skills/s_pollinate/templates/remotion/components/Timeline.tsx:79 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'useExit' · ×1
  • Unused export 'useExit' backend/skills/s_pollinate/templates/remotion/components/animations.tsx:40 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'useTextReveal' · ×1
  • Unused export 'useTextReveal' backend/skills/s_pollinate/templates/remotion/components/animations.tsx:134 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'useCharReveal' · ×1
  • Unused export 'useCharReveal' backend/skills/s_pollinate/templates/remotion/components/animations.tsx:153 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'useStaggeredDrawOn' · ×1
  • Unused export 'useStaggeredDrawOn' backend/skills/s_pollinate/templates/remotion/components/animations.tsx:203 — Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
S1 · Web-Security Posture · No security response headers detected · ×1
  • No security response headers detected hive/Caddyfile:40 — None of the 11 security response headers the OWASP Secure Headers Project recommends (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options, …) is configured — defense in depth, even when a reverse proxy could set them. This is reported because `Caddyfile` is committed to this repository and declares the server that serves it, so the configuration that would carry these headers is in this repository and was read in full. (−2.0 on this card.)
X2 · Cancellation propagation · Not all async functions that make a request accept an AbortSignal · ×1
  • Not all async functions that make a request accept an AbortSignal — Only 4/9 async functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
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 — 2/3 of this repository's type-checking configuration(s) turn on strict null checking (`"strict": true`, or `"strictNullChecks": true`). A configuration that states neither is counted as OFF, because off is tsc's own default; a solution-style one whose `"files"` is empty and whose `"references"` point at other projects is in neither number, because it checks no source itself. Where it is off, `string` admits `null` and `undefined`: passing a value that is null compiles silently and throws on the first property access.
X5 · Nullable reference types · Null assertions (`!`) reduce the strict null checking score · ×1
  • Null assertions (`!`) reduce the strict null checking score — ~1.5 `!` null assertions per 1k TypeScript source lines — 163 assertion(s) across the 109317 source line(s) of the 430 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: desktop/src/pages/ChatPage.tsx (15), desktop/src/hooks/useChatStreamingLifecycle.ts (14), desktop/src/components/file-viewer/CanvasChanges.tsx (12). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
Minor — 12 finding(s)
D12 · Dependency Hygiene · Outdated · ×11
  • Outdated: serde_json — `serde_json` is locked at 1.0.151 but 1.0.154 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in desktop/src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p serde_json` and commit the updated REDACTED.
  • Outdated: tauri — `tauri` is locked at 2.11.5 but 2.12.5 is the current stable release on crates.io, and it already satisfies the `"2"` requirement declared in desktop/src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tauri` and commit the updated REDACTED.
  • Outdated: tauri-build — `tauri-build` is locked at 2.6.3 but 2.7.4 is the current stable release on crates.io, and it already satisfies the `"2"` requirement declared in desktop/src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tauri-build` and commit the updated REDACTED.
  • Outdated: tauri-plugin-dialog — `tauri-plugin-dialog` is locked at 2.7.3 but 2.8.4 is the current stable release on crates.io, and it already satisfies the `"2"` requirement declared in desktop/src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tauri-plugin-dialog` and commit the updated REDACTED.
  • Outdated: tauri-plugin-fs — `tauri-plugin-fs` is locked at 2.5.2 but 2.7.1 is the current stable release on crates.io, and it already satisfies the `"2"` requirement declared in desktop/src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tauri-plugin-fs` and commit the updated REDACTED.
  • Outdated: tauri-plugin-notification — `tauri-plugin-notification` is locked at 2.4.0 but 2.8.0 is the current stable release on crates.io, and it already satisfies the `"2"` requirement declared in desktop/src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tauri-plugin-notification` and commit the updated REDACTED.
  • Outdated: tauri-plugin-opener — `tauri-plugin-opener` is locked at 2.5.5 but 2.7.2 is the current stable release on crates.io, and it already satisfies the `"2"` requirement declared in desktop/src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tauri-plugin-opener` and commit the updated REDACTED.
  • Outdated: tauri-plugin-process — `tauri-plugin-process` is locked at 2.3.1 but 2.4.0 is the current stable release on crates.io, and it already satisfies the `"2"` requirement declared in desktop/src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tauri-plugin-process` and commit the updated REDACTED.
  • Outdated: tauri-plugin-updater — `tauri-plugin-updater` is locked at 2.11.0 but 2.14.1 is the current stable release on crates.io, and it already satisfies the `"2"` requirement declared in desktop/src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tauri-plugin-updater` and commit the updated REDACTED.
  • Outdated: tokio — `tokio` is locked at 1.53.1 but 1.54.1 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in desktop/src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tokio` and commit the updated REDACTED.
  • Outdated: xcap — `xcap` is locked at 0.9.8 but 0.9.9 is the current stable release on crates.io, and it already satisfies the `"0.9"` requirement declared in desktop/src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p xcap` and commit the updated REDACTED.
D24 · Comment Value · doc comments repeat the names · ×1
  • doc comments repeat the names desktop/src/components/chat/AttachedFileChips.tsx:21 — 4 of 46 documented parameters and 13 of 3133 summaries in `swarmai` only repeat the member or parameter name (e.g. "FileChip Props" for `FileChipProps`). Delete the restating tags, or add what the name does not say.

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-f4147c84a8d84b0bb07ca664800e6808/history.json --exit-code 0 --source .7artifacts/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-f4147c84a8d84b0bb07ca664800e6808/tree.json --exit-code 0 --source .0artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/canine-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt --exclude desktop/src/generated .115artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update67artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.0—
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 6 file(s) — `desktop/src/components/layout/overlayChunks.ts`, `desktop/src/hooks/useUnifiedTabState.ts`, `desktop/src/services/canvasSession.ts`, `desktop/src/services/ingestion.ts`, `desktop/src/types/index.ts`, … (+1 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/** . --skip-db-update0artifacts/raw/trivy-fs.json

Run 01a1beb5-9590-7dc5-a192-e59ca8b84afd · 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