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

Hmbown/CodeWhale

Measured 26 October 2026, 03:10 UTC, at code version a129eb5

Regression: 1 dimension fell since the last survey

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

CAI score 57out of 100 Adequate
CriticalWeakAdequateStrongExemplary
No change since the last survey

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

A very large codebase: 1,402,135 lines of product code in 50 projects, tests not counted · Estimated rebuild effort: about 10.9 person-years · Weakest lens: Accessibility, 49

Findings by how serious they are

134 critical 4606 serious 172 minor

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

This survey was produced by

Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
26 October 2026, 03:10 UTC

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

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

95of 95 dimensions measured by tools.
4888of 4912 findings point to an exact file and line, so you can open each one in the code. The other 24 concern the repository as a whole, such as missing documentation.
95dimensions across 9 lenses, read from 1,402,135 lines of product code in 50 projects.
Chapters

Executive summary

Hmbown/CodeWhale falls short of our standard for a preview release because it has controls that only work with a mouse. It scores 57 out of 100 and is rated Adequate, and 121 of its 134 critical findings are security problems.

Accessibility, at 49, is the weakest lens and counts most in the score. The best first step for the work it takes is replacing the 12 exposed passwords or keys and switching the old ones off, worth about 3 points. Making the controls keyboard-usable would lift Accessibility itself, worth about 5 points. Raising Accessibility to 65 would lift the score to about 63.

Ninety-eight pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Twelve passwords or keys are open to anyone who can read the repository, and four weaknesses in the code could be used by an attacker. Pinning each tool to an exact version, replacing each exposed password or key and fixing the weaknesses the scanner points to would close these risks. Passing outside input through environment variables would fix the three pipeline steps that put outside input straight into a shell command, and setting a waiting period for automatic updates would deal with the automatic dependency update that takes a new release at once. The four form fields without a label need a label.

The product code is 1,402,135 lines, about €1,600,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.
Accessibility 49 · counts for 45%Code Health 58 · counts for 25%Production Readiness 59 · counts for 14%Performance 74 · counts for 8%Security and Compliance 80 · counts for 4%Architecture 83 · counts for 2%Maturity 85 · counts for 1%Domain Modelling 88 · counts for 1%Event Sourcing 100 · counts for 0%

If Accessibility rose from 49 to 65, the lowest score rated Strong, the score would rise from 57 to about 63.

Code composition: what the lines of code are
Product code 91%Tests 9%
New since the last survey: 537 findings

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

  • Cyclomatic Complexity · codewhale_tui::commands::config_main_host::set_config_value (cyclomatic 178) crates/tui/src/commands/config_main_host.rs
  • Cyclomatic Complexity · codewhale_tui::commands::config_main_host::show_single_setting (cyclomatic 104) crates/tui/src/commands/config_main_host.rs
  • Cyclomatic Complexity · codewhale_cli::cloud::computer::run (cyclomatic 89) crates/cli/src/cloud/computer.rs
  • Cyclomatic Complexity · review-eval.buildCorpus (cyclomatic 62) scripts/review-eval.mjs
  • Cyclomatic Complexity · Carver.run (cyclomatic 60) scripts/split/carve.py
  • Cyclomatic Complexity · reexports.run (cyclomatic 59) scripts/split/reexports.py
  • Cyclomatic Complexity · ModelInventory::from_config_scoped (cyclomatic 39) crates/tui/src/model_inventory.rs
  • Cyclomatic Complexity · CodewhaleClient::prepare_outbound_request (cyclomatic 37) crates/tui/src/client.rs
  • Cyclomatic Complexity · codewhale_tui::tools::review_core::render_review_summary (cyclomatic 37) crates/tui/src/tools/review_core.rs
  • Cyclomatic Complexity · codewhale_tui::tools::review_core::run_review_core (cyclomatic 36) crates/tui/src/tools/review_core.rs
  • Cyclomatic Complexity · index.flushOutputs (cyclomatic 36) integrations/weixin-bridge/src/index.mjs
  • Cyclomatic Complexity · codewhale_tui::commands::groups::config::config::config (cyclomatic 35) crates/tui/src/commands/groups/config/config.rs
  • Cyclomatic Complexity · runtime_mobile.html.noteTurnUsage (cyclomatic 35) crates/tui/src/runtime_mobile.html
  • Cyclomatic Complexity · Connection::project (cyclomatic 34) crates/tui/src/tui/pet_watch/runtime.rs
  • Cyclomatic Complexity · Mover.plan_cfg (cyclomatic 34) scripts/split/move-modules.py
  • Cyclomatic Complexity · splitlib.apply_changes (cyclomatic 34) scripts/split/splitlib.py
  • Cyclomatic Complexity · count_lines.classify_crate (cyclomatic 33) scripts/split/count_lines.py
  • Cyclomatic Complexity · codewhale_tui::commands::config_main_host::set_subagents_config_value (cyclomatic 32) crates/tui/src/commands/config_main_host.rs
  • Cyclomatic Complexity · Engine::new_admitted_with_subagent_manager (cyclomatic 31) crates/tui/src/core/engine.rs
  • Cyclomatic Complexity · contributor-wall.refresh (cyclomatic 28) scripts/contributor-wall.py
  • Cyclomatic Complexity · codewhale_tui::tui::pet_watch::runtime::run (cyclomatic 27) crates/tui/src/tui/pet_watch/runtime.rs
  • Cyclomatic Complexity · testsplit.main (cyclomatic 27) scripts/split/testsplit.py
  • Cyclomatic Complexity · catalog_models_dev.seed_lock_report (cyclomatic 26) scripts/catalog_models_dev.py
  • Cyclomatic Complexity · review-eval.replay (cyclomatic 25) scripts/review-eval.mjs
  • Cyclomatic Complexity · codewhale_cli::run_model_command (cyclomatic 24) REDACTED
  • Cyclomatic Complexity · AcpServer::replay_history (cyclomatic 24) crates/tui/src/acp_server.rs
  • Cyclomatic Complexity · ExploringCell::render_with_locale (cyclomatic 24) crates/tui/src/tui/history.rs
  • Cyclomatic Complexity · codewhale_tui::core::authority::auto_review::shell_command_credential_uploads (cyclomatic 24) crates/tui/src/core/authority/auto_review.rs
  • Cyclomatic Complexity · review-eval.grade (cyclomatic 24) scripts/review-eval.mjs
  • Cyclomatic Complexity · codewhale_tui::commands::groups::config::config::workbar (cyclomatic 23) crates/tui/src/commands/groups/config/config.rs
  • Cyclomatic Complexity · codewhale_tui::core::authority::auto_review::upload_values (cyclomatic 23) crates/tui/src/core/authority/auto_review.rs
  • Cyclomatic Complexity · codewhale_tui::tools::review_triage::triage_review (cyclomatic 23) crates/tui/src/tools/review_triage.rs
  • Cyclomatic Complexity · count_lines.analyse_file (cyclomatic 23) scripts/split/count_lines.py
  • Cyclomatic Complexity · LlmError::from_http_response_with_retry_hints (cyclomatic 22) crates/tui/src/llm_client/mod.rs
  • Cyclomatic Complexity · testsplit.analyse_file (cyclomatic 22) scripts/split/testsplit.py
  • Cyclomatic Complexity · facts-lib.deriveFeatures.features (cyclomatic 22) REDACTED
  • Cyclomatic Complexity · codewhale_tui::tui::pet_watch::full::needs (cyclomatic 21) crates/tui/src/tui/pet_watch/full.rs
  • Cyclomatic Complexity · Engine::handle_set_goal_status (cyclomatic 20) crates/tui/src/core/engine.rs
  • Cyclomatic Complexity · ReasoningEffort::normalize_for_route_identity (cyclomatic 20) crates/tui/src/reasoning_preference.rs
  • Cyclomatic Complexity · codewhale_tui::fleet::placement::decide (cyclomatic 20) crates/tui/src/fleet/placement.rs
  • Cyclomatic Complexity · check-contributor-credit.main (cyclomatic 20) scripts/check-contributor-credit.py
  • Cyclomatic Complexity · count_lines.summarise (cyclomatic 20) scripts/split/count_lines.py
  • Cyclomatic Complexity · codewhale_cli::dispatch::run (cyclomatic 19) crates/cli/src/dispatch.rs
  • Cyclomatic Complexity · RuntimeThreadManager::route_engine_events (cyclomatic 19) crates/tui/src/runtime_threads.rs
  • Cyclomatic Complexity · codewhale_tui::commands::core_navigation_voice_host::capture_and_transcribe (cyclomatic 19) crates/tui/src/commands/core_navigation_voice_host.rs
  • Cyclomatic Complexity · check-command-core-navigation-proof.violations (cyclomatic 19) scripts/check-command-core-navigation-proof.py
  • Cyclomatic Complexity · carve.parse_items (cyclomatic 19) scripts/split/carve.py
  • Cyclomatic Complexity · Mover.plan_manifests (cyclomatic 19) scripts/split/move-modules.py
  • Cyclomatic Complexity · index.reconcileSnapshot (cyclomatic 19) integrations/weixin-bridge/src/index.mjs
  • Cyclomatic Complexity · index.handleInbound (cyclomatic 19) integrations/weixin-bridge/src/index.mjs
  • Cyclomatic Complexity · Config::readonly_health_credential_generation (cyclomatic 18) crates/tui/src/config.rs
  • Cyclomatic Complexity · RuntimeThreadManager::shutdown_and_wait (cyclomatic 18) crates/tui/src/runtime_threads.rs
  • Cyclomatic Complexity · codewhale_tui::provider_lake::provider_capability_with_wire (cyclomatic 18) crates/tui/src/provider_lake.rs
  • Cyclomatic Complexity · lib.parseQuestionAnswers (cyclomatic 18) integrations/weixin-bridge/src/lib.mjs
  • Cyclomatic Complexity · Engine::start_mcp_session_boot (cyclomatic 17) crates/tui/src/core/engine.rs
  • Cyclomatic Complexity · codewhale_tui::run_sandbox_command (cyclomatic 17) crates/tui/src/lib.rs
  • Cyclomatic Complexity · codewhale_tui::commands::groups::config::config::trust (cyclomatic 17) crates/tui/src/commands/groups/config/config.rs
  • Cyclomatic Complexity · codewhale_tui::commands::groups::config::import_claude::render_plan (cyclomatic 17) crates/tui/src/commands/groups/config/import_claude.rs
  • Cyclomatic Complexity · codewhale_tui::tui::agent_focus::render_focus (cyclomatic 17) crates/tui/src/tui/agent_focus.rs
  • Cyclomatic Complexity · codewhale_tui::tui::mouse_ui::push_work_row_entries (cyclomatic 17) crates/tui/src/tui/mouse_ui.rs
  • Cyclomatic Complexity · build-lock.main (cyclomatic 17) scripts/build-lock.py
  • Cyclomatic Complexity · catalog_models_dev.cmd_defaults_audit (cyclomatic 17) scripts/catalog_models_dev.py
  • Cyclomatic Complexity · check-windows-imports.main (cyclomatic 17) scripts/release/check-windows-imports.py
  • Cyclomatic Complexity · Mover.run_plan (cyclomatic 17) scripts/split/move-modules.py
  • Cyclomatic Complexity · widen.main (cyclomatic 17) scripts/split/widen.py
  • Cyclomatic Complexity · install.run (cyclomatic 17) REDACTED
  • Cyclomatic Complexity · docs-search.DocsSearch (cyclomatic 17) web/components/docs-search.tsx
  • Cyclomatic Complexity · RuntimeBridge::message_thread (cyclomatic 16) crates/app-server/src/lib.rs
  • Cyclomatic Complexity · ToolActivationCache::activate_inner (cyclomatic 16) crates/tui/src/core/session.rs
  • Cyclomatic Complexity · WorkspaceFile::open_confined (cyclomatic 16) crates/tui/src/fleet/files.rs
  • Cyclomatic Complexity · FleetManager::start_leased_workers (cyclomatic 16) crates/tui/src/fleet/manager.rs
  • Cyclomatic Complexity · RuntimeThreadManager::create_thread_with_reserved_id (cyclomatic 16) crates/tui/src/runtime_threads.rs
  • Cyclomatic Complexity · UpdateGoalTool::execute (cyclomatic 16) crates/tui/src/tools/goal.rs
  • Cyclomatic Complexity · ExecCell::render_calm (cyclomatic 16) crates/tui/src/tui/history.rs
  • Cyclomatic Complexity · codewhale_tui::run_interactive_prepared (cyclomatic 16) crates/tui/src/lib.rs
  • Cyclomatic Complexity · codewhale_tui::commands::groups::core::constitution::user_constitution_stack_status (cyclomatic 16) crates/tui/src/commands/groups/core/constitution.rs
  • Cyclomatic Complexity · codewhale_tui::provider_catalog_live::load_from_disk_unlocked_with_limit (cyclomatic 16) crates/tui/src/provider_catalog_live.rs
  • Cyclomatic Complexity · codewhale_tui::runtime_api::git::collect_git_status_detail (cyclomatic 16) crates/tui/src/runtime_api/git.rs
  • Cyclomatic Complexity · codewhale_tui::runtime_api::secrets::run_provider_connect (cyclomatic 16) crates/tui/src/runtime_api/secrets.rs
  • Cyclomatic Complexity · codewhale_tui::session_secret_scrub::scrub_value (cyclomatic 16) crates/tui/src/session_secret_scrub.rs
  • Cyclomatic Complexity · codewhale_tui::tools::review_core::apply_claim_limits (cyclomatic 16) crates/tui/src/tools/review_core.rs
  • Cyclomatic Complexity · codewhale_tui::tools::schema_sanitize::mfjs_schema_can_terminate (cyclomatic 16) crates/tui/src/tools/schema_sanitize.rs
  • Cyclomatic Complexity · codewhale_tui::tui::model_picker::model_row_meta_chips (cyclomatic 16) crates/tui/src/tui/model_picker.rs
  • Cyclomatic Complexity · index.applyTurnEvent (cyclomatic 16) integrations/weixin-bridge/src/index.mjs
  • Cyclomatic Complexity · index.startChatRecovery (cyclomatic 16) integrations/weixin-bridge/src/index.mjs
  • Cyclomatic Complexity · review-eval.runCliCase (cyclomatic 16) scripts/review-eval.mjs
  • Cyclomatic Complexity · review-eval.runSkillCase (cyclomatic 16) scripts/review-eval.mjs
  • Cognitive Complexity · codewhale_tui::commands::config_main_host::set_config_value (cognitive 237) crates/tui/src/commands/config_main_host.rs
  • Cognitive Complexity · reexports.run (cognitive 153) scripts/split/reexports.py
  • Cognitive Complexity · review-eval.buildCorpus (cognitive 147) scripts/review-eval.mjs
  • Cognitive Complexity · codewhale_cli::cloud::computer::run (cognitive 122) crates/cli/src/cloud/computer.rs
  • Cognitive Complexity · Carver.run (cognitive 116) scripts/split/carve.py
  • Cognitive Complexity · codewhale_tui::commands::config_main_host::show_single_setting (cognitive 85) crates/tui/src/commands/config_main_host.rs
  • Cognitive Complexity · ModelInventory::from_config_scoped (cognitive 76) crates/tui/src/model_inventory.rs
  • Cognitive Complexity · Mover.plan_cfg (cognitive 75) scripts/split/move-modules.py
  • Cognitive Complexity · codewhale_tui::tools::review_core::run_review_core (cognitive 73) crates/tui/src/tools/review_core.rs
  • Cognitive Complexity · count_lines.classify_crate (cognitive 68) scripts/split/count_lines.py
  • Cognitive Complexity · codewhale_tui::tools::review_core::render_review_summary (cognitive 66) crates/tui/src/tools/review_core.rs
  • Cognitive Complexity · AcpServer::replay_history (cognitive 65) crates/tui/src/acp_server.rs
  • Cognitive Complexity · testsplit.main (cognitive 64) scripts/split/testsplit.py

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

Fixed since the last survey: 451 findings

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

  • Cyclomatic Complexity · codewhale_tui::commands::groups::config::config::set_config_value (cyclomatic 179) crates/tui/src/commands/groups/config/config.rs
  • Cyclomatic Complexity · codewhale_tui::commands::groups::config::config::show_single_setting (cyclomatic 105) crates/tui/src/commands/groups/config/config.rs
  • Cyclomatic Complexity · ModelInventory::from_config_with_health (cyclomatic 38) crates/tui/src/model_inventory.rs
  • Cyclomatic Complexity · codewhale_tui::commands::groups::config::config::set_subagents_config_value (cyclomatic 32) crates/tui/src/commands/groups/config/config.rs
  • Cyclomatic Complexity · Engine::new_admitted (cyclomatic 30) crates/tui/src/core/engine.rs
  • Cyclomatic Complexity · Engine::handle_child_send_message (cyclomatic 24) crates/tui/src/core/engine/child_host.rs
  • Cyclomatic Complexity · codewhale_tui::commands::groups::config::config::sidebar (cyclomatic 24) crates/tui/src/commands/groups/config/config.rs
  • Cyclomatic Complexity · LlmError::from_http_response (cyclomatic 20) crates/tui/src/llm_client/mod.rs
  • Cyclomatic Complexity · codewhale_tui::commands::groups::core::voice::capture_and_transcribe (cyclomatic 19) crates/tui/src/commands/groups/core/voice.rs
  • Cyclomatic Complexity · codewhale_tui::config::provider_capability_with_wire (cyclomatic 19) crates/tui/src/config.rs
  • Cyclomatic Complexity · codewhale_tui::render_review_markdown (cyclomatic 18) crates/tui/src/lib.rs
  • Cyclomatic Complexity · ExploringCell::lines_with_motion_and_locale (cyclomatic 17) crates/tui/src/tui/history.rs
  • Cyclomatic Complexity · codewhale_tui::import_claude::render_plan (cyclomatic 17) crates/tui/src/import_claude.rs
  • Cyclomatic Complexity · codewhale_workflow_js::vm::task_host_inner (cyclomatic 17) crates/workflow-js/src/vm.rs
  • Cyclomatic Complexity · ReasoningEffort::normalize_for_route (cyclomatic 16) crates/tui/src/reasoning_preference.rs
  • Cyclomatic Complexity · ShellManager::spawn_background_sandboxed (cyclomatic 16) crates/tui/src/tools/shell.rs
  • Cyclomatic Complexity · codewhale_tui::commands::groups::config::config::config_command (cyclomatic 16) crates/tui/src/commands/groups/config/config.rs
  • Cyclomatic Complexity · codewhale_tui::commands::groups::config::import_claude::apply_plan (cyclomatic 16) crates/tui/src/commands/groups/config/import_claude.rs
  • Cyclomatic Complexity · codewhale_tui::commands::groups::utility::jobs::jobs (cyclomatic 16) crates/tui/src/commands/groups/utility/jobs.rs
  • Cyclomatic Complexity · codewhale_tui::tui::ui::activity_detail::open_details_pager_for_cell (cyclomatic 16) crates/tui/src/tui/ui/activity_detail.rs
  • Cyclomatic Complexity · codewhale_tui::tui::ui::handlers::handle_shell_job_action (cyclomatic 16) crates/tui/src/tui/ui/handlers.rs
  • Cognitive Complexity · codewhale_tui::commands::groups::config::config::set_config_value (cognitive 237) crates/tui/src/commands/groups/config/config.rs
  • Cognitive Complexity · codewhale_tui::commands::groups::config::config::show_single_setting (cognitive 85) crates/tui/src/commands/groups/config/config.rs
  • Cognitive Complexity · ModelInventory::from_config_with_health (cognitive 74) crates/tui/src/model_inventory.rs
  • Cognitive Complexity · codewhale_tui::commands::groups::config::config::set_subagents_config_value (cognitive 51) crates/tui/src/commands/groups/config/config.rs
  • Cognitive Complexity · codewhale_tui::render_review_markdown (cognitive 38) crates/tui/src/lib.rs
  • Cognitive Complexity · codewhale_tui::commands::groups::core::voice::capture_and_transcribe (cognitive 36) crates/tui/src/commands/groups/core/voice.rs
  • Cognitive Complexity · Engine::handle_child_send_message (cognitive 32) crates/tui/src/core/engine/child_host.rs
  • Cognitive Complexity · Engine::new_admitted (cognitive 30) crates/tui/src/core/engine.rs
  • Cognitive Complexity · codewhale_tui::commands::groups::config::import_claude::apply_plan (cognitive 27) crates/tui/src/commands/groups/config/import_claude.rs
  • Cognitive Complexity · codewhale_tui::import_claude::render_plan (cognitive 27) crates/tui/src/import_claude.rs
  • Cognitive Complexity · check-command-config-policy-proof.source_closure (cognitive 24) scripts/check-command-config-policy-proof.py
  • Cognitive Complexity · codewhale_tui::config::provider_capability_with_wire (cognitive 23) crates/tui/src/config.rs
  • Cognitive Complexity · codewhale_tui::commands::groups::config::config::sidebar (cognitive 22) crates/tui/src/commands/groups/config/config.rs
  • Cognitive Complexity · LlmError::from_http_response (cognitive 20) crates/tui/src/llm_client/mod.rs
  • Cognitive Complexity · codewhale_tui::external_credentials::open_secure_regular_file (cognitive 20) crates/tui/src/external_credentials.rs
  • Cognitive Complexity · codewhale_tui::commands::groups::config::config::config_command (cognitive 19) crates/tui/src/commands/groups/config/config.rs
  • Cognitive Complexity · codewhale_tui::tui::markdown_render::wrap_text (cognitive 19) crates/tui/src/tui/markdown_render.rs
  • Cognitive Complexity · App::shift_history_maps_down (cognitive 18) crates/tui/src/tui/app.rs
  • Cognitive Complexity · codewhale_tui::process_tree::contained_run_with_limits (cognitive 18) crates/tui/src/process_tree.rs
  • Cognitive Complexity · ExploringCell::lines_with_motion_and_locale (cognitive 17) crates/tui/src/tui/history.rs
  • Cognitive Complexity · SetupRuntimeFacts::from_app_config (cognitive 17) crates/tui/src/tui/setup/mod.rs
  • Cognitive Complexity · codewhale_tui::tui::ui::event_loop::submit_decided_composer_input (cognitive 17) crates/tui/src/tui/ui/event_loop.rs
  • Cognitive Complexity · codewhale_tui::client::openrouter_to_catalog_offering (cognitive 16) crates/tui/src/client.rs
  • God Classes · FunctionTooLong: codewhale_tui::commands::groups::config::config::set_config_value crates/tui/src/commands/groups/config/config.rs
  • God Classes · MethodTooLong: Engine.new_admitted crates/tui/src/core/engine.rs
  • God Classes · FunctionTooLong: codewhale_tui::commands::groups::config::config::show_single_setting crates/tui/src/commands/groups/config/config.rs
  • God Classes · MethodTooLong: ModelInventory.from_config_with_health crates/tui/src/model_inventory.rs
  • God Classes · FunctionTooLong: codewhale_tui::commands::groups::config::config::config_editability_audit crates/tui/src/commands/groups/config/config.rs
  • God Classes · FunctionTooLong: codewhale_tui::commands::groups::config::config::set_subagents_config_value crates/tui/src/commands/groups/config/config.rs
  • God Classes · MethodTooLong: CoreCommands.commands crates/tui/src/commands/groups/core/mod.rs
  • God Classes · MethodTooLong: Settings.display crates/tui/src/settings.rs
  • God Classes · FileTooLong: core/core.rs crates/tui/src/commands/groups/core/core.rs
  • God Classes · MethodTooLong: TasksTool.execute_gate_run crates/tui/src/tools/tasks.rs
  • God Classes · TooManyMethods: Settings crates/tui/src/settings.rs
  • God Classes · FileTooLong: src/git_status.rs crates/tui/src/git_status.rs
  • God Classes · FunctionTooLong: codewhale_tui::process_tree::contained_run_with_limits crates/tui/src/process_tree.rs
  • Code Duplication · Near-duplicate member pair (42 shared lines) crates/tui/src/runtime_api.rs
  • Code Duplication · Edited copy of a member (224 corresponding lines) crates/tui/src/tui/widgets/approval_band_legacy.rs
  • Code Duplication · Edited copy of a member (29 corresponding lines) crates/tui/src/commands/mod.rs
  • Code Duplication · Edited copy of a member (28 corresponding lines) crates/tui/src/core/engine/tool_catalog.rs
  • Code Duplication · Members sharing a duplicated core (9 members, 50+ identical tokens) crates/tui/src/tools/web_search.rs
  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) crates/config/src/lib.rs
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) crates/tui/src/automation_manager.rs
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) crates/cloud-facts/src/lib.rs
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) crates/commands/src/debug/change.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/tui/src/commands/contract.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/tui/src/compaction.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/tui/src/core/engine/context.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/tui/src/remote_control.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/tui/src/tui/setup/mod.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/tui/src/tui/ui.rs
  • Code Duplication · Duplicated block (28–33 lines × 2) crates/tui/src/runtime_threads.rs
  • Code Duplication · Duplicated block (27 lines × 2) crates/tui/src/core/turn.rs
  • Code Duplication · Duplicated block (22–23 lines × 2) crates/tui/src/lib.rs
  • Code Duplication · Duplicated block (19–21 lines × 2) crates/tui/src/working_set.rs
  • Code Duplication · Duplicated block (19–20 lines × 2) crates/tui/src/core/engine/compaction.rs
  • Code Duplication · Duplicated block (19 lines × 2) crates/tui/src/runtime_api.rs
  • Code Duplication · Duplicated block (15–18 lines × 3) crates/tui/src/tui/feedback_picker.rs
  • Code Duplication · Duplicated block (18 lines × 2) crates/tui/src/work_graph/runtime.rs
  • Code Duplication · Duplicated block (17 lines × 2) crates/tui/src/models_dev_live.rs
  • Code Duplication · Duplicated block (16–17 lines × 2) crates/tui/src/tui/provider_picker.rs
  • Code Duplication · Duplicated block (16 lines × 2) crates/tui/src/tools/spec.rs
  • Code Duplication · Duplicated block (15–16 lines × 2) crates/tui/src/tui/ui/apply.rs
  • Code Duplication · Duplicated block (13–15 lines × 3) REDACTED
  • Code Duplication · Duplicated block (15 lines × 2) crates/tui/src/client.rs
  • Code Duplication · Duplicated block (15 lines × 2) crates/tui/src/tui/agent_details.rs
  • Code Duplication · Duplicated block (14 lines × 2) crates/tui/src/config.rs
  • Code Duplication · Duplicated block (12–13 lines × 4) crates/tui/src/runtime_threads.rs
  • Code Duplication · Duplicated block (13 lines × 3) crates/config/src/lib.rs
  • Code Duplication · Duplicated block (13 lines × 2) crates/tui/src/config/search.rs
  • Code Duplication · Duplicated block (8–13 lines × 2) crates/tui/src/exec_agent.rs
  • Code Duplication · Duplicated block (13 lines × 2) crates/tui/src/pricing.rs
  • Code Duplication · Duplicated block (12 lines × 6) crates/tui/src/tui/hotbar/setup.rs
  • Code Duplication · Duplicated block (4–12 lines × 3) crates/tui/src/commands/contract.rs
  • Code Duplication · Duplicated block (12 lines × 2) crates/tui/src/commands/mod.rs
  • Code Duplication · Duplicated block (12 lines × 2) crates/tui/src/runtime_api.rs
  • Code Duplication · Duplicated block (12 lines × 2) crates/tui/src/tools/plan.rs
  • Code Duplication · Duplicated block (11–12 lines × 2) crates/tui/src/tui/ui/apply.rs
  • Code Duplication · Duplicated block (12 lines × 2) crates/tui/src/tui/ui/event_loop.rs
Rebuild cost: about €1,600,000 · Estimate
Cost to rebuild€530,000 to €2,600,000, for 8,772 to 27,828 hours of work, about 10.9 person-years for 6 to 21 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.8 at a score of 57. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
SizeVery large: 1,402,135 lines of product code

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

Top priorities

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

1
Resolve the 12 Leaked secret finding(s) in Secret Scanning — start with REDACTED (8), REDACTED (2), REDACTED.
Raises the score by about 3 points · Medium effort · Secret Scanning
2
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
Raises the score by about 5 points · Medium effort · Keyboard semantics
3
Enforce accessibility in the toolchain: add eslint-plugin-jsx-a11y, then assert with vitest-axe in tests, then gate axe/pa11y/Lighthouse in CI.
Raises the score by about 3 points · Medium effort · A11y enforcement

Diagnosis: what the measurements show together

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

Where the investment is most exposed · Value at risk
This code would cost about €1,600,000 to build again, about 10.9 person-years of work. Its weakest lens is Accessibility, at 49 (Weak). Accessibility is about whether the interface is built so that everyone can use it, including people who can't see the screen or can't use a mouse. Because the weakest lens counts most in the score, work on Accessibility also moves the score most.
Based on: the rebuild estimate · the Accessibility grade · how much each lens counts
What to do: Start with the Accessibility actions in Top priorities.
If you do one thing first · First action
Resolve the 12 Leaked secret finding(s) in Secret Scanning. Of all the actions in this report, it raises the score most for the work it takes: about 3 points for medium effort, because it clears the 12 Secret Scanning findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 5.9 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 5% to 12% on every change. The history of the code shows how much it changes: about 2,176,051 lines over the last 90 days, which is about 8,825,096 lines a year. At that pace, the extra work comes to an estimated 1160.5 to 6963 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of Watchdog's own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture — module dependency graph

Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways — a layering smell or cycle. A clean layered graph has none.

arch codewhale-agent codewhale-agent codewhale-config codewhale-config codewhale-agent->codewhale-config codewhale-agent-contract codewhale-agent-contract codewhale-agent-contract->codewhale-config codewhale-execpolicy codewhale-execpolicy codewhale-agent-contract->codewhale-execpolicy codewhale-protocol codewhale-protocol codewhale-agent-contract->codewhale-protocol codewhale-app-server codewhale-app-server codewhale-app-server->codewhale-agent codewhale-app-server->codewhale-config codewhale-core codewhale-core codewhale-app-server->codewhale-core codewhale-hooks codewhale-hooks codewhale-app-server->codewhale-hooks codewhale-paths codewhale-paths codewhale-app-server->codewhale-paths codewhale-app-server->codewhale-protocol codewhale-release codewhale-release codewhale-app-server->codewhale-release codewhale-state codewhale-state codewhale-app-server->codewhale-state codewhale-build-support codewhale-build-support codewhale-cli codewhale-cli codewhale-cli->codewhale-app-server codewhale-cli->codewhale-build-support codewhale-cli->codewhale-config codewhale-cli->codewhale-execpolicy codewhale-lane codewhale-lane codewhale-cli->codewhale-lane codewhale-cli->codewhale-paths codewhale-cli->codewhale-release codewhale-secrets codewhale-secrets codewhale-cli->codewhale-secrets codewhale-cli->codewhale-state codewhale-telemetry codewhale-telemetry codewhale-cli->codewhale-telemetry codewhale-tui codewhale-tui codewhale-cli->codewhale-tui codewhale-command-contract codewhale-command-contract codewhale-command-contract->codewhale-protocol codewhale-config->codewhale-execpolicy codewhale-config->codewhale-paths codewhale-config->codewhale-protocol codewhale-config->codewhale-secrets codewhale-core->codewhale-config codewhale-core->codewhale-hooks codewhale-core->codewhale-protocol codewhale-core->codewhale-state codewhale-execpolicy->codewhale-protocol codewhale-hooks->codewhale-paths codewhale-hooks->codewhale-protocol codewhale-hooks->codewhale-release codewhale-lane->codewhale-config codewhale-models codewhale-models codewhale-models->codewhale-config codewhale-models->codewhale-core codewhale-runtime codewhale-runtime codewhale-runtime->codewhale-command-contract codewhale-runtime->codewhale-config codewhale-runtime->codewhale-core codewhale-runtime->codewhale-execpolicy codewhale-runtime->codewhale-lane codewhale-runtime->codewhale-models codewhale-runtime->codewhale-secrets codewhale-secrets->codewhale-paths codewhale-state->codewhale-paths codewhale-state->codewhale-protocol codewhale-telemetry->codewhale-build-support codewhale-telemetry->codewhale-config codewhale-telemetry->codewhale-paths codewhale-telemetry->codewhale-release codewhale-tui->codewhale-agent codewhale-tui->codewhale-agent-contract codewhale-tui->codewhale-app-server codewhale-tui->codewhale-build-support codewhale-tui->codewhale-command-contract codewhale-tui->codewhale-config codewhale-tui->codewhale-core codewhale-tui->codewhale-execpolicy codewhale-tui->codewhale-hooks codewhale-tui->codewhale-lane codewhale-tui->codewhale-models codewhale-tui->codewhale-paths codewhale-tui->codewhale-protocol codewhale-tui->codewhale-release codewhale-tui->codewhale-runtime codewhale-tui->codewhale-secrets codewhale-tui->codewhale-telemetry __more__ +26 more projects

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.

1537 modules, with 4461 dependencies between them. 12 loops run through 294 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 1497 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 codewhale_command_contract.handler2 codewhale_command_contract.outcome3 codewhale_config.provider_kind4 codewhale_execpolicy.shell_expand5 codewhale_localization6 codewhale_memory7 codewhale_tui.plugins.install.dsh8 crossterm.event9 crossterm.style.types.color10 codewhale_command_contract.metadata11 codewhale_config12 codewhale_config.cloud_facts.overlay13 codewhale_protocol.event_msg14 codewhale_protocol.request15 codewhale_ratatui.whale_motion.acting16 codewhale_tools17 codewhale_tui.tui.app.types18 codewhale_command_contract.facets19 codewhale_config.app_mode20 codewhale_models21 codewhale_tui.config22 codewhale_tui.tui.pet_watch.live23 codewhale_ratatui.theme24 codewhale_tui.cost_status25 codewhale_tui.plugins.registry26 codewhale_tui.tui.history27 codewhale_ratatui28 codewhale_ratatui.gallery29 codewhale_tui.client30 codewhale_tui.tools.spec31 codewhale_tui.extension_host32 codewhale_tui.tools.subagent33 codewhale_tui.core.engine34 codewhale_tui.tui.views35 codewhale_tui.runtime_threads36 codewhale_tui.runtime_api37 codewhale_tui.session_manager38 codewhale_tui39 codewhale_tui.tui.app40 codewhale_tui.commands.contract
1 codewhale_command_contract.handler
2 codewhale_command_contract.outcome
3 codewhale_config.provider_kind
4 codewhale_execpolicy.shell_expand
5 codewhale_localization
6 codewhale_memory
7 codewhale_tui.plugins.install.dsh
8 crossterm.event
9 crossterm.style.types.color
10 codewhale_command_contract.metadata1
11 codewhale_config712
12 codewhale_config.cloud_facts.overlay1
13 codewhale_protocol.event_msg1
14 codewhale_protocol.request3
15 codewhale_ratatui.whale_motion.acting2
16 codewhale_tools4
17 codewhale_tui.tui.app.types111
18 codewhale_command_contract.facets4
19 codewhale_config.app_mode11
20 codewhale_models1
21 codewhale_tui.config512214
22 codewhale_tui.tui.pet_watch.live41
23 codewhale_ratatui.theme11
24 codewhale_tui.cost_status21421
25 codewhale_tui.plugins.registry141
26 codewhale_tui.tui.history1291111
27 codewhale_ratatui12
28 codewhale_ratatui.gallery1
29 codewhale_tui.client214132613
30 codewhale_tui.tools.spec25122
31 codewhale_tui.extension_host122251
32 codewhale_tui.tools.subagent21542134735
33 codewhale_tui.core.engine312139441823519
34 codewhale_tui.tui.views321081243
35 codewhale_tui.runtime_threads16916124141145
36 codewhale_tui.runtime_api13511631213
37 codewhale_tui.session_manager1212172
38 codewhale_tui11211224124
39 codewhale_tui.tui.app3312441611812312181
40 codewhale_tui.commands.contract2111456111132
Uses a module listed above itPart of a loopThe module itself
1 codewhale_command_contract.handler2 codewhale_command_contract.outcome3 codewhale_config.provider_kind4 codewhale_execpolicy.shell_expand5 codewhale_localization6 codewhale_memory7 codewhale_tui.plugins.install.dsh8 crossterm.event9 crossterm.style.types.color10 codewhale_command_contract.metadata11 codewhale_config12 codewhale_config.cloud_facts.overlay13 codewhale_protocol.event_msg14 codewhale_protocol.request15 codewhale_ratatui.whale_motion.acting16 codewhale_tools17 codewhale_tui.tui.app.types18 codewhale_command_contract.facets19 codewhale_config.app_mode20 codewhale_models21 codewhale_tui.config22 codewhale_tui.tui.pet_watch.live23 codewhale_ratatui.theme24 codewhale_tui.cost_status25 codewhale_tui.plugins.registry26 codewhale_tui.tui.history27 codewhale_ratatui28 codewhale_ratatui.gallery29 codewhale_tui.client30 codewhale_tui.tools.spec31 codewhale_tui.extension_host32 codewhale_tui.tools.subagent33 codewhale_tui.core.engine34 codewhale_tui.tui.views35 codewhale_tui.runtime_threads36 codewhale_tui.runtime_api37 codewhale_tui.session_manager38 codewhale_tui39 codewhale_tui.tui.app40 codewhale_tui.commands.contractcodewhale_command_contract.handler1codewhale_command_contract.outcome2codewhale_config.provider_kind3codewhale_execpolicy.shell_expand4codewhale_localization5codewhale_memory6codewhale_tui.plugins.install.dsh7crossterm.event8crossterm.style.types.color9codewhale_command_contract.metadata10codewhale_config11codewhale_config.cloud_facts.overlay12codewhale_protocol.event_msg13codewhale_protocol.request14codewhale_ratatui.whale_motion.acting15codewhale_tools16codewhale_tui.tui.app.types17codewhale_command_contract.facets18codewhale_config.app_mode19codewhale_models20codewhale_tui.config21codewhale_tui.tui.pet_watch.live22codewhale_ratatui.theme23codewhale_tui.cost_status24codewhale_tui.plugins.registry25codewhale_tui.tui.history26codewhale_ratatui27codewhale_ratatui.gallery28codewhale_tui.client29codewhale_tui.tools.spec30codewhale_tui.extension_host31codewhale_tui.tools.subagent32codewhale_tui.core.engine33codewhale_tui.tui.views34codewhale_tui.runtime_threads35codewhale_tui.runtime_api36codewhale_tui.session_manager37codewhale_tui38codewhale_tui.tui.app39codewhale_tui.commands.contract40171211324111411151221441112142114112911111212141326132512212225121542134735312139441823519321081243169161241411451351163121312121721121122412433124416118123121812111456111132+1497 more modules (most-connected shown)

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

At a glance — Architecture · 83% · Strong ·

At a glance — Maturity · 85% · Exemplary ·

At a glance — Readiness · 59% · Adequate · gated by D13, P7 ·

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

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

At a glance — Event Sourcing · 100% · Exemplary ·

At a glance — Accessibility · 49% · Adequate · gated by AC4 ·

At a glance — Performance · 74% · Strong ·

Security & Compliance — OWASP Top-10 mapping

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

OWASP categoryFindingsSeverity
A05:2025 — Injection149High / Critical
A07:2025 — Authentication Failures12High / Critical
A03:2025 — Software Supply Chain Failures10High / Critical
A02:2025 — Security Misconfiguration6Medium

Roadmap

First, fix keyboard navigation by making custom controls operable and ensuring anchors have valid hrefs, while adding text alternatives for all images, media, and interactive elements. Next, enforce accessibility standards in the development toolchain by integrating linting and automated testing to prevent future regressions. Simultaneously, resolve the identified secret leaks in the codebase and address visual safety issues by restoring visible focus styles, guarding animations for reduced motion preferences, and improving color contrast.

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

Do thisHelpsEffortDimension
Resolve the 12 Leaked secret finding(s) in Secret Scanning — start with REDACTED (8), REDACTED (2), REDACTED.+2.9 ptsMediumSecret Scanning
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.+4.5 ptsMediumKeyboard semantics
Enforce accessibility in the toolchain: add eslint-plugin-jsx-a11y, then assert with vitest-axe in tests, then gate axe/pa11y/Lighthouse in CI.+3.3 ptsMediumA11y enforcement
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.+1.8 ptsMediumText alternatives
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.+1.5 ptsMediumVisual & motion safety
Bound every outbound call: pass `signal: AbortSignal.timeout(ms)` to `fetch`, set `timeout` on the axios instance (`axios.create({ timeout })`), and add retries with back-off (`axios-retry`, `p-retry`) and a breaker (`opossum`, `cockatiel`) around dependencies that fail.+1.3 ptsMediumOutbound HTTP resilience
Interpolated log message defeats structured logging+0.9 ptsMediumStructured logging
Bring the 3 bodies over 240 down to 240 or less in Cyclomatic Complexity — start with codewhale_tui::tui::ui::event_loop::run_event_loop (cyclomatic 791), linux.create (cyclomatic 326), callTool (cyclomatic 284).+0.7 ptsHighCyclomatic Complexity

File quality

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

FileScoreBandWorst signal
REDACTED2.8SlopSecret Scanning: Leaked secret: REDACTED
REDACTED3.7MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.5MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.6MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.8MixedSecret Scanning: Leaked secret: REDACTED
REDACTED4.8MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.9MixedStatic 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
REDACTED5.1MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.4MixedStatic Analysis (SAST): Medium: REDACTED
crates/tui/src/config.rs5.5MixedCyclomatic Complexity: codewhale_tui::config::apply_env_overrides_unlocked (cyclomatic 188)
crates/tui/src/runtime_threads.rs5.5MixedCyclomatic Complexity: RuntimeThreadManager::monitor_turn (cyclomatic 186)

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

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

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

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

Could not be resolved — 13

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

Methodology & how to trust this report

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

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

What we checked — 95 dimensions across the health lenses
D1D2D3D4D5D6D7D9D10D13D14D15D17D19D20D26D29D30D31D34D35D36D37D43D44AC1AC2AC3AC4AC5AC6AC7AX10AX3AX4AX6AX8AX9C2DM4DM5ES1ES2M1M2M3M4P1P10P11P2P3P4P6P7P8PF1PF2PF3R1R10R11R2R3R4R5R6R7R8R9S1X1X12X13X14X15X16X17X18X19X2X20X21X22X23X24X25X26X27X28X29X3X30X4X5

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

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

Tools & methods

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

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

Every finding is locatable in findings.md. Run 01a17630-2d15-73c9-acd1-e4a45851dcf5.

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

Run transparency — what happened this run

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

  • D8 Code Coverage — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: this repository's production source spans .mts, .ts, .tsx, .rs, and our analyzer cannot run the .rs test suite(s) — so no coverage was collected for the repository as a whole. The JavaScript/TypeScript half did build and run, and its own line coverage came back at 51.6% — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — coverage is excluded from the score rather than counted as a near-zero. In the meantime, produce a coverage report in a standard format (lcov — `vitest --coverage`, `jest --coverage`, `bun test --coverage --coverage-reporter=lcov`, or `nyc`, or lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures and real coverage will be read. You can widen what we reach: optional: produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then both halves are read on the next scan.
  • D10 Test Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 1,959 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 246 test source file(s) (.rs, .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 — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability not included — the JavaScript/TypeScript suite (node:test via `npm ci --ignore-scripts` in crates/tui/extension-host/ (413 tests); node:test via `npm ci --ignore-scripts` in crates/tui/plugins/computer-use/; node:test via `npm ci --ignore-scripts` in extensions/vscode/; node:test via `npm ci --ignore-scripts` in integrations/bridge-core/; node:test via `npm ci --ignore-scripts` in integrations/feishu-bridge/; node:test via `npm ci --ignore-scripts` in integrations/telegram-bridge/; node:test via `npm ci --ignore-scripts` in integrations/wecom-bridge/; node:test via `npm ci --ignore-scripts` in integrations/weixin-bridge/; node:test via `npm ci --ignore-scripts` in npm/codewhale/; node:test via `npm ci --ignore-scripts` in npm/runtime-sdk/; node:test via `npm ci --ignore-scripts` in pet/; vitest via `npm ci --ignore-scripts` in telemetry-ingest/) did not finish re-running within its budget: too large to re-run within its budget.
  • D12 Dependency Hygiene — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Not scored — 1 Maven/Gradle manifest(s) were read, stating a version for 4 dependency(ies) and leaving 0 to a parent or an imported BOM, but no build resolved the dependency graph, so the outdated signal was not established. NOT a finding that these dependencies are current or healthy.
  • D14 License Compliance — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 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.
  • 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 (251 contributor(s) across 13434 commit(s) sampled, automation and bot accounts excluded). One of them holds 85% of the history; the other 250 hold 0.1% each on average, below the 5% at which there is somebody to hand the work to. That is a single maintainer with drive-by contributors, not a team whose knowledge has concentrated — so the bus factor is not applicable and there is nothing here for the owner to act on.
  • D19 Documentation Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
  • D19 Documentation Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 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 — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
  • D22 Internal API Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
  • D24 Comment Value — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
  • D27 Navigability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
  • D28 Secrets (history) — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `gitleaks` TIMED OUT after 323.2s against a 323.2s budget, so we killed its process tree. The budget is ours; the work may simply be larger than it allows. Nothing about this repository is asserted by the absence of a result; the budget is ours to raise, and raising it is our backlog item, not an action for this repository's owner.
  • D31 IaC & Container Security — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Checkov ran but its report could not be read (checkov produced no output — not a clean result). Every misconfiguration only checkov reports — most of its Terraform, CloudFormation, Bicep and Ansible policies — is absent from this card, so its absence here is not evidence those resources are configured correctly.
  • D32 Data Compliance (PII/GDPR) — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `pet/android/PetSim.kt`, `pet/android/src/main/kotlin/codewhale/pet/PetViewModel.kt`, `pet/src/core/model.ts`, `web/components/icon.tsx`, `web/lib/content/account-entry.ts`, … (+10 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
  • AX1 Captive dependencies — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in crates/tui/plugins/computer-use/src/registry.mjs, 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 (rendered) — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 20 % of assessed (surface, criterion) pairs differed between renders and were excluded from evidence.
  • GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Kotlin, Python, Rust, Swift, c, objectivec is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Kotlin, Python, Rust, Swift, c, objectivec is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • M4 Documentation accuracy — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9). Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • PF3 Async & latency hygiene — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 37 further occurrence(s) are not listed individually; the score already reflects all 77.
  • R10 Code Duplication — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 136 further occurrence(s) are not listed individually; the score already reflects all 176.
  • R4 Test Coverage — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 54 further occurrence(s) are not listed individually; the score already reflects all 94.
  • X3 Exception handling — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 104 further occurrence(s) are not listed individually; the score already reflects all 144.
  • X4 Structured logging — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 249 further occurrence(s) are not listed individually; the score already reflects all 289.
  • X7 Silent fallback defaults — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 17 further occurrence(s) are not listed individually; the score already reflects all 57.

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

Limitations & what we did not check

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

Per-dimension blind spots

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

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

Dimensions

D1 · Cyclomatic 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

976 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was codewhale_tui::tui::ui::event_loop::run_event_loop at 791. A further 96 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 codewhale_tui::commands::contract::key_to_message_id at 109 — they are counted neither in the figure above nor in this dimension's score. 30 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: crates/tui/src/commands/contract/config_policy_messages.rs (codewhale_tui::commands::contract::config_policy_messages::resolve at 105), crates/tui/src/commands/groups/config/policy_messages.rs (StatusMessages::text at 79), crates/tui/src/commands/contract/core_navigation.rs (codewhale_tui::commands::contract::core_navigation::resolve_message at 59), crates/tui/src/core/protocol_parity.rs (codewhale_tui::core::protocol_parity::event_to_protocol at 58), crates/protocol/src/event_msg.rs (EventMsg::kind_str at 55), and 25 more not listed here. They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.

codewhale_tui::tui::ui::event_loop::run_event_loop (cyclomatic 791) · ×309crates/tui/src/tui/ui/event_loop.rs:1854
(anonymous)::observe (cyclomatic 72) · ×30pet/ios/Resources/pet-native.js:1909
Engine::plan_tool_calls (cyclomatic 116) · ×26crates/tui/src/core/engine/turn_loop.rs:1803
codewhale_cli::cloud::computer::run (cyclomatic 89) · ×25crates/cli/src/cloud/computer.rs:171
RuntimeThreadManager::monitor_turn (cyclomatic 186) · ×17crates/tui/src/runtime_threads.rs:17749

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

What to do

  1. Bring the 3 bodies over 240 down to 240 or less in Cyclomatic Complexity — start with codewhale_tui::tui::ui::event_loop::run_event_loop (cyclomatic 791), linux.create (cyclomatic 326), callTool (cyclomatic 284). — 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 3 together lifts Cyclomatic Complexity from 2.0 to about 3.7/10, projected with the scoring formula itself and assuming each lands exactly at 240; 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

1415 method(s) exceeded the cognitive complexity threshold of 15; the worst was codewhale_tui::tui::ui::event_loop::run_event_loop at 1590.

codewhale_tui::tui::ui::event_loop::run_event_loop (cognitive 1590) · ×545crates/tui/src/tui/ui/event_loop.rs:1854
codewhale_cli::cloud::computer::run (cognitive 122) · ×34crates/cli/src/cloud/computer.rs:171
(anonymous)::compilePetTelemetry (cognitive 87) · ×32pet/ios/Resources/pet-native.js:1219
Engine::execute_planned_tools (cognitive 225) · ×31crates/tui/src/core/engine/turn_loop.rs:2674
RuntimeThreadManager::monitor_turn (cognitive 379) · ×21crates/tui/src/runtime_threads.rs:17749

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

What to do

  1. Bring the 37 bodies over 120 down to 120 or less in Cognitive Complexity — start with codewhale_tui::tui::ui::event_loop::run_event_loop (cognitive 1590), callTool (cognitive 411), linux.create (cognitive 388). — 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 Cognitive Complexity from 2.0 to about 3.4/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
  2. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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

772 god class(es) detected.

FileTooLong: src/runtime_threads.rs · ×260crates/tui/src/runtime_threads.rs
FunctionTooLong: codewhale_tui::tui::ui::event_loop::run_event_loop · ×235crates/tui/src/tui/ui/event_loop.rs:1854
MethodTooLong: App.new_with_plugin_registry · ×143crates/tui/src/tui/app/init.rs:27
ClassTooLong: Engine · ×58crates/tui/src/core/engine.rs:994
TooManyMethods: App · ×36crates/tui/src/tui/app.rs:1555

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

What to do

  1. Resolve the 260 FileTooLong finding(s) in God Classes — start with mod.rs (13), REDACTED (10), registry.rs (3). — One of this dimension's main actionable groups (260 warning-level).
  2. Resolve the 235 FunctionTooLong finding(s) in God Classes — start with mod.rs (18), REDACTED (7), apply.rs (4). — One of this dimension's main actionable groups (235 warning-level).
  3. Resolve the 143 MethodTooLong finding(s) in God Classes — start with mod.rs (19), engine.rs (8), turn_loop.rs (7). — One of this dimension's main actionable groups (143 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.7 / 10Stronggated by 820 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.7 / 10 · rule-coverage 100% · ceiling Verified

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

Duplicated block (9 lines × 2) · ×69crates/app-server/src/lib.rs:3092
Duplicated block (8 lines × 2) · ×62crates/app-server/src/lib.rs:797
Duplicated block (6 lines × 2) · ×54crates/command-contract/src/types.rs:29
Duplicated block (10 lines × 2) · ×53crates/app-server/src/lib.rs:2531
Duplicated block (11 lines × 2) · ×50crates/config/src/lib.rs:7386

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

What to do

  1. Resolve the 69 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with runtime_threads.rs (7), mod.rs (4), REDACTED (3). — One of this dimension's main actionable groups (69 warning-level).
  2. Resolve the 62 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with runtime_threads.rs (7), REDACTED (4), mod.rs (4). — One of this dimension's main actionable groups (62 warning-level).
  3. Resolve the 54 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with config.rs (4), runtime_api.rs (4), approval_band_legacy.rs (2). — One of this dimension's main actionable groups (54 warning-level).
  4. Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

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

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

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

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

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

46 production modules (Gradle+Cargo+npm+Python+XcodeGen), 0 dependency cycle(s), 2 unstable depended-on module(s). Read from the build's own module declarations; edges a convention plugin adds from buildSrc or build-logic are not visible there; an XcodeGen target's dependency on a local Swift package or on a target of another project is not visible there; 9 module(s) off the main sequence, with abstractness counted on 31 of the 46 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).

Off the main sequence: codewhale-paths · ×9
Unstable project codewhale-runtime
Unstable project codewhale-tui

What to do

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

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

D6 · Cohesion (LCOM4)9.9 / 10Stronggated by 10 serious findings✓ Tool-verified

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

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

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

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

10 of 891 classes have LCOM4 above 3.

Low cohesion: ToolContext (LCOM4 27) · ×10crates/tui/src/tools/spec.rs:563

What to do

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

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

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

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

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

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

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

Classify ADR enforcement: Fleet rebuild decisions (2026-08-04) · ×10docs/decisions/2026-08-04-fleet-rebuild.md

What to do

  1. Resolve the 10 Classify ADR enforcement finding(s) in Architectural Integrity — start with 2026-08-04-fleet-rebuild.md, 1364-hooks-lifecycle.md, 2189-persistence-sqlite.md. — One of this dimension's main actionable groups (10 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 Distribution10.0 / 10Exemplary✓ Tool-verified

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

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

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

21492 test methods: 20787 unit, 697 integration, 0 BDD, 8 e2e. The JavaScript/TypeScript suite contributes 1959 `it`/`test` case(s) across 203 test file(s) declaring at least one; its tier split is read from package names and paths only. The Rust suite contributes 19233 `#[test]` function(s) across 1012 file(s) declaring at least one; its unit/integration split is Cargo's own — 67 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 300 test function(s) across 17 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 10 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

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

Fixed-sleep synchronisation: the CLI follows real Runtime SSE envelopes through disconnect and cursor recovery, recording no prompt content · ×10pet/tests/pet-runtime.test.mjs:81
Skipped (documented): (unnamed test) · ×2web/lib/public-installer-contract.test.ts:205

What to do

  1. Resolve the 10 Fixed-sleep synchronisation finding(s) in Test Quality — start with harmony-route-lifecycle.test.mjs (4), pet-runtime.test.mjs (3), app-controls.test.mjs. — One of this dimension's main actionable groups (10 warning-level).
  2. Enforce Test Quality in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D13 · Secret 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

9 secret(s) detected. 1 detection(s) binding a constant this repository later uses as the needle of a text substitution were excluded — a value spliced into the program's own output as a marker and stripped back out is high-entropy so that it cannot collide with that text, and there is no issuer at which it could be revoked.

REDACTED

What to do

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

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

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

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

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

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

0 of 647 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. This repository publishes itself under MIT, which is its own choice and is not judged here. ★ COVERAGE OF THIS VERDICT: it grades this repository's crate dependencies and nothing else. The repository also declares package.json, and the licences of those dependencies 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 Hotspots7.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 7.7 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: crates/tui/src/tui/ui/event_loop.rs (303×791=239673); crates/tui/src/config.rs (254×188=47752); crates/tui/src/runtime_threads.rs (248×186=46128) Repeated repair below the complexity floor: crates/tui/src/core/engine/streaming.rs (11 of 21 changes were fixes); crates/tui/src/tools/codemode.rs (10 of 19 changes were fixes); crates/tui/src/tui/persistence_actor.rs (10 of 16 changes were fixes)

Hotspot: crates/tui/src/tui/ui/event_loop.rs · ×297crates/tui/src/tui/ui/event_loop.rs:1854
Repeated repair: crates/tui/src/core/engine/streaming.rs · ×69crates/tui/src/core/engine/streaming.rs:766

What to do

  1. Resolve the 297 Hotspot finding(s) in Churn × Complexity Hotspots — start with mod.rs (15), REDACTED (6), config.rs (3). — One of this dimension's main actionable groups (297 warning-level).
  2. Resolve the 69 Repeated repair finding(s) in Churn × Complexity Hotspots — start with worktree.rs (2), types.rs (2), streaming.rs. — One of this dimension's main actionable groups (69 warning-level).

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

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

12 deducted task-comment markers across 1402135 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 · ×12crates/tui/src/work_graph/reducer.rs:335

What to do

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

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

D20 · ADR Quality8.4 / 10Strong✓ Tool-verified

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

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

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

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

ADR declares no status · ×4docs/rfcs/2189-persistence-sqlite.md:1detected by adr-integrity
ADR has no Context section · ×2docs/rfcs/4468-output-presentation-filters.md:1detected by adr-integrity

What to do

  1. Resolve the 4 ADR declares no status finding(s) in ADR Quality — start with 2189-persistence-sqlite.md, FILE_DECOMPOSITION_0_9_0.md, HARNESS_PROFILE_CUTLINE.md. — One of this dimension's main actionable groups (4 recommendation-level).
  2. Resolve the 2 ADR has no Context section finding(s) in ADR Quality — start with 4468-output-presentation-filters.md, UNIFIED_PROVIDER_LOGIN.md. — One of this dimension's main actionable groups (2 recommendation-level).

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

D26 · Project Cohesion6.9 / 10Adequate✓ Tool-verified

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

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

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

8 of 50 build units (Cargo, Gradle, Python, XcodeGen, 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.

D29 · Static Analysis (SAST)0.2 / 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.2 / 10 · rule-coverage 100% · ceiling Documented

150 finding(s): 0 critical, 108 high, 40 medium, 2 low. 97 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 77 file(s) — `REDACTED`, `crates/config/src/lib.rs`, `crates/config/src/private_directory.rs` (line 821, line 843), `crates/telemetry/src/event.rs` (line 328, line 329, line 330, …), `crates/telemetry/src/tests.rs` (line 1077, line 1081), … (+72 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 8 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

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

What to do

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

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

D30 · Dependency Vulnerabilities8.6 / 10Adequategated by 1 critical finding✓ Tool-verified

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

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

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

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

REDACTED
REDACTED

What to do

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

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

D31 · IaC & Container Security9.5 / 10Stronggated by 5 serious findings✓ Tool-verified

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

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

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

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

REDACTED
REDACTED

What to do

  1. Resolve the 5 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (4), REDACTED.release. — One of this dimension's main actionable groups (5 warning-level).
  2. Resolve the 1 Low IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d31_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 1398 of the 1706 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.7 / 10Stronggated by 14 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.7 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: REDACTED↔mod.rs 77%; darwin.mjs↔tools.mjs 77%; provider_defaults.rs↔config.rs 75%

Change coupling: REDACTED ↔ mod.rs · ×12crates/localization/src/lib.rs:1
Change-coupling hub: provider_defaults.rs → REDACTED, provider.rs, provider_kind.rs, REDACTED, client.rs, config.rs, config_persistence.rs · ×2crates/config/src/provider_defaults.rs

What to do

  1. Resolve the 12 Change coupling finding(s) in Change Coupling — start with REDACTED (2), session.rs (2), darwin.mjs. — One of this dimension's main actionable groups (12 warning-level).
  2. Resolve the 2 Change-coupling hub finding(s) in Change Coupling — start with provider_defaults.rs, REDACTED. — One of this dimension's main actionable groups (2 warning-level).

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

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

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

REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. 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).
  2. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 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. Scored apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

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 3 platform declaration(s) and 8 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 alternatives5.5 / 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.

  • A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content. — pet/port.html:9

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 & labels7.5 / 10Strong✓ 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 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) — crates/tui/src/runtime_mobile.html:251, crates/tui/src/runtime_mobile.html:287
  • This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. — crates/tui/src/runtime_web/orca-evidence.html:125
  • This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. — web/app/[locale]/admin/admin-client.tsx:93
  • A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one. (×2) — web/components/merch-interest.tsx:67, web/components/merch-storefront.tsx:95

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

  • Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one. — web/components/ratatui/explorer.tsx:235

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.7 / 10Weak✓ 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".

  • The repo's own CSS styles .choice with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. (×2) — crates/tui/src/runtime_web/orca-evidence.html:102, crates/tui/src/runtime_web/orca-evidence.html:106

What to do

  • Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
AC5 · ARIA correctness7.8 / 10Strong✓ Tool-verified

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.

  • A plain <div> has the implicit role "generic", which supports no ARIA states, so this aria-pressed is dropped and assistive tech is never told the state at all. Put aria-pressed on the element that owns the behaviour (the button or control the user operates), or give this <div> a role that supports aria-pressed. (×2) — crates/tui/src/runtime_web/orca-evidence.html:102, crates/tui/src/runtime_web/orca-evidence.html:106

What to do

  • Use valid, non-abstract roles, supply the ARIA state each role requires, and never put aria-hidden on a focusable element.
AC6 · Visual & motion safety5.9 / 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.

  • `.search-field input` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — crates/tui/src/runtime_web/styles.css:294
  • `.other-answer` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — crates/tui/src/runtime_web/styles.css:964
  • `.composer textarea` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — crates/tui/src/runtime_web/styles.css:998

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

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.1 / 10Exemplary✓ Tool-verified

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

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

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

What to do

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

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

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

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

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

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

AX6 · Interface segregation10.0 / 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.

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.

  • `RuntimeEventJournal.load` is a read-named query yet it performs a durable write on the read path (a persist to a store/repository). A query must stay side-effect-free so reads are safe to retry, cache, and route to a read replica; move the write into a command. — crates/tui/src/remote_control.rs:449

What to do

  • Keep query handlers read-only — move the writes/event-publishes into a command handler so reads stay safe to retry, cache, and route to a read replica.
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.

DM4 · Rich vs anemic domain model8.0 / 10Strong✓ Tool-verified

Other · Domain Modelling — Whether domain entities own their behaviour (invariant-enforcing commands) rather than being data-only structs driven by a foreign service.

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

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

  • `FleetWorkerReportedRoute` is a data-only domain entity with `pub` mutable state and no invariant-enforcing behaviour of its own, while the repo holds the logic in a foreign service/manager/use-case — the anemic domain model. Move the behaviour onto the entity so it enforces its own invariants (or make it an immutable value object with private fields) rather than being driven from outside. — crates/tui/src/fleet/executor.rs:689

What to do

  • Move the domain logic onto the entity (invariant-enforcing `&mut self` commands) instead of a foreign service.
DM5 · Encapsulated state10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether a domain type's identity-bearing field stays immutable — a `pub` mutable field under a hand-rolled Hash/PartialEq breaks the value-identity invariant.

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

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

ES1 · Fold determinism10.0 / 10Exemplary✓ Tool-verified

Other · Event Sourcing — Whether the recovery-replay fold is deterministic — state derived purely from each event's own fields, no clock/random/IO on the replay path.

Method: Roslyn syntax scan (event-sourcing gated): Apply/When folds checked for forbidden tokens (DateTime.Now, Guid.NewGuid, Random, IO), stripped of comments/strings. Deterministic, hard fact per fold.

ES2 · Immutable events10.0 / 10Exemplary✓ Tool-verified

Other · Event Sourcing — Whether domain events stay immutable (private fields, set once) rather than carrying mutable state.

Method: Roslyn scan (event-sourcing gated): persisted events checked for public setters; immutability verified per property/field. Deterministic, hard fact.

M1 · Documentation (README)7.3 / 10Strong✓ Tool-verified

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

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

What to do

  • Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
  • Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
  • Add a README to the 37 of 55 project(s) that lack one — worth up to 1.3 pts.
M2 · Architecture documentation8.5 / 10Exemplary✓ 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 10) — reach 20 to raise the maturity tier; document significant decisions as they're made.
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

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

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

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

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

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

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

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

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

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

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

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

P11 · BDD / executable specs10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether behaviour is captured as executable Gherkin specifications (a plus for shared understanding) — only assessed when a BDD framework is present.

Method: Filesystem scan: BDD framework presence (SpecFlow, Gherkin files) when a project references a BDD tool. Exhaustive, deterministic.

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

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

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

  • Only 13/21 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `.`, `crates/memory`, `crates/tui/plugins/computer-use`, `npm/codewhale` and 3 more.

What to do

  • Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
  • Add OpenTelemetry tracing/metrics (opentelemetry with tracing-opentelemetry) so requests are traceable across the system, not just health-probable.
P3 · Security & performance tooling8.0 / 10Strong✓ 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.

What to do

  • Dependabot is configured but does not watch `pip`, `gradle`, `composer` — add those `package-ecosystem` entries to REDACTED so those dependencies get the same automatic update and advisory pressure as the ones it already covers.
  • 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.

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.

  • `fetch(` 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. (×4) — crates/tui/src/runtime_web/app.mjs:529, crates/tui/src/runtime_web/app.mjs:1099, scripts/ci/cnb-github-checkrun.mjs:72, …

What to do

  • Bound every outbound call: pass `signal: AbortSignal.timeout(ms)` to `fetch`, set `timeout` on the axios instance (`axios.create({ timeout })`), and add retries with back-off (`axios-retry`, `p-retry`) and a breaker (`opossum`, `cockatiel`) around dependencies that fail.
P8 · Schema migrations10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether database schema changes go through versioned migrations rather than being auto-created from the model at startup.

Method: Roslyn scan: EF Core DbContext for a versioned migrations directory versus bare EnsureCreated usage; off .NET, a file scan of dependency manifests, migration histories (Flyway, Liquibase, Alembic, Django, Rails, Prisma, TypeORM, Knex/Sequelize, golang-migrate, goose, Laravel, Doctrine, Diesel/sqlx) and schema auto-create in production source or config. Exhaustive, deterministic.

PF1 · Benchmark discipline8.5 / 10Exemplary✓ Tool-verified

Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.

Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.

PF2 · Allocation hygiene8.6 / 10Exemplary✓ Tool-verified

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

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

What to do

  • Raise allocation-aware density on the hot paths — currently 18 use(s) across 3,404 production line(s) (~5.3/1k). More of the idioms below on the allocation-heavy paths climbs this toward 10.
  • Kotlin: on hot paths, use primitive arrays (IntArray, LongArray …) and @JvmInline value classes instead of boxed values, primitive collections (androidx.collection, fastutil) instead of boxed ones, and presize collections and StringBuilders.
  • Swift: on hot paths, reserveCapacity before appending, use ContiguousArray for class-element arrays, work in place with withUnsafeBufferPointer/withUnsafeTemporaryAllocation, and make large values ~Copyable with borrowing/consuming parameters.
PF3 · Async & latency hygiene6.0 / 10Adequate✓ Tool-verified

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

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

  • `fs.existsSync` in `runBackgroundCheck` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/app/background-check.mjs:13
  • `fs.mkdtempSync` in `runBackgroundCheck` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/app/background-check.mjs:18
  • `fs.mkdirSync` in `runBackgroundCheck` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/app/background-check.mjs:49
  • `fs.copyFileSync` in `runBackgroundCheck` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/app/background-check.mjs:76
  • `fs.rmSync` in `runBackgroundCheck` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/app/background-check.mjs:89
  • `fs.writeFileSync` in `userControl` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/app/daemon.mjs:60
  • `fs.renameSync` in `userControl` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/app/daemon.mjs:61
  • `fs.readFileSync` in `shutdown` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/app/daemon.mjs:247
  • `fs.unlinkSync` in `shutdown` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/app/daemon.mjs:247
  • `fs.existsSync` in `ensureApp` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — crates/tui/plugins/computer-use/src/app-socket.mjs:220, crates/tui/plugins/computer-use/src/app-socket.mjs:226
  • `fs.statSync` in `fitRasterToBudget` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/darwin.mjs:81
  • `fs.existsSync` in `nativeHelper` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×6) — crates/tui/plugins/computer-use/src/backends/darwin.mjs:238, crates/tui/plugins/computer-use/src/backends/darwin.mjs:240, crates/tui/plugins/computer-use/src/backends/darwin.mjs:245, …
  • `fs.readFileSync` in `nativeHelper` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/darwin.mjs:251
  • `fs.mkdirSync` in `nativeHelper` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/darwin.mjs:253
  • `fs.renameSync` in `nativeHelper` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/darwin.mjs:259
  • `fs.mkdirSync` in `updatePreview` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/darwin.mjs:333
  • `fs.renameSync` in `updatePreview` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/darwin.mjs:337
  • `fs.mkdirSync` in `screenshot` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/darwin.mjs:471
  • `fs.statSync` in `screenshot` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/darwin.mjs:508
  • `fs.mkdirSync` in `zoom` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/darwin.mjs:539
  • `fs.statSync` in `zoom` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/darwin.mjs:543
  • `fs.mkdirSync` in `recordingStart` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/darwin.mjs:576
  • `fs.existsSync` in `recordingStop` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/darwin.mjs:653
  • `fs.statSync` in `recordingStop` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/darwin.mjs:653
  • `fs.existsSync` in `recordingStatus` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/darwin.mjs:684
  • `fs.statSync` in `recordingStatus` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/darwin.mjs:684
  • `fs.existsSync` in `recordingList` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/darwin.mjs:690
  • `fs.readdirSync` in `recordingList` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/darwin.mjs:690
  • `fs.statSync` in `recordingList` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/darwin.mjs:692
  • `fs.rmSync` in `probe` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/darwin.mjs:882
  • `fs.mkdirSync` in `get_app_state` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/darwin.mjs:929
  • `fs.mkdtempSync` in `list_displays` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/harmonyos.mjs:169
  • `fs.readFileSync` in `list_displays` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/harmonyos.mjs:173
  • `fs.rmSync` in `list_displays` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — crates/tui/plugins/computer-use/src/backends/harmonyos.mjs:174

What to do

  • TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants.
R1 · Type Safety7.2 / 10Strong✓ 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.0 / 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.

  • 61 duplicated blocks under the repository root have copies in at least two of the sibling directories crates, extensions, integrations, npm, pet, scripts (+2 more sibling(s) not listed) — 58 of them are reported below, and 3 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 61 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 61 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 61 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. — crates/tui/src/tui/pet_watch/pet-native.js:830
  • 21 duplicated blocks under web/app/[locale]/ have copies in at least two of the sibling directories changelog, community, computer-use, constitution, contribute, digest (+12 more sibling(s) not listed) — 15 of them are reported below, and 6 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 21 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 21 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 21 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. — web/app/[locale]/community/page.tsx:99
  • 11 duplicated blocks under integrations/ have copies in at least two of the sibling directories feishu-bridge, telegram-bridge, wecom-bridge, weixin-bridge — 10 of them are reported below, and 1 is 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 11 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 11 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 11 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. — integrations/feishu-bridge/src/index.mjs:82
  • 7 of the duplicated blocks reported below have copies in at least two of the sibling directories app, components, lib, scripts under web/. That concentration is one structural fact, not 7 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 7 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. — REDACTED:91
  • integrations/feishu-bridge/src/index.mjs:82 · integrations/wecom-bridge/src/index.mjs:88 — the two spans are one implementation copied and then locally edited — 2127 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. — integrations/feishu-bridge/src/index.mjs:82
  • crates/tui/src/tui/pet_watch/pet-native.js:830 · pet/ios/Resources/pet-native.js:830 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — crates/tui/src/tui/pet_watch/pet-native.js:830
  • crates/tui/src/tui/pet_watch/pet-native.js:1956 · pet/ios/Resources/pet-native.js:1956 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — crates/tui/src/tui/pet_watch/pet-native.js:1956
  • crates/tui/src/tui/pet_watch/pet-native.js:1691 · pet/ios/Resources/pet-native.js:1691 — 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. — crates/tui/src/tui/pet_watch/pet-native.js:1691
  • REDACTED:125 · REDACTED:479 — the two spans are one implementation copied and then locally edited — 991 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. — REDACTED:125
  • integrations/feishu-bridge/src/lib.mjs:91 · REDACTED:434 — the two spans are one implementation copied and then locally edited — 757 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. — integrations/feishu-bridge/src/lib.mjs:91
  • crates/tui/src/tui/pet_watch/pet-native.js:182 · pet/ios/Resources/pet-native.js:182 — 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. — crates/tui/src/tui/pet_watch/pet-native.js:182
  • crates/tui/src/tui/pet_watch/pet-native.js:470 · pet/ios/Resources/pet-native.js:470 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — crates/tui/src/tui/pet_watch/pet-native.js:470
  • integrations/feishu-bridge/scripts/validate-config.mjs:2 · integrations/telegram-bridge/scripts/validate-config.mjs:2 — these 2 files are line-for-line copies of one another — 86 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — integrations/feishu-bridge/scripts/validate-config.mjs:2
  • crates/tui/src/tui/pet_watch/pet-native.js:2008 · pet/ios/Resources/pet-native.js:2008 · pet/src/core/pet-engine.ts:327 — the 3 copies are spread across 3 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. There is one copy in each of 3 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete. — crates/tui/src/tui/pet_watch/pet-native.js:2008
  • crates/tui/src/tui/pet_watch/pet-native.js:1162 · pet/ios/Resources/pet-native.js:1162 — 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. — crates/tui/src/tui/pet_watch/pet-native.js:1162
  • crates/tui/src/tui/pet_watch/pet-native.js:653 · pet/ios/Resources/pet-native.js:653 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — crates/tui/src/tui/pet_watch/pet-native.js:653
  • crates/tui/src/tui/pet_watch/pet-native.js:1324 · pet/ios/Resources/pet-native.js:1324 — 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. — crates/tui/src/tui/pet_watch/pet-native.js:1324
  • crates/tui/src/tui/pet_watch/pet-native.js:105 · pet/ios/Resources/pet-native.js:105 — 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. — crates/tui/src/tui/pet_watch/pet-native.js:105
  • crates/tui/src/tui/pet_watch/pet-native.js:1429 · pet/ios/Resources/pet-native.js:1429 — 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. — crates/tui/src/tui/pet_watch/pet-native.js:1429
  • crates/tui/src/tui/pet_watch/pet-native.js:1504 · pet/ios/Resources/pet-native.js:1504 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — crates/tui/src/tui/pet_watch/pet-native.js:1504
  • crates/tui/src/tui/pet_watch/pet-native.js:1256 · pet/ios/Resources/pet-native.js:1256 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — crates/tui/src/tui/pet_watch/pet-native.js:1256
  • crates/tui/src/tui/pet_watch/pet-native.js:1587 · pet/ios/Resources/pet-native.js:1587 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — crates/tui/src/tui/pet_watch/pet-native.js:1587
  • web/app/[locale]/community/page.tsx:99 · web/app/[locale]/contribute/page.tsx:148 — the two spans are one implementation copied and then locally edited — 266 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. — web/app/[locale]/community/page.tsx:99
  • crates/tui/src/tui/pet_watch/pet-native.js:2315 · pet/ios/Resources/pet-native.js:2315 — the 2 copies are spread across 2 files, 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. — crates/tui/src/tui/pet_watch/pet-native.js:2315
  • crates/tui/src/tui/pet_watch/pet-native.js:5114 · pet/ios/Resources/pet-native.js:5114 — 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. — crates/tui/src/tui/pet_watch/pet-native.js:5114
  • crates/tui/src/tui/pet_watch/pet-native.js:2241 · pet/ios/Resources/pet-native.js:2241 — 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. — crates/tui/src/tui/pet_watch/pet-native.js:2241
  • web/app/[locale]/legal/privacy/page.tsx:11 · web/app/[locale]/legal/terms/page.tsx:8 — the two spans are one implementation copied and then locally edited — 277 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. — web/app/[locale]/legal/privacy/page.tsx:11
  • web/lib/community-agent-tasks.ts:119 · web/lib/community-agent-tasks.ts:204 · web/lib/community-agent-tasks.ts:272 — all 3 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. — web/lib/community-agent-tasks.ts:119
  • crates/tui/src/tui/pet_watch/pet-native.js:36 · pet/ios/Resources/pet-native.js:36 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — crates/tui/src/tui/pet_watch/pet-native.js:36
  • crates/tui/src/tui/pet_watch/pet-native.js:71 · pet/ios/Resources/pet-native.js:71 — 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. — crates/tui/src/tui/pet_watch/pet-native.js:71
  • crates/tui/src/tui/pet_watch/pet-native.js:1395 · pet/ios/Resources/pet-native.js:1395 — 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. — crates/tui/src/tui/pet_watch/pet-native.js:1395
  • integrations/feishu-bridge/src/lib.mjs:60 · integrations/wecom-bridge/src/lib.mjs:60 — the two spans are one implementation copied and then locally edited — 203 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. — integrations/feishu-bridge/src/lib.mjs:60
  • crates/tui/src/tui/pet_watch/pet-native.js:2195 · pet/ios/Resources/pet-native.js:2195 · pet/src/core/dot-field.ts:88 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — crates/tui/src/tui/pet_watch/pet-native.js:2195
  • crates/tui/src/tui/pet_watch/pet-native.js:2 · pet/ios/Resources/pet-native.js:2 — 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. — crates/tui/src/tui/pet_watch/pet-native.js:2
  • crates/tui/src/tui/pet_watch/pet-native.js:1062 · pet/ios/Resources/pet-native.js:1062 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — crates/tui/src/tui/pet_watch/pet-native.js:1062
  • crates/tui/src/tui/pet_watch/pet-native.js:1652 · pet/ios/Resources/pet-native.js:1652 — 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. — crates/tui/src/tui/pet_watch/pet-native.js:1652
  • crates/tui/src/tui/pet_watch/pet-native.js:2124 · pet/ios/Resources/pet-native.js:2124 — 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. — crates/tui/src/tui/pet_watch/pet-native.js:2124
  • crates/tui/src/tui/pet_watch/pet-native.js:1395 · pet/ios/Resources/pet-native.js:1395 · pet/src/core/signal.ts:31 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — crates/tui/src/tui/pet_watch/pet-native.js:1395
  • crates/tui/src/tui/pet_watch/pet-native.js:601 · pet/ios/Resources/pet-native.js:601 — 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. — crates/tui/src/tui/pet_watch/pet-native.js:601
  • crates/tui/src/tui/pet_watch/pet-native.js:797 · pet/ios/Resources/pet-native.js:797 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — crates/tui/src/tui/pet_watch/pet-native.js:797

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 Boundaries6.5 / 10Adequate✓ 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.

  • integrations/bridge-core/test/approvals.test.mjs:13 reaches past another workspace package's public entry into its internals with a relative path (../../wecom-bridge/src/lib.mjs) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — integrations/bridge-core/test/approvals.test.mjs:13
  • integrations/bridge-core/test/approvals.test.mjs:285 reaches past another workspace package's public entry into its internals with a relative path (../../telegram-bridge/src/lib.mjs) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — integrations/bridge-core/test/approvals.test.mjs:285
  • integrations/bridge-core/test/approvals.test.mjs:402 reaches past another workspace package's public entry into its internals with a relative path (../../wecom-bridge/src/lib.mjs) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — integrations/bridge-core/test/approvals.test.mjs:402
  • integrations/feishu-bridge/src/index.mjs:21 reaches into another package with a relative path (../../bridge-core/src/lib.mjs) — import the package by name instead. — integrations/feishu-bridge/src/index.mjs:21
  • integrations/feishu-bridge/src/lib.mjs:1 reaches into another package with a relative path (../../bridge-core/src/lib.mjs) — import the package by name instead. — integrations/feishu-bridge/src/lib.mjs:1
  • integrations/telegram-bridge/src/index.mjs:30 reaches into another package with a relative path (../../bridge-core/src/lib.mjs) — import the package by name instead. — integrations/telegram-bridge/src/index.mjs:30
  • REDACTED:1 reaches into another package with a relative path (../../bridge-core/src/lib.mjs) — import the package by name instead. — REDACTED:1
  • integrations/wecom-bridge/src/index.mjs:24 reaches into another package with a relative path (../../bridge-core/src/lib.mjs) — import the package by name instead. — integrations/wecom-bridge/src/index.mjs:24
  • integrations/wecom-bridge/src/lib.mjs:1 reaches into another package with a relative path (../../bridge-core/src/lib.mjs) — import the package by name instead. — integrations/wecom-bridge/src/lib.mjs:1
  • integrations/weixin-bridge/src/index.mjs:37 reaches into another package with a relative path (../../bridge-core/src/lib.mjs) — import the package by name instead. — integrations/weixin-bridge/src/index.mjs:37
  • integrations/weixin-bridge/src/lib.mjs:3 reaches into another package with a relative path (../../bridge-core/src/lib.mjs) — import the package by name instead. — integrations/weixin-bridge/src/lib.mjs:3
  • pet/scripts/lib/pet-runtime.mjs:24 reaches into another package with a relative path (../../../npm/runtime-sdk/index.js) — import the package by name instead. — pet/scripts/lib/pet-runtime.mjs:24
  • scripts/release/assemble-release-assets.js:13 reaches into another package with a relative path (../../npm/codewhale/scripts/artifacts) — import the package by name instead. — scripts/release/assemble-release-assets.js:13
  • scripts/release/assemble-release-assets.js:15 reaches into another package with a relative path (../../npm/codewhale/scripts/compiled-hosts) — import the package by name instead. — scripts/release/assemble-release-assets.js:15
  • scripts/release/fetch-compiled-host-proof.js:7 reaches into another package with a relative path (../../npm/codewhale/scripts/compiled-hosts) — import the package by name instead. — scripts/release/fetch-compiled-host-proof.js:7
  • scripts/release/prepare-local-release-assets.js:13 reaches into another package with a relative path (../../npm/codewhale/scripts/artifacts) — import the package by name instead. — scripts/release/prepare-local-release-assets.js:13
  • scripts/release/stage-compiled-host.mjs:10 reaches into another package with a relative path (../../npm/codewhale/scripts/compiled-hosts.js) — import the package by name instead. — scripts/release/stage-compiled-host.mjs:10
  • scripts/release/verify-release-inventory.js:27 reaches into another package with a relative path (../../npm/codewhale/scripts/artifacts) — import the package by name instead. — scripts/release/verify-release-inventory.js:27
  • scripts/release/verify-release-inventory.js:28 reaches into another package with a relative path (../../npm/codewhale/scripts/compiled-hosts) — import the package by name instead. — scripts/release/verify-release-inventory.js:28
  • web/scripts/derive-install.mjs:5 reaches into another package with a relative path (../../docs/INSTALL.md) — import the package by name instead. — web/scripts/derive-install.mjs:5
  • web/scripts/derive-install.mjs:6 reaches into another package with a relative path (../../docs/zh_hans/INSTALL.md) — import the package by name instead. — web/scripts/derive-install.mjs:6

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 Complexity5.0 / 10Adequate✓ Tool-verified

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

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

  • callTool has cyclomatic complexity 258 and cognitive complexity 376; 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. — crates/tui/plugins/computer-use/mcp/server.mjs:1011
  • analyzeEvidence has cyclomatic complexity 107 and cognitive complexity 206; 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. — pet/src/core/evidence.ts:153
  • POST has cyclomatic complexity 97 and cognitive complexity 186; 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. — web/app/api/admin/post/route.ts:87
  • append has cyclomatic complexity 78 and cognitive complexity 151; 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. — pet/src/core/codewhale.ts:365
  • resolveTool has cyclomatic complexity 76 and cognitive complexity 96; 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. — crates/tui/plugins/computer-use/src/tools.mjs:783
  • observe has cyclomatic complexity 72 and cognitive complexity 81; 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. (×3) — crates/tui/src/tui/pet_watch/pet-native.js:1909, pet/ios/Resources/pet-native.js:1909, pet/src/core/pet-engine.ts:239
  • applyRuntimeEvent has cyclomatic complexity 65 and cognitive complexity 66; 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. — crates/tui/src/runtime_web/app.mjs:94
  • buildCorpus has cyclomatic complexity 61 and cognitive complexity 146; 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. — scripts/review-eval.mjs:255
  • compilePetTelemetry has cyclomatic complexity 61 and cognitive complexity 87; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. (×3) — crates/tui/src/tui/pet_watch/pet-native.js:1219, pet/ios/Resources/pet-native.js:1219, pet/src/core/pet-telemetry.ts:70
  • makeFrame has cyclomatic complexity 60 and cognitive complexity 71; 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. (×3) — crates/tui/src/tui/pet_watch/pet-native.js:540, pet/ios/Resources/pet-native.js:540, pet/src/core/pet-world.ts:338
  • restore has cyclomatic complexity 60 and cognitive complexity 48; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. (×3) — crates/tui/src/tui/pet_watch/pet-native.js:391, pet/ios/Resources/pet-native.js:391, pet/src/core/pet-world.ts:211
  • fromCodewhaleSession has cyclomatic complexity 55 and cognitive complexity 102; 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. — pet/src/core/codewhale.ts:130

What to do

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

  • crates/tui/src/tui/pet_watch/pet-native.js has 7107 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — crates/tui/src/tui/pet_watch/pet-native.js:1
  • pet/ios/Resources/pet-native.js has 7107 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — pet/ios/Resources/pet-native.js:1
  • crates/tui/src/runtime_web/app.mjs has 2283 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — crates/tui/src/runtime_web/app.mjs:1
  • crates/tui/plugins/computer-use/mcp/server.mjs has 1852 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — crates/tui/plugins/computer-use/mcp/server.mjs:1
  • integrations/weixin-bridge/src/index.mjs has 1412 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — integrations/weixin-bridge/src/index.mjs:1
  • extensions/vscode/src/chat.ts has 1359 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — extensions/vscode/src/chat.ts:1
  • crates/tui/plugins/computer-use/src/backends/linux.mjs has 1267 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — crates/tui/plugins/computer-use/src/backends/linux.mjs:1
  • crates/tui/plugins/computer-use/src/backends/darwin.mjs 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. — crates/tui/plugins/computer-use/src/backends/darwin.mjs:1
  • integrations/telegram-bridge/src/index.mjs has 960 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — integrations/telegram-bridge/src/index.mjs:1
  • crates/tui/plugins/computer-use/src/tools.mjs has 885 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — crates/tui/plugins/computer-use/src/tools.mjs:1
  • web/lib/community-agent.ts has 808 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/lib/community-agent.ts:1
  • REDACTED has 743 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
  • integrations/bridge-core/src/lib.mjs has 632 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — integrations/bridge-core/src/lib.mjs:1
  • crates/tui/plugins/computer-use/src/browser-cdp.mjs has 629 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — crates/tui/plugins/computer-use/src/browser-cdp.mjs:1
  • extensions/vscode/src/api.ts has 627 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — extensions/vscode/src/api.ts:1
  • crates/tui/plugins/computer-use/src/backends/win32.mjs has 608 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — crates/tui/plugins/computer-use/src/backends/win32.mjs:1
  • web/lib/i18n/dictionaries/index.ts has 567 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/lib/i18n/dictionaries/index.ts:1
  • REDACTED has 558 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
  • integrations/feishu-bridge/src/index.mjs has 553 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — integrations/feishu-bridge/src/index.mjs:1
  • pet/src/core/codewhale.ts has 549 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — pet/src/core/codewhale.ts:1
  • REDACTED has 526 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
  • integrations/wecom-bridge/src/index.mjs has 504 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — integrations/wecom-bridge/src/index.mjs:1
  • web/lib/community-agent-tasks.ts has 467 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/lib/community-agent-tasks.ts:1
  • crates/tui/src/integrations/dsh/scene.js has 458 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — crates/tui/src/integrations/dsh/scene.js:1
  • integrations/weixin-bridge/src/lib.mjs has 453 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — integrations/weixin-bridge/src/lib.mjs:1
  • integrations/weixin-bridge/src/qr.mjs has 453 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — integrations/weixin-bridge/src/qr.mjs:1
  • web/app/api/admin/post/route.ts has 425 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/app/api/admin/post/route.ts:1
  • web/lib/telemetry/product-usage.ts has 423 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/lib/telemetry/product-usage.ts:1
  • pet/src/core/pet-sim.ts has 411 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — pet/src/core/pet-sim.ts:1

What to do

  • Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
R4 · Test Coverage7.0 / 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) — crates/tui/src/tui/pet_watch/pet-native.js:1, pet/ios/Resources/pet-native.js:1, scripts/review-eval.mjs:1, …

What to do

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

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

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

What to do

  • Bump outdated dependencies to current versions to limit upgrade debt.
R6 · 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.

  • 454 file(s) (~46161 LoC) were excluded from dead-code analysis. This package's entry point(s) resolved, but the walk stopped one hop in: web/lib/public-surface-contract.test.ts imports './install-guide.generated', which is not in the scanned tree. That is usually a generated or build-output module, so reachability cannot see past it and no dead-code claim is made about this package. Nothing is necessarily wrong here. — web
  • Unreachable from the 267 application, 57 tooling and 233 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 (267 application, 57 tooling, 233 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 — pet/ios/Resources/pet-native.js
  • Nothing imports this binding — it is safe to review for removal. (×15) — pet/src/core/model.ts:66, pet/src/core/model.ts:67, pet/src/core/model.ts:81, …
  • Nothing in its class reads or assigns this private field (for a constructor parameter property: it is stored and never read), and no string key or test reaches it by name. Remove it, or use it where it was meant to take effect. — extensions/vscode/src/chat.ts:107
  • This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it. (×4) — integrations/weixin-bridge/src/index.mjs:68, REDACTED:1456, scripts/review-eval.mjs:66, …

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.0 / 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. (×2) — web/eslint.config.mjs:1, web/scripts/dependency-security.test.mjs:11
  • Declared in crates/tui/plugins/computer-use/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.
  • Declared in web/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 Imports8.3 / 10Strong✓ 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.

  • pet/src/core/evidence.ts → pet/src/core/model.ts → pet/src/core/evidence.ts — pet/src/core/evidence.ts:2

What to do

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

Other · Security — Read from this repository's Rust source: cryptographic hygiene (weak hash or cipher, key material fixed in the source) and outbound TLS (certificate validation, protocol version) — facts about code that hold whether or not it serves anything itself. This repository serves HTTP itself (`axum::serve(` (crates/tui/src/runtime_api.rs:508)), so its Rust source was also read for the server controls: TLS served or HSTS set, security response headers, cookie flags and inbound validation — each credited where its Rust spelling appears in production source, not proven on every route. A Rocket 0.5 application is credited the headers Rocket's default `Shield` sends unless it attaches its own, and its cookie jar's SameSite=Strict default; a session middleware its default cookie flags.

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.

  • This repository starts an HTTP server and nothing in its Rust source or committed `Rocket.toml` secures the transport: no TLS served (actix-web `bind_rustls`/`bind_openssl`, axum-server `bind_rustls` with a `RustlsConfig`, tonic `ServerTlsConfig`, a `TlsAcceptor`, Rocket's `[default.tls]`), no `Strict-Transport-Security` header, no `X-Forwarded-Proto` read from a TLS-terminating proxy — so its traffic may cross the network in clear text. (−2.0 on this card.) The server: `axum::serve(` (crates/tui/src/runtime_api.rs:508).
  • Set: Content-Security-Policy, Permissions-Policy, Referrer-Policy, X-Content-Type-Options. Missing: Strict-Transport-Security, X-Frame-Options — the four headers that carry the points of this card's security-headers term (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options), 0.5 each.(−1.0 on this card.) The server: `axum::serve(` (crates/tui/src/runtime_api.rs:508).

What to do

  • Secure the server's transport: serve TLS itself (`HttpServer::bind_rustls_0_23(addr, config)` in actix-web, `axum_server::bind_rustls(addr, RustlsConfig::from_pem_file(…))`, tonic's `Server::builder().tls_config(ServerTlsConfig::new().identity(…))`, Rocket's `[default.tls]`), or run it behind a TLS-terminating proxy and check `X-Forwarded-Proto`; send `Strict-Transport-Security` once it is HTTPS-only.
  • Add Strict-Transport-Security, X-Frame-Options beside the headers the Rust server already sets.
X1 · Async correctness10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

X17 · Uncapped recursion over a caller-supplied document1.8 / 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.

  • `strip_sensitive_fields` is public and takes `node: Any` from its caller, and it calls itself at line 164 (`strip_sensitive_fields`) with a piece of `node` (and at line 167) — and nowhere in `strip_sensitive_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 `strip_sensitive_fields` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — scripts/catalog_models_dev.py:164
  • `public_value` is public and takes `value: Any` from its caller, and it calls itself at line 565 (`public_value`) with a piece of `value` — and nowhere in `public_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 `public_value` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — scripts/catalog_models_dev.py:565
  • `flatten` is public and takes `value: Any` from its caller, and it calls itself at line 577 (`flatten`) with a piece of `value` — and nowhere in `flatten` 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 `flatten` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — scripts/catalog_models_dev.py:577
  • `canonicalJSON` is exported and takes `v: unknown` from its caller, and it calls itself at line 143 (`canonicalJSON`) with a piece of `v` (and at line 144) — and nowhere in `canonicalJSON` 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 `canonicalJSON` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — pet/src/core/evidence.ts:143
  • `decodeAnyValue` is exported and takes `v: unknown` from its caller, and it calls itself at line 106 (`decodeAnyValue`) with a piece of `v` — and nowhere in `decodeAnyValue` 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 `decodeAnyValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — pet/src/core/ingest.ts:106

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 propagation9.4 / 10Exemplary✓ 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 30/33 async functions that make a cancellable request (fetch, axios, ky, ofetch) 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.
  • `fetchReceipt` 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 })`. — web/scripts/compare-deployed-facts.mjs:55
  • `githubApi` 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 })`. — scripts/ci/cnb-github-checkrun.mjs:71
  • `runtimeJson` 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 })`. — integrations/bridge-core/src/lib.mjs:644

What to do

  • Thread an AbortSignal through async functions that make requests, so the work stops when its caller gives up.
X20 · Mistyped argument guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether an argument guard throws the exception its own condition describes — a guard that rejects a value for being EMPTY and reports it as `NullPointerException` (Java, Kotlin, Scala), `ArgumentError.notNull` (Dart) or `ArgumentNullException` (F#'s `nullArg`) tells the caller a parameter was null when it provably was not.

Method: Roslyn syntax: `throw new ArgumentNullException(nameof(p))` statements controlled by an `if`, whose condition is read for a test that is true of a NON-null `p` — an emptiness test that dereferences it (`p.Count == 0`, `!p.Any()`) or a BCL predicate documented true of the empty value (`string.IsNullOrEmpty(p)`). Deterministic, provable per finding. Advisory.

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

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

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

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

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

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

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

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

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

X24 · Document value interpolated into markup unescaped5.4 / 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.

  • `serializeJsonLd(jsonLd)` 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. (×3) — REDACTED:746, web/app/[locale]/page.tsx:72, REDACTED:19
  • `chunk.text` 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. — web/app/[locale]/install/page.tsx:53
  • `serializeJsonLd(siteJsonLd)` 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:104
  • `preview` 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. — web/components/ratatui/hero.tsx:32
  • `narrow` 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. — web/components/ratatui/hero.tsx:40

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. Whether a `for (x in c)` or `c.forEach { … }` leaves the collection it is walking alone — a `mutableListOf`/`ArrayList`, `mutableMapOf`/`HashMap` or `mutableSetOf`/`HashSet` is a `java.util` collection on the JVM and is walked by its own fail-fast iterator, so a body that adds to or removes from the very collection the loop is walking makes the next step throw `ConcurrentModificationException` and the remaining elements are never seen.

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

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

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

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

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

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

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

X3 · Exception handling5.0 / 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. (×29) — web/scripts/facts-publish.mjs:542, REDACTED:304, web/lib/bounded-body.ts:11, …
  • `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it. (×6) — web/components/whale-live.tsx:153, telemetry-ingest/src/posthog.ts:59, pet/src/ui/pet.ts:105, …
  • `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×3) — scripts/review-eval.mjs:478, pet/swift/PetHost.swift:93, pet/swift/PetHost.swift:186
  • `except Exception` 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. — scripts/split/count_lines.py:122
  • `catch (e: Exception)` 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. — pet/android/src/main/kotlin/codewhale/pet/PetViewModel.kt:195

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 logging4.2 / 10Weak✓ 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.

  • `warn!` at line 1854 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/automation_manager.rs:1854
  • `warn!` at line 1883 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/automation_manager.rs:1883
  • `warn!` at line 1905 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/automation_manager.rs:1905
  • `warn!` at line 2084 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/automation_manager.rs:2084
  • `warn!` at line 2210 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/automation_manager.rs:2210
  • `warn!` at line 2571 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/automation_manager.rs:2571
  • `warn!` at line 2584 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/automation_manager.rs:2584
  • `warn!` at line 2613 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/automation_manager.rs:2613
  • `warn!` at line 2630 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/automation_manager.rs:2630
  • `warn!` at line 2778 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/automation_manager.rs:2778
  • `warn!` at line 2791 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/automation_manager.rs:2791
  • `warn!` at line 2804 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/automation_manager.rs:2804
  • `warn!` at line 2969 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/automation_manager.rs:2969
  • `warn!` at line 2984 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/automation_manager.rs:2984
  • `warn!` at line 3040 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/automation_manager.rs:3040
  • `warn!` at line 3206 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/automation_manager.rs:3206
  • `warn!` at line 3209 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/automation_manager.rs:3209
  • `warn!` at line 3212 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/automation_manager.rs:3212
  • `warn!` at line 93 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/composer_history.rs:93
  • `warn!` at line 265 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/composer_history.rs:265
  • `warn!` at line 277 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/composer_history.rs:277
  • `warn!` at line 305 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/composer_history.rs:305
  • `debug!` at line 332 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/composer_history.rs:332
  • `warn!` at line 296 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/composer_stash.rs:296
  • `warn!` at line 367 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/composer_stash.rs:367
  • `warn!` at line 372 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/composer_stash.rs:372
  • `warn!` at line 796 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/config.rs:796
  • `warn!` at line 3813 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/config.rs:3813
  • `warn!` at line 3877 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/config.rs:3877
  • `warn!` at line 6774 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/config.rs:6774
  • `warn!` at line 6922 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/config.rs:6922
  • `warn!` at line 7571 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/config.rs:7571
  • `warn!` at line 12304 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/config.rs:12304
  • `error!` at line 1987 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/lib.rs:1987
  • `debug!` at line 13729 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/lib.rs:13729
  • `debug!` at line 14617 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/lib.rs:14617
  • `warn!` at line 3865 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/mcp.rs:3865
  • `warn!` at line 5266 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/mcp.rs:5266
  • `warn!` at line 5294 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/mcp.rs:5294
  • `warn!` at line 247 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/tui/src/model_relevance.rs:247

What to do

  • Interpolated log message defeats structured logging
X5 · Nullable reference types9.6 / 10Exemplary✓ Tool-verified

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

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

  • ~1.1 `!` null assertions per 1k TypeScript source lines — 49 assertion(s) across the 45754 source line(s) of the 402 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: pet/src/core/codewhale.ts (5), web/lib/community-agent-tasks.ts (5), pet/src/core/evidence.ts (3). 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 Health58%Adequate — gated by D1, D2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture83%StrongSolid.
Maturity85%ExemplarySolid.
Readiness59%Adequate — gated by D13, P7Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security80%Adequate — gated by D29Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Domain Modelling88%ExemplarySolid.
Event Sourcing100%ExemplaryStrongest area.
Accessibility49%Adequate — gated by AC4Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance74%StrongSolid.
Unscored — 5 check(s) recorded observations but carry no score

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

  • P12 CI test-gate honesty — 2 observation(s) recorded · Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
  • X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X6 Hand-rolled structured-format parsing — 10 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X9 Subsumed condition operand — 10 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 1 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.

  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 40 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
  • AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No class in this Java code is a Spring, JSR-330 or CDI singleton bean. No class in this Kotlin code is a Spring, JSR-330 or CDI singleton bean. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. No Swift request handler (a Vapor, Hummingbird, Kitura, Swifter or Perfect route handler, as a method or a registered closure) is declared, so no state is shared between request threads. Rust's compiler refuses unsynchronised shared mutation — a value shared across threads must be Sync — so the race this check looks for cannot be written. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
  • AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • 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 (rendered) — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • C1 Data Protection — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no data at rest for these controls to protect.
  • C3 Audit Trail — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a store configured outside this repository, for instance), the trail belongs to wherever that data is stored.
  • C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data whose lifetime a retention limit would bound.
  • C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data for a data subject to erase, export or consent over.
  • D11 Test Reliability — Test reliability not included
  • D12 Dependency Hygiene — Not scored — 1 Maven/Gradle manifest(s) were read, stating a version for 4 dependency(ies) and leaving 0 to a parent or an imported BOM, but no build resolved the dependency graph, so the outdated signal was not established. NOT a finding that these dependencies are current or healthy.
  • D16 Bus Factor — single-maintainer repository — bus factor is not applicable
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D21 Naming Consistency — Naming consistency is measured on C# only; Java, JavaScript, Kotlin, Python, Rust, Swift, TypeScript, html not measured.
  • D22 Internal API Consistency — API consistency is measured on C# only; the exposed JavaScript, Python, Rust, TypeScript surface was not measured.
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ projects each declaring an entity of their own. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value — D24 reads C# and Visual Basic comments only — this repository's production source is .kt, .mts, .py, .rs, .swift, .ts, .tsx, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D25 ADR Conformance — None of 3 binding record(s) states a rule in checkable form (a backticked element with a prohibition, or an `adr-rules` block), so conformance cannot be read from the code. Write the rule as an `adr-rules` block (`forbid:` a symbol, a package or a dependency) to make it checkable.
  • D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.rs), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D28 Secrets (history) — gitleaks killed before it finished — this repository's git history not scanned
  • D32 Data Compliance (PII/GDPR) — 15 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 — polyglot repository, one half has no runner
  • DM1 Aggregate boundaries — this Rust crate declares no domain aggregate (a struct with private state and its own command methods), so DM1's aggregate-boundary read has no population to be taken over
  • DM2 Strongly-typed ids — the crate defines newtype typed-ids but declares no domain aggregate that could carry an id — so DM2's adoption ratio has no population to be taken over
  • DM3 Integration-event coupling — not applicable: no DDD domain layer was detected (no aggregate, entity or value-object structure), so there is no domain model for this card to grade
  • DM6 Domain ↔ infrastructure boundary — this Rust crate maps no type to a persistence framework (diesel/sea-orm/sqlx), so DM6's domain↔infrastructure fusion read has no population to be taken over
  • DM7 Repository granularity — not applicable: no DDD domain layer was detected (no aggregate, entity or value-object structure), so there is no domain model for this card to grade
  • ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and this analysis resolves a call's owner only where the receiver's type is written down in the source. Reported as guidance rather than measured
  • 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
  • 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
  • P9 Domain vs controller coverage — coverage data present for 80 file(s), but no domain-layer files were identified: no covered file's path contains any of the markers this check keys on (/domain/, /aggregates/, /valueobjects/, /domainmodel/, .domain/, /entities/), which are matched case-insensitively anywhere in the path. With no domain partition there is nothing to compare the web/controller layer against — if this repository keeps its business rules under a folder named none of those, that naming is what the check cannot see, not the domain logic.
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • 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.

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 — 134 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
  • + 72 more in this group — see findings.md.
D13 · Secret Scanning · Leaked secret · ×12
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
AC2 · Forms & labels · <input> without a programmatic label · ×2
  • <input> without a programmatic label crates/tui/src/runtime_mobile.html:251 — 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 crates/tui/src/runtime_web/orca-evidence.html:125 — This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC2 · Forms & labels · <textarea> without a programmatic label · ×2
  • <textarea> without a programmatic label crates/tui/src/runtime_mobile.html:287 — 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.
  • <textarea> without a programmatic label web/app/[locale]/admin/admin-client.tsx:93 — This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC4 · Keyboard semantics · Clickable element isn't keyboard-operable · ×2
  • Clickable element isn't keyboard-operable crates/tui/src/runtime_web/orca-evidence.html:102 — The repo's own CSS styles .choice with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
  • Clickable element isn't keyboard-operable crates/tui/src/runtime_web/orca-evidence.html:106 — The repo's own CSS styles .choice with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
AC5 · ARIA correctness · aria-pressed on a <div> with no role to carry it · ×2
  • aria-pressed on a <div> with no role to carry it crates/tui/src/runtime_web/orca-evidence.html:102 — A plain <div> has the implicit role "generic", which supports no ARIA states, so this aria-pressed is dropped and assistive tech is never told the state at all. Put aria-pressed on the element that owns the behaviour (the button or control the user operates), or give this <div> a role that supports aria-pressed.
  • aria-pressed on a <div> with no role to carry it crates/tui/src/runtime_web/orca-evidence.html:106 — A plain <div> has the implicit role "generic", which supports no ARIA states, so this aria-pressed is dropped and assistive tech is never told the state at all. Put aria-pressed on the element that owns the behaviour (the button or control the user operates), or give this <div> a role that supports aria-pressed.
AX9 · CQS / query purity · Query writes persistent state on the read path · ×1
  • Query writes persistent state on the read path: RuntimeEventJournal.load crates/tui/src/remote_control.rs:449 — `RuntimeEventJournal.load` is a read-named query yet it performs a durable write on the read path (a persist to a store/repository). A query must stay side-effect-free so reads are safe to retry, cache, and route to a read replica; move the write into a command.
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 · High CVE · ×1
  • REDACTED
DM4 · Rich vs anemic domain model · Anemic domain model · ×1
  • Anemic domain model: FleetWorkerReportedRoute crates/tui/src/fleet/executor.rs:689 — `FleetWorkerReportedRoute` is a data-only domain entity with `pub` mutable state and no invariant-enforcing behaviour of its own, while the repo holds the logic in a foreign service/manager/use-case — the anemic domain model. Move the behaviour onto the entity so it enforces its own invariants (or make it an immutable value object with private fields) rather than being driven from outside.
R8 · Dependency Hygiene · Unlisted import '@eslint/eslintrc' · ×1
  • Unlisted import '@eslint/eslintrc' web/eslint.config.mjs:1 — Imported but not declared in any reachable package.json — installs work only by hoisting accident.
R8 · Dependency Hygiene · Unlisted import 'braces' · ×1
  • Unlisted import 'braces' web/scripts/dependency-security.test.mjs:11 — Imported but not declared in any reachable package.json — installs work only by hoisting accident.
R9 · Circular Imports · Import cycle (2 files) · ×1
  • Import cycle (2 files) pet/src/core/evidence.ts:2 — pet/src/core/evidence.ts → pet/src/core/model.ts → pet/src/core/evidence.ts
Serious — 4606 finding(s)
D2 · Cognitive Complexity · codewhale_tui · ×545
  • codewhale_tui::tui::ui::event_loop::run_event_loop (cognitive 1590) crates/tui/src/tui/ui/event_loop.rs:1854 — codewhale_tui::tui::ui::event_loop::run_event_loop has cognitive complexity 1590 (threshold 15). Drivers by points: if/else 363 (1208 pts), match/switch 41 (177 pts), boolean chains 167, loops 11 (38 pts) (nesting depth added 1008). 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.
  • codewhale_tui::tui::ui::handlers::handle_view_events (cognitive 352) crates/tui/src/tui/ui/handlers.rs:1818 — codewhale_tui::tui::ui::handlers::handle_view_events has cognitive complexity 352 (threshold 15). Drivers by points: if/else 83 (247 pts), match/switch 25 (82 pts), boolean chains 19, loops 2 (4 pts) (nesting depth added 223). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_tui::tui::ui::apply::apply_command_result_inner (cognitive 305) crates/tui/src/tui/ui/apply.rs:1490 — codewhale_tui::tui::ui::apply::apply_command_result_inner has cognitive complexity 305 (threshold 15). Drivers by points: if/else 68 (195 pts), match/switch 35 (104 pts), boolean chains 6 (nesting depth added 196). 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.
  • codewhale_tui::commands::config_main_host::set_config_value (cognitive 237) crates/tui/src/commands/config_main_host.rs:1663 — codewhale_tui::commands::config_main_host::set_config_value has cognitive complexity 237 (threshold 15). Drivers by points: if/else 87 (159 pts), match/switch 33 (68 pts), boolean chains 10 (nesting depth added 107). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_tui::tui::pet_watch::owner::run_world (cognitive 236) crates/tui/src/tui/pet_watch/owner.rs:424 — codewhale_tui::tui::pet_watch::owner::run_world has cognitive complexity 236 (threshold 15). Drivers by points: if/else 60 (177 pts), loops 6 (29 pts), boolean chains 19, match/switch 4 (11 pts) (nesting depth added 147). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • codewhale_tui::exec_agent::run_exec_agent (cognitive 229) crates/tui/src/exec_agent.rs:291 — codewhale_tui::exec_agent::run_exec_agent has cognitive complexity 229 (threshold 15). Drivers by points: if/else 81 (164 pts), boolean chains 29, match/switch 9 (29 pts), loops 2 (7 pts) (nesting depth added 108). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_tui::tui::history::latex_render::render_latex_to_string (cognitive 221) crates/tui/src/tui/history/latex_render.rs:680 — codewhale_tui::tui::history::latex_render::render_latex_to_string has cognitive complexity 221 (threshold 15). Drivers by points: if/else 70 (197 pts), match/switch 5 (19 pts), boolean chains 4, loops 1 (nesting depth added 141). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_tui::config::apply_env_overrides_unlocked (cognitive 217) crates/tui/src/config.rs:8099 — codewhale_tui::config::apply_env_overrides_unlocked has cognitive complexity 217 (threshold 15). Drivers by points: if/else 116 (144 pts), boolean chains 73 (nesting depth added 28). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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.
  • codewhale_tui::client::chat::build_chat_messages_with_reasoning (cognitive 186) crates/tui/src/client/chat.rs:2732 — codewhale_tui::client::chat::build_chat_messages_with_reasoning has cognitive complexity 186 (threshold 15). Drivers by points: if/else 48 (144 pts), loops 7 (20 pts), boolean chains 19, match/switch 1 (3 pts) (nesting depth added 111). 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.
  • codewhale_tui::run_doctor (cognitive 182) crates/tui/src/lib.rs:4954 — codewhale_tui::run_doctor has cognitive complexity 182 (threshold 15). Drivers by points: if/else 87 (114 pts), match/switch 24 (35 pts), loops 11 (20 pts), boolean chains 13 (nesting depth added 47). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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.
  • codewhale_tui::remote_control::relay_worker (cognitive 156) crates/tui/src/remote_control.rs:3234 — codewhale_tui::remote_control::relay_worker has cognitive complexity 156 (threshold 15). Drivers by points: if/else 29 (122 pts), match/switch 8 (22 pts), loops 4 (11 pts), boolean chains 1 (nesting depth added 114). 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.
  • codewhale_tui::tui::pet_watch::live::run (cognitive 143) crates/tui/src/tui/pet_watch/live.rs:437 — codewhale_tui::tui::pet_watch::live::run has cognitive complexity 143 (threshold 15). Drivers by points: if/else 45 (111 pts), match/switch 6 (18 pts), boolean chains 9, loops 3 (5 pts) (nesting depth added 80). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_tui::skills::frontmatter::parse_frontmatter (cognitive 131) crates/tui/src/skills/frontmatter.rs:127 — codewhale_tui::skills::frontmatter::parse_frontmatter has cognitive complexity 131 (threshold 15). Drivers by points: if/else 30 (87 pts), loops 8 (32 pts), boolean chains 8, match/switch 1 (4 pts) (nesting depth added 84). 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.
  • codewhale_tui::tui::mouse_ui::handle_mouse_event (cognitive 129) crates/tui/src/tui/mouse_ui.rs:438 — codewhale_tui::tui::mouse_ui::handle_mouse_event has cognitive complexity 129 (threshold 15). Drivers by points: if/else 48 (102 pts), boolean chains 13, match/switch 5 (12 pts), loops 1 (2 pts) (nesting depth added 62). 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.
  • codewhale_tui::tui::underwater::launch_empty_state (cognitive 126) crates/tui/src/tui/underwater.rs:1628 — codewhale_tui::tui::underwater::launch_empty_state has cognitive complexity 126 (threshold 15). Drivers by points: if/else 58 (94 pts), loops 11 (22 pts), boolean chains 10 (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.
  • codewhale_tui::run_mcp_command (cognitive 102) crates/tui/src/lib.rs:12026 — codewhale_tui::run_mcp_command has cognitive complexity 102 (threshold 15). Drivers by points: if/else 32 (70 pts), loops 7 (21 pts), match/switch 3 (6 pts), boolean chains 5 (nesting depth added 55). 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.
  • codewhale_tui::run_async_main_dispatch (cognitive 100) crates/tui/src/lib.rs:2509 — codewhale_tui::run_async_main_dispatch has cognitive complexity 100 (threshold 15). Drivers by points: if/else 34 (80 pts), match/switch 4 (11 pts), boolean chains 9 (nesting depth added 53). 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.
  • codewhale_tui::tui::tool_routing::handle_tool_call_complete (cognitive 99) crates/tui/src/tui/tool_routing.rs:744 — codewhale_tui::tui::tool_routing::handle_tool_call_complete has cognitive complexity 99 (threshold 15). Drivers by points: if/else 32 (69 pts), match/switch 9 (21 pts), boolean chains 9 (nesting depth added 49). 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.
  • codewhale_tui::tools::subagent::engine::drive_child_actor (cognitive 97) crates/tui/src/tools/subagent/engine.rs:1644 — codewhale_tui::tools::subagent::engine::drive_child_actor has cognitive complexity 97 (threshold 15). Drivers by points: if/else 24 (57 pts), match/switch 9 (29 pts), boolean chains 6, loops 5 (nesting depth added 53). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_tui::tui::diff_render::render_diff_body_bounded (cognitive 95) crates/tui/src/tui/diff_render.rs:75 — codewhale_tui::tui::diff_render::render_diff_body_bounded has cognitive complexity 95 (threshold 15). Drivers by points: if/else 27 (73 pts), loops 6 (18 pts), boolean chains 4 (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.
  • codewhale_tui::client::responses::convert_messages_to_responses_input (cognitive 93) crates/tui/src/client/responses.rs:810 — codewhale_tui::client::responses::convert_messages_to_responses_input has cognitive complexity 93 (threshold 15). Drivers by points: if/else 18 (63 pts), match/switch 5 (17 pts), loops 4 (11 pts), boolean chains 2 (nesting depth added 64). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_tui::tui::widgets::slash_completion_hints_for_plugins (cognitive 92) crates/tui/src/tui/widgets/mod.rs:3247 — codewhale_tui::tui::widgets::slash_completion_hints_for_plugins has cognitive complexity 92 (threshold 15). Drivers by points: if/else 29 (58 pts), loops 12 (24 pts), boolean chains 10 (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.
  • codewhale_tui::tui::ui::frame::render (cognitive 89) crates/tui/src/tui/ui/frame.rs:1443 — codewhale_tui::tui::ui::frame::render has cognitive complexity 89 (threshold 15). Drivers by points: if/else 61 (72 pts), boolean chains 17 (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.
  • codewhale_tui::client::chat::parse_sse_chunk_with_reasoning_style (cognitive 88) crates/tui/src/client/chat.rs:4152 — codewhale_tui::client::chat::parse_sse_chunk_with_reasoning_style has cognitive complexity 88 (threshold 15). Drivers by points: if/else 19 (54 pts), loops 5 (16 pts), match/switch 5 (16 pts), boolean chains 2 (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.
  • codewhale_tui::tui::ambient_life::build_frame_marks (cognitive 86) crates/tui/src/tui/ambient_life.rs:300 — codewhale_tui::tui::ambient_life::build_frame_marks has cognitive complexity 86 (threshold 15). Drivers by points: if/else 40 (71 pts), loops 6 (10 pts), boolean chains 5 (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.
  • + 520 more in this group — see findings.md.
D1 · Cyclomatic Complexity · codewhale_tui · ×309
  • codewhale_tui::tui::ui::event_loop::run_event_loop (cyclomatic 791) crates/tui/src/tui/ui/event_loop.rs:1854 — codewhale_tui::tui::ui::event_loop::run_event_loop has cyclomatic complexity 791 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codewhale_tui::tui::ui::handlers::handle_view_events (cyclomatic 208) crates/tui/src/tui/ui/handlers.rs:1818 — codewhale_tui::tui::ui::handlers::handle_view_events has cyclomatic complexity 208 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codewhale_tui::tui::ui::apply::apply_command_result_inner (cyclomatic 190) crates/tui/src/tui/ui/apply.rs:1490 — codewhale_tui::tui::ui::apply::apply_command_result_inner has cyclomatic complexity 190 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codewhale_tui::config::apply_env_overrides_unlocked (cyclomatic 188) crates/tui/src/config.rs:8099 — codewhale_tui::config::apply_env_overrides_unlocked has cyclomatic complexity 188 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codewhale_tui::commands::config_main_host::set_config_value (cyclomatic 178) crates/tui/src/commands/config_main_host.rs:1663 — codewhale_tui::commands::config_main_host::set_config_value has cyclomatic complexity 178 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codewhale_tui::run_doctor (cyclomatic 132) crates/tui/src/lib.rs:4954 — codewhale_tui::run_doctor has cyclomatic complexity 132 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codewhale_tui::exec_agent::run_exec_agent (cyclomatic 132) crates/tui/src/exec_agent.rs:291 — codewhale_tui::exec_agent::run_exec_agent has cyclomatic complexity 132 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codewhale_tui::tui::history::latex_render::render_latex_to_string (cyclomatic 121) crates/tui/src/tui/history/latex_render.rs:680 — codewhale_tui::tui::history::latex_render::render_latex_to_string has cyclomatic complexity 121 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codewhale_tui::client::apply_reasoning_effort (cyclomatic 108) crates/tui/src/client.rs:6215 — codewhale_tui::client::apply_reasoning_effort has cyclomatic complexity 108 (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.
  • codewhale_tui::commands::config_main_host::show_single_setting (cyclomatic 104) crates/tui/src/commands/config_main_host.rs:169 — codewhale_tui::commands::config_main_host::show_single_setting has cyclomatic complexity 104 (threshold 15). Of this number, 87 points are the body's own statements and 17 belong to 3 function items inside it that branch. 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.
  • codewhale_tui::tui::pet_watch::owner::run_world (cyclomatic 87) crates/tui/src/tui/pet_watch/owner.rs:424 — codewhale_tui::tui::pet_watch::owner::run_world has cyclomatic complexity 87 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codewhale_tui::run_async_main_dispatch (cyclomatic 78) crates/tui/src/lib.rs:2509 — codewhale_tui::run_async_main_dispatch has cyclomatic complexity 78 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codewhale_tui::tui::mouse_ui::handle_mouse_event (cyclomatic 77) crates/tui/src/tui/mouse_ui.rs:438 — codewhale_tui::tui::mouse_ui::handle_mouse_event 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.
  • codewhale_tui::tui::setup::constitution_ratification_text (cyclomatic 74) crates/tui/src/tui/setup/mod.rs:4412 — codewhale_tui::tui::setup::constitution_ratification_text has cyclomatic complexity 74 (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.
  • codewhale_tui::client::chat::build_chat_messages_with_reasoning (cyclomatic 71) crates/tui/src/client/chat.rs:2732 — codewhale_tui::client::chat::build_chat_messages_with_reasoning has cyclomatic complexity 71 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codewhale_tui::tui::underwater::launch_empty_state (cyclomatic 68) crates/tui/src/tui/underwater.rs:1628 — codewhale_tui::tui::underwater::launch_empty_state has cyclomatic complexity 68 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codewhale_tui::tui::ui::frame::render (cyclomatic 63) crates/tui/src/tui/ui/frame.rs:1443 — codewhale_tui::tui::ui::frame::render has cyclomatic complexity 63 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codewhale_tui::tui::pet_watch::live::run (cyclomatic 62) crates/tui/src/tui/pet_watch/live.rs:437 — codewhale_tui::tui::pet_watch::live::run 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.
  • codewhale_tui::extension_host::mcp_http::fetch (cyclomatic 57) crates/tui/src/extension_host/mcp_http.rs:226 — codewhale_tui::extension_host::mcp_http::fetch has cyclomatic complexity 57 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codewhale_tui::provider_readiness::credential_state_for_provider (cyclomatic 55) crates/tui/src/provider_readiness.rs:132 — codewhale_tui::provider_readiness::credential_state_for_provider has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codewhale_tui::tui::work_surface::input::handle_mouse (cyclomatic 55) crates/tui/src/tui/work_surface/input.rs:231 — codewhale_tui::tui::work_surface::input::handle_mouse has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codewhale_tui::tools::subagent::engine::drive_child_actor (cyclomatic 54) crates/tui/src/tools/subagent/engine.rs:1644 — codewhale_tui::tools::subagent::engine::drive_child_actor has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codewhale_tui::tui::tool_routing::handle_tool_call_complete (cyclomatic 53) crates/tui/src/tui/tool_routing.rs:744 — codewhale_tui::tui::tool_routing::handle_tool_call_complete 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.
  • codewhale_tui::receipts::assemble (cyclomatic 51) crates/tui/src/receipts.rs:1709 — codewhale_tui::receipts::assemble 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.
  • codewhale_tui::tui::widgets::slash_completion_hints_for_plugins (cyclomatic 51) crates/tui/src/tui/widgets/mod.rs:3247 — codewhale_tui::tui::widgets::slash_completion_hints_for_plugins 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.
  • + 284 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×297
  • Hotspot: crates/tui/src/tui/ui/event_loop.rs crates/tui/src/tui/ui/event_loop.rs:1854 — crates/tui/src/tui/ui/event_loop.rs changed 303 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 791 in codewhale_tui::tui::ui::event_loop::run_event_loop at line 1854. 124 of those changes were fix/bug commits, and the other 179 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tui/ui/event_loop.rs`: 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: crates/tui/src/config.rs crates/tui/src/config.rs:8099 — crates/tui/src/config.rs changed 254 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 188 in codewhale_tui::config::apply_env_overrides_unlocked at line 8099. 68 of those changes were fix/bug commits, and the other 186 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/config.rs`: 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: crates/tui/src/runtime_threads.rs crates/tui/src/runtime_threads.rs:17749 — crates/tui/src/runtime_threads.rs changed 248 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 186 in RuntimeThreadManager::monitor_turn at line 17749. 111 of those changes were fix/bug commits, and the other 137 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/runtime_threads.rs`: 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: crates/tui/src/lib.rs crates/tui/src/lib.rs:4954 — crates/tui/src/lib.rs changed 348 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 132 in codewhale_tui::run_doctor at line 4954. 131 of those changes were fix/bug commits, and the other 217 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/lib.rs`: 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: crates/tui/src/core/engine.rs crates/tui/src/core/engine.rs:3641 — crates/tui/src/core/engine.rs changed 338 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 96 in Engine::run_owned at line 3641. 129 of those changes were fix/bug commits, and the other 209 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/core/engine.rs`: 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: crates/tui/src/tui/ui/apply.rs crates/tui/src/tui/ui/apply.rs:1490 — crates/tui/src/tui/ui/apply.rs changed 162 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 190 in codewhale_tui::tui::ui::apply::apply_command_result_inner at line 1490. 67 of those changes were fix/bug commits, and the other 95 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tui/ui/apply.rs`: 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: crates/tui/src/core/engine/turn_loop.rs crates/tui/src/core/engine/turn_loop.rs:1803 — crates/tui/src/core/engine/turn_loop.rs changed 245 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 116 in Engine::plan_tool_calls at line 1803. 96 of those changes were fix/bug commits, and the other 149 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/core/engine/turn_loop.rs`: 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: crates/tui/src/tui/ui/handlers.rs crates/tui/src/tui/ui/handlers.rs:1818 — crates/tui/src/tui/ui/handlers.rs changed 112 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 208 in codewhale_tui::tui::ui::handlers::handle_view_events at line 1818. 43 of those changes were fix/bug commits, and the other 69 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tui/ui/handlers.rs`: 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: crates/tui/src/client.rs crates/tui/src/client.rs:6215 — crates/tui/src/client.rs changed 175 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 108 in codewhale_tui::client::apply_reasoning_effort at line 6215. 63 of those changes were fix/bug commits, and the other 112 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/client.rs`: 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: crates/tui/src/tools/shell.rs crates/tui/src/tools/shell.rs:5889 — crates/tui/src/tools/shell.rs changed 131 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 125 in BashTool::execute at line 5889. 45 of those changes were fix/bug commits, and the other 86 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tools/shell.rs`: 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: crates/tui/src/tools/subagent/mod.rs crates/tui/src/tools/subagent/mod.rs:8607 — crates/tui/src/tools/subagent/mod.rs changed 300 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 53 in SubAgentManager::spawn_background_with_assignment_options at line 8607. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tools/subagent/mod.rs`: 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:2273 — REDACTED changed 181 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 87 in codewhale_cli::run at line 2273. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/tui/src/commands/contract.rs crates/tui/src/commands/contract.rs:176 — crates/tui/src/commands/contract.rs changed 123 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 109 in codewhale_tui::commands::contract::key_to_message_id at line 176. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/commands/contract.rs`: 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: crates/tui/src/tui/provider_picker.rs crates/tui/src/tui/provider_picker.rs:4693 — crates/tui/src/tui/provider_picker.rs changed 90 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 134 in ProviderPickerView::handle_key at line 4693. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tui/provider_picker.rs`: 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: crates/tui/src/tui/app/init.rs crates/tui/src/tui/app/init.rs:27 — crates/tui/src/tui/app/init.rs changed 157 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 73 in App::new_with_plugin_registry at line 27. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tui/app/init.rs`: 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: crates/tui/src/tui/ui/frame.rs crates/tui/src/tui/ui/frame.rs:1443 — crates/tui/src/tui/ui/frame.rs changed 162 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 63 in codewhale_tui::tui::ui::frame::render at line 1443. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tui/ui/frame.rs`: 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: crates/tui/src/exec_agent.rs crates/tui/src/exec_agent.rs:291 — crates/tui/src/exec_agent.rs changed 71 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 132 in codewhale_tui::exec_agent::run_exec_agent at line 291. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/exec_agent.rs`: 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: crates/tui/src/tui/views/mod.rs crates/tui/src/tui/views/mod.rs:5379 — crates/tui/src/tui/views/mod.rs changed 162 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 50 in ConfigView::render_settings_shell at line 5379. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tui/views/mod.rs`: 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: crates/config/src/lib.rs crates/config/src/lib.rs:3403 — crates/config/src/lib.rs changed 150 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 54 in ConfigToml::resolve_runtime_options_with_secrets at line 3403. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/config/src/lib.rs`: 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: crates/tui/src/tui/underwater.rs crates/tui/src/tui/underwater.rs:1628 — crates/tui/src/tui/underwater.rs changed 119 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 68 in codewhale_tui::tui::underwater::launch_empty_state at line 1628. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tui/underwater.rs`: 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: crates/tui/src/runtime_api.rs crates/tui/src/runtime_api.rs:12016 — crates/tui/src/runtime_api.rs changed 207 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 35 in codewhale_tui::runtime_api::set_config at line 12016. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/runtime_api.rs`: 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: crates/tui/src/tui/widgets/mod.rs crates/tui/src/tui/widgets/mod.rs:3247 — crates/tui/src/tui/widgets/mod.rs changed 135 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 51 in codewhale_tui::tui::widgets::slash_completion_hints_for_plugins at line 3247. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tui/widgets/mod.rs`: 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: crates/tui/src/tui/app.rs crates/tui/src/tui/app.rs:6231 — crates/tui/src/tui/app.rs changed 271 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in App::announce_settled_workflows at line 6231. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tui/app.rs`: 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: crates/tui/src/runtime_web/app.mjs crates/tui/src/runtime_web/app.mjs:868 — crates/tui/src/runtime_web/app.mjs changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 318 in app.startBrowserClient at line 868. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/runtime_web/app.mjs`: 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: crates/tui/src/tui/mouse_ui.rs crates/tui/src/tui/mouse_ui.rs:438 — crates/tui/src/tui/mouse_ui.rs changed 76 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 77 in codewhale_tui::tui::mouse_ui::handle_mouse_event at line 438. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tui/mouse_ui.rs`: 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.
  • + 272 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×260
  • FileTooLong: src/runtime_threads.rs crates/tui/src/runtime_threads.rs — FileTooLong — 14110 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 125 free functions. The bar is 500 significant lines; this is 13610 over it, 28.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: subagent/mod.rs crates/tui/src/tools/subagent/mod.rs — FileTooLong — 12220 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 271 free functions. The bar is 500 significant lines; this is 11720 over it, 24.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: REDACTED crates/tui/src/lib.rs — FileTooLong — 10070 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 333 free functions. The bar is 500 significant lines; this is 9570 over it, 20.14× 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/runtime_api.rs crates/tui/src/runtime_api.rs — FileTooLong — 9422 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 292 free functions. The bar is 500 significant lines; this is 8922 over it, 18.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: src/config.rs crates/tui/src/config.rs — FileTooLong — 7416 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 190 free functions. The bar is 500 significant lines; this is 6916 over it, 14.83× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: pet_watch/pet-native.js crates/tui/src/tui/pet_watch/pet-native.js — FileTooLong — 6658 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 6158 over it, 13.32× 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: Resources/pet-native.js pet/ios/Resources/pet-native.js — FileTooLong — 6658 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 6158 over it, 13.32× 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/engine.rs crates/tui/src/core/engine.rs — FileTooLong — 6374 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 79% of them inside a single declaration: Engine (2 blocks, 994-9285), declaring 38 free functions. The bar is 500 significant lines; this is 5874 over it, 12.75× 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: ui/event_loop.rs crates/tui/src/tui/ui/event_loop.rs — FileTooLong — 5221 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 4721 over it, 10.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: REDACTED crates/config/src/lib.rs — FileTooLong — 5199 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 181 free functions. The bar is 500 significant lines; this is 4699 over it, 10.40× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: tools/shell.rs crates/tui/src/tools/shell.rs — FileTooLong — 4974 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 100 free functions. The bar is 500 significant lines; this is 4474 over it, 9.95× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 4595 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 158 free functions. The bar is 500 significant lines; this is 4095 over it, 9.19× 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: views/mod.rs crates/tui/src/tui/views/mod.rs — FileTooLong — 4532 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 47 free functions. The bar is 500 significant lines; this is 4032 over it, 9.06× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: tui/app.rs crates/tui/src/tui/app.rs — FileTooLong — 4344 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 3844 over it, 8.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: engine/turn_loop.rs crates/tui/src/core/engine/turn_loop.rs — FileTooLong — 4265 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 78% of them inside a single declaration: Engine (2 blocks, 416-5794), declaring 48 free functions. The bar is 500 significant lines; this is 3765 over it, 8.53× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/client.rs crates/tui/src/client.rs — FileTooLong — 4224 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 90 free functions. The bar is 500 significant lines; this is 3724 over it, 8.45× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: workflow/mod.rs crates/tui/src/tools/workflow/mod.rs — FileTooLong — 4141 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 99 free functions. The bar is 500 significant lines; this is 3641 over it, 8.28× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: setup/mod.rs crates/tui/src/tui/setup/mod.rs — FileTooLong — 3963 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 37 free functions. The bar is 500 significant lines; this is 3463 over it, 7.93× 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: tui/provider_picker.rs crates/tui/src/tui/provider_picker.rs — FileTooLong — 3846 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 68% of them inside a single declaration: ProviderPickerView (3 blocks, 190-5450), declaring 35 free functions. The bar is 500 significant lines; this is 3346 over it, 7.69× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/remote_control.rs crates/tui/src/remote_control.rs — FileTooLong — 3477 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 74 free functions. The bar is 500 significant lines; this is 2977 over it, 6.95× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: tui/model_picker.rs crates/tui/src/tui/model_picker.rs — FileTooLong — 3412 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 72 free functions. The bar is 500 significant lines; this is 2912 over it, 6.82× 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/oauth.rs crates/tui/src/oauth.rs — FileTooLong — 3389 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 131 free functions. The bar is 500 significant lines; this is 2889 over it, 6.78× 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: commands/contract.rs crates/tui/src/commands/contract.rs — FileTooLong — 3366 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 72 free functions. The bar is 500 significant lines; this is 2866 over it, 6.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: ui/apply.rs crates/tui/src/tui/ui/apply.rs — FileTooLong — 3217 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 2717 over it, 6.43× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/session_manager.rs crates/tui/src/session_manager.rs — FileTooLong — 3188 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 66 free functions. The bar is 500 significant lines; this is 2688 over it, 6.38× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • + 235 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×235
  • FunctionTooLong: codewhale_tui::tui::ui::event_loop::run_event_loop crates/tui/src/tui/ui/event_loop.rs:1854 — FunctionTooLong — codewhale_tui::tui::ui::event_loop::run_event_loop runs 3522 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 3422 over it, 35.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: app.startBrowserClient crates/tui/src/runtime_web/app.mjs:868 — FunctionTooLong — startBrowserClient runs 1176 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1076 over it, 11.76× 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: codewhale_tui::tui::ui::handlers::handle_view_events crates/tui/src/tui/ui/handlers.rs:1818 — FunctionTooLong — codewhale_tui::tui::ui::handlers::handle_view_events runs 1115 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 1015 over it, 11.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: codewhale_tui::tui::ui::apply::apply_command_result_inner crates/tui/src/tui/ui/apply.rs:1490 — FunctionTooLong — codewhale_tui::tui::ui::apply::apply_command_result_inner runs 1049 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 949 over it, 10.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: codewhale_tui::exec_agent::run_exec_agent crates/tui/src/exec_agent.rs:291 — FunctionTooLong — codewhale_tui::exec_agent::run_exec_agent runs 1033 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 933 over it, 10.33× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: linux.create crates/tui/plugins/computer-use/src/backends/linux.mjs:85 — FunctionTooLong — create runs 984 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 884 over it, 9.84× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codewhale_tui::commands::config_main_host::set_config_value crates/tui/src/commands/config_main_host.rs:1663 — FunctionTooLong — codewhale_tui::commands::config_main_host::set_config_value runs 743 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 643 over it, 7.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: darwin.create crates/tui/plugins/computer-use/src/backends/darwin.mjs:195 — FunctionTooLong — create runs 685 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 585 over it, 6.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: codewhale_tui::core::protocol_parity::event_to_protocol crates/tui/src/core/protocol_parity.rs:442 — FunctionTooLong — codewhale_tui::core::protocol_parity::event_to_protocol runs 552 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 452 over it, 5.52× 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: codewhale_tui::runtime_api::thread_history::mutate_in_owner crates/tui/src/runtime_api/thread_history.rs:1049 — FunctionTooLong — codewhale_tui::runtime_api::thread_history::mutate_in_owner runs 518 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 418 over it, 5.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: codewhale_tui::tui::setup::constitution_ratification_text crates/tui/src/tui/setup/mod.rs:4412 — FunctionTooLong — codewhale_tui::tui::setup::constitution_ratification_text runs 483 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 383 over it, 4.83× 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: codewhale_cli::cloud::computer::run crates/cli/src/cloud/computer.rs:171 — FunctionTooLong — codewhale_cli::cloud::computer::run runs 444 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 344 over it, 4.44× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codewhale_cli::cloud::run_agents crates/cli/src/cloud.rs:2324 — FunctionTooLong — codewhale_cli::cloud::run_agents runs 397 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 297 over it, 3.97× 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: codewhale_tui::tui::pet_watch::owner::run_world crates/tui/src/tui/pet_watch/owner.rs:424 — FunctionTooLong — codewhale_tui::tui::pet_watch::owner::run_world runs 391 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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: win32.create crates/tui/plugins/computer-use/src/backends/win32.mjs:152 — FunctionTooLong — create runs 390 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 290 over it, 3.90× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codewhale_tui::tui::ui::event_loop::run_tui crates/tui/src/tui/ui/event_loop.rs:825 — FunctionTooLong — codewhale_tui::tui::ui::event_loop::run_tui runs 370 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 270 over it, 3.70× 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: codewhale_cli::run REDACTED:2273 — FunctionTooLong — codewhale_cli::run runs 358 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 258 over it, 3.58× 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: scene.createOcean crates/tui/src/integrations/dsh/scene.js:17 — FunctionTooLong — createOcean runs 348 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 248 over it, 3.48× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codewhale_tui::client::chat::build_chat_messages_with_reasoning crates/tui/src/client/chat.rs:2732 — FunctionTooLong — codewhale_tui::client::chat::build_chat_messages_with_reasoning runs 330 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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: chat.chatScript extensions/vscode/src/chat.ts:1029 — FunctionTooLong — chatScript 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: codewhale_tui::remote_control::relay_worker crates/tui/src/remote_control.rs:3234 — FunctionTooLong — codewhale_tui::remote_control::relay_worker runs 325 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 225 over it, 3.25× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codewhale_tui::tui::ui::frame::render crates/tui/src/tui/ui/frame.rs:1443 — FunctionTooLong — codewhale_tui::tui::ui::frame::render runs 313 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 213 over it, 3.13× 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: codewhale_tui::tui::work_surface::render::render crates/tui/src/tui/work_surface/render/mod.rs:56 — FunctionTooLong — codewhale_tui::tui::work_surface::render::render runs 306 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 206 over it, 3.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: codewhale_tui::tools::subagent::spawn_subagent_from_input crates/tui/src/tools/subagent/mod.rs:12598 — FunctionTooLong — codewhale_tui::tools::subagent::spawn_subagent_from_input runs 302 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 202 over it, 3.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: codewhale_tui::tui::underwater::launch_empty_state crates/tui/src/tui/underwater.rs:1628 — FunctionTooLong — codewhale_tui::tui::underwater::launch_empty_state runs 269 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 169 over it, 2.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 210 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×143
  • MethodTooLong: App.new_with_plugin_registry crates/tui/src/tui/app/init.rs:27 — MethodTooLong — new_with_plugin_registry runs 956 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 856 over it, 9.56× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Engine.execute_planned_tools crates/tui/src/core/engine/turn_loop.rs:2674 — MethodTooLong — execute_planned_tools runs 766 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 666 over it, 7.66× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Engine.run_owned crates/tui/src/core/engine.rs:3641 — MethodTooLong — run_owned runs 668 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 568 over it, 6.68× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Engine.run_model_step crates/tui/src/core/engine/turn_loop/model_step.rs:7 — MethodTooLong — run_model_step runs 657 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 557 over it, 6.57× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Engine.handle_admitted_message crates/tui/src/core/engine.rs:6264 — MethodTooLong — handle_admitted_message runs 640 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 540 over it, 6.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: BashTool.execute crates/tui/src/tools/shell.rs:5889 — MethodTooLong — execute runs 614 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 514 over it, 6.14× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Engine.process_stream crates/tui/src/core/engine/turn_loop.rs:4556 — MethodTooLong — process_stream runs 608 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 508 over it, 6.08× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ConfigView.new_for_app crates/tui/src/tui/views/mod.rs:2241 — MethodTooLong — new_for_app runs 572 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 472 over it, 5.72× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Engine.plan_tool_calls crates/tui/src/core/engine/turn_loop.rs:1803 — MethodTooLong — plan_tool_calls runs 540 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 440 over it, 5.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SubAgentManager.spawn_background_with_assignment_options crates/tui/src/tools/subagent/mod.rs:8607 — MethodTooLong — spawn_background_with_assignment_options runs 498 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 398 over it, 4.98× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Engine.prepare_model_step crates/tui/src/core/engine/turn_loop/preparation.rs:6 — MethodTooLong — prepare_model_step runs 446 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 346 over it, 4.46× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ProviderPickerView.handle_key crates/tui/src/tui/provider_picker.rs:4693 — MethodTooLong — handle_key runs 402 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 302 over it, 4.02× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ComposerWidget.render crates/tui/src/tui/widgets/composer_legacy.rs:253 — MethodTooLong — render runs 384 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 284 over it, 3.84× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Engine.new_admitted_with_subagent_manager crates/tui/src/core/engine.rs:2057 — MethodTooLong — new_admitted_with_subagent_manager runs 379 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 279 over it, 3.79× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: EnvRuntimeOverrides.load crates/config/src/lib.rs:7550 — MethodTooLong — load runs 354 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 254 over it, 3.54× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ProviderDashboardRow.from_config_with_provider_id crates/tui/src/tui/provider_picker.rs:557 — MethodTooLong — from_config_with_provider_id runs 348 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 248 over it, 3.48× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ChatWidget.new_with_ocean_elapsed crates/tui/src/tui/widgets/transcript_legacy.rs:130 — MethodTooLong — new_with_ocean_elapsed runs 328 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 228 over it, 3.28× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: CodewhaleClient.handle_responses_stream crates/tui/src/client/responses.rs:160 — MethodTooLong — handle_responses_stream runs 316 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 216 over it, 3.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Engine.build_turn_tool_registry_and_catalog crates/tui/src/core/engine.rs:5786 — MethodTooLong — build_turn_tool_registry_and_catalog runs 313 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 213 over it, 3.13× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ConfigView.render_settings_shell crates/tui/src/tui/views/mod.rs:5379 — MethodTooLong — render_settings_shell runs 313 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 213 over it, 3.13× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Engine.build_request_manifest crates/tui/src/core/engine/preview.rs:182 — MethodTooLong — build_request_manifest runs 267 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 167 over it, 2.67× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ProviderPickerView.render_list crates/tui/src/tui/provider_picker.rs:2887 — MethodTooLong — render_list runs 261 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 161 over it, 2.61× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: StateStore.migrate_schema crates/state/src/lib.rs:366 — MethodTooLong — migrate_schema runs 258 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 158 over it, 2.58× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Engine.run_inline_repl_phase crates/tui/src/core/engine/turn_loop/inline_repl.rs:7 — MethodTooLong — run_inline_repl_phase runs 258 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 158 over it, 2.58× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Engine.continue_model_step crates/tui/src/core/engine/turn_loop/continuation.rs:6 — MethodTooLong — continue_model_step runs 251 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 151 over it, 2.51× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 118 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Repeated repair · ×69
  • Repeated repair: crates/tui/src/core/engine/streaming.rs crates/tui/src/core/engine/streaming.rs:766 — crates/tui/src/core/engine/streaming.rs changed 21 times in last 90 days and 11 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 codewhale_tui::core::engine::streaming::filter_tool_call_delta_with_state at line 766), 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(client): apply stream header timeouts per retry attempt (CW-7501) [skip ci]”; “fix(engine): measure deferred tools on provider wire (CW-7462) [skip ci]”; “fix: preserve canceled tool completion receipts through one event primitive”; “fix: preserve available post-cancel receipts on the existing event queue”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/core/engine/streaming.rs`: 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: crates/tui/src/tools/codemode.rs crates/tui/src/tools/codemode.rs:774 — crates/tui/src/tools/codemode.rs changed 19 times in last 90 days and 10 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is CodemodeInvoker::execute at line 774), 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(tui): land the operation-span and pet-owner packet, restore a compiling main”; “fix(security): tighten approval, execution and endpoint boundaries for 0.10.1”; “fix(skills): unify discovery policy and validate frontmatter at shared boundaries”; “fix(skills): hold resolved and configured skills dirs to workspace trust”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tools/codemode.rs`: 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: crates/tui/src/tui/persistence_actor.rs crates/tui/src/tui/persistence_actor.rs:495 — crates/tui/src/tui/persistence_actor.rs changed 16 times in last 90 days and 10 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 PendingState::absorb at line 495), 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(persistence): log why queued messages were not saved”; “fix(tui): announce restored queued messages on resume and log queue write errors (CW-7427)”; “fix(session): bound the session journal, work graph and metadata read (#6842)”; “fix(tui): refuse attaching to a session open elsewhere; save notices follow real saves”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tui/persistence_actor.rs`: 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: crates/tui/src/tools/git_history.rs crates/tui/src/tools/git_history.rs:790 — crates/tui/src/tools/git_history.rs changed 15 times in last 90 days and 10 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is codewhale_tui::tools::git_history::validate_git_refspec at line 790), 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(git_fetch): remote-tracking refs only, no local tags (Audit finding D03-01)”; “fix(tools): contain Python, plugin and Git child process trees”; “fix(integrate): address Codex review of the round-2 merge resolutions”; “fix: keep blame, working-tree reads and fetch tags from running repo config”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tools/git_history.rs`: 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: crates/tui/src/compaction/last_round.rs crates/tui/src/compaction/last_round.rs:420 — crates/tui/src/compaction/last_round.rs changed 14 times in last 90 days and 10 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 codewhale_tui::compaction::last_round::validate_last_round_coverage at line 420), 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(compaction): scope legacy checkpoint recognition by era”; “fix(ci): format admitted profile guidance and allow cold Mac qualification”; “fix(extensions): bound escaped prompts and preserve compacted snapshots”; “fix(engine): separate execution identity from provider tool ids”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/compaction/last_round.rs`: 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: crates/tui/src/tools/test_runner.rs crates/tui/src/tools/test_runner.rs:82 — crates/tui/src/tools/test_runner.rs changed 13 times in last 90 days and 8 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 RunTestsTool::execute at line 82), 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(security): tighten approval, execution and endpoint boundaries for 0.10.1”; “fix(tools): review follow-ups for shell retention and contained child processes”; “fix(tools): shell job retention, output deltas, and child process lifetimes”; “fix(tui): drop eprintln! skip messages from env-scrub tests (clippy)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tools/test_runner.rs`: 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: crates/tui/src/tool_inspection.rs crates/tui/src/tool_inspection.rs:461 — crates/tui/src/tool_inspection.rs changed 13 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is codewhale_tui::tool_inspection::project_tool at line 461), 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(runtime): let delegated work finish without invented budgets (CW-7500) [skip ci]”; “fix(FEAT-029): keep host rendering conveniences test-only”; “fix(FEAT-029): preserve upstream diagnostics after main rebase”; “fix(engine): retry a clean empty stop before failing the turn”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tool_inspection.rs`: 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: crates/tui/src/tui/clipboard.rs crates/tui/src/tui/clipboard.rs:565 — crates/tui/src/tui/clipboard.rs changed 12 times in last 90 days and 8 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 ClipboardHandler::read_content at line 565), 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(tui): cover every non-native clipboard target in ClipboardContent's dead_code gate”; “fix(tui): bound the git and Wayland clipboard calls that could hang the UI”; “fix(tui): pasted images and stable screenshot copies are written confined”; “fix(tui): unblock ohos check and clippy on the right-click branch”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tui/clipboard.rs`: 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: crates/tui/src/tui/shell_job_routing.rs crates/tui/src/tui/shell_job_routing.rs:236 — crates/tui/src/tui/shell_job_routing.rs changed 12 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is codewhale_tui::tui::shell_job_routing::format_shell_job_detail at line 236), 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(CW-7087): retain shell inspection and align local Skills setup [skip ci]”; “fix(shell): wait results carry progress; a person's kill says what survived”; “fix(tui): the shell inspector follows a running job; Alt+V keeps the clicked card”; “fix(shell): a silent running command stays running and stoppable”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tui/shell_job_routing.rs`: 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: crates/config/src/private_directory.rs crates/config/src/private_directory.rs:105 — crates/config/src/private_directory.rs changed 11 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is codewhale_config::private_directory::open_owned_directory at line 105), 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(app-server): treat an owner record from an earlier boot as dead”; “fix(CW-7481): traverse restricted OHOS credential ancestors [skip ci]”; “0.10.2 candidate: MCP connects at start, background promotion, shell inspector, Full Access confirmation, Daytona and Sprite removal, composer-first launch, QA fixes”; “fix(runtime): recover owner startup and preserve reviewed plugin updates”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/config/src/private_directory.rs`: 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: crates/tui/src/sandbox/read_guard.rs crates/tui/src/sandbox/read_guard.rs:339 — crates/tui/src/sandbox/read_guard.rs changed 10 times in last 90 days and 8 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 ReadDenylist::check at line 339), 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(sandbox): stop denying a tool its own auth config to subprocesses”; “fix(security): close a daemon-socket sandbox escape and a codewhale web proof leak before 0.10.2”; “fix(session): refuse file rollback under a running turn, recover the crash checkpoint on resume, keep imports on the window's route”; “fix(security): tighten approval, execution and endpoint boundaries for 0.10.1”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/sandbox/read_guard.rs`: 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: crates/tui/src/tui/user_input.rs crates/tui/src/tui/user_input.rs:255 — crates/tui/src/tui/user_input.rs changed 12 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is UserInputView::handle_selecting_key at line 255), 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(tui): localize question footers and portable command feedback [skip ci]”; “fix(tui): keys typed before a question appears cannot answer it”; “fix(runtime): acknowledge human answers and retire ended question waits”; “fix(tui): audit findings U01-05, U01-m2, U01-m3, U01-m4, U07-12, U08-06, U08-m1”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tui/user_input.rs`: 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: crates/tui/src/route_preferences.rs crates/tui/src/route_preferences.rs:147 — crates/tui/src/route_preferences.rs changed 12 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is codewhale_tui::route_preferences::scrub_root_model_aliases_for_export at line 147), 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(engine): serve route-scoped catalogs through CLI and app readers [skip ci]”; “fix(tui): actionable CLI error messages (doctor, exec, stream, review)”; “fix(provider): keep a root default model with the provider that owns it”; “fix(config): read legacy top-level base_url/api_key by one rule (#6394)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/route_preferences.rs`: 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: crates/config/src/credentials.rs crates/config/src/credentials.rs:109 — crates/config/src/credentials.rs changed 11 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is codewhale_config::credentials::set_provider_api_key_unlocked at line 109), 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(auth): keep credential prompts and assertions free of secret sources”; “fix(cli,config): key prompt stream, model set routes, clear outcome, app-server config”; “fix(config): refuse storing an API key for openai-codex in the shared writer”; “fix(config): mark root auth_mode only when saving the active provider's key”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/config/src/credentials.rs`: 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: crates/tui/src/extension_host/tier.rs crates/tui/src/extension_host/tier.rs:90 — crates/tui/src/extension_host/tier.rs changed 11 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is HostTier::check_owner_id at line 90), 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(review): give the extension host the same report body the core renders”; “fix: finish calm terminal cards and refresh security dependencies [skip ci]”; “fix(release): close OAuth logging and bound retired account receipts”; “fix(weixin,runtime): address PR #6880 review findings”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/extension_host/tier.rs`: 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: crates/tui/src/plugins/marketplace/document.rs crates/tui/src/plugins/marketplace/document.rs:184 — crates/tui/src/plugins/marketplace/document.rs changed 9 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is codewhale_tui::plugins::marketplace::document::resolve_spec at line 184), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(plugins): a catalog archive source must be remote”; “fix(plugins): keep catalog sources inside the catalog and names unambiguous”; “fix(plugins): "install Computer Use" says it is built in instead of failing”; “fix: reconcile marketplace presence and OAuth token identity”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/plugins/marketplace/document.rs`: 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: crates/tui/src/tools/subagent/worktree.rs crates/tui/src/tools/subagent/worktree.rs:184 — crates/tui/src/tools/subagent/worktree.rs changed 8 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is codewhale_tui::tools::subagent::worktree::git_repo_root at line 184), 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(subagent): clean up refused-spawn worktrees off the async worker, despite hook output”; “fix(snapshot,subagent): serialize side-repo writes; keep undo under size pressure; clean up worktrees”; “fix(subagent): compare worktree paths in one form on Windows”; “fix(subagent): keep sub-agent worktrees under their root and harden worktree add”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tools/subagent/worktree.rs`: 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: crates/tui/src/composer_history.rs crates/tui/src/composer_history.rs:258 — crates/tui/src/composer_history.rs changed 11 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is codewhale_tui::composer_history::append_history_entries_to at line 258), 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: composer history keeps a file it could not read; an empty workflow fails”; “fix(tui): preserve legacy prompt history during JSONL migration”; “fix(tui): review follow-ups for composer input correctness”; “fix(tui): composer input correctness for multibyte clicks, oversized submits, paste order, mentions, history and attachments”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/composer_history.rs`: 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: crates/tui/src/snapshot/mod.rs crates/tui/src/snapshot/mod.rs:85 — crates/tui/src/snapshot/mod.rs changed 11 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is WorkspaceSnapshotKind::label_prefix at line 85), 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(runtime-api): review follow-ups for workspace, git and job paths”; “fix(tui): /undo waits for the post-turn snapshot and skips non-regular paths (#6644)”; “fix(receipts): report blocked calls as blocked, list shell file changes per turn”; “fix(runtime): bound undo to the turn's own tool spans; keep its restore points (#6621)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/snapshot/mod.rs`: 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: crates/tui/src/tools/js_execution.rs crates/tui/src/tools/js_execution.rs:52 — crates/tui/src/tools/js_execution.rs 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 9 (its worst body is codewhale_tui::tools::js_execution::node_proxy_env_overrides_from at line 52), 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: qualify 0.10.1 Engine and TypeScript integration”; “fix(tui): apply per-call execution policy to interpreter tools”; “fix(tools): review follow-ups for shell retention and contained child processes”; “fix(tools): shell job retention, output deltas, and child process lifetimes”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tools/js_execution.rs`: 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: crates/tui/plugins/computer-use/src/transport.mjs crates/tui/plugins/computer-use/src/transport.mjs:93 — crates/tui/plugins/computer-use/src/transport.mjs 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 11 (its worst body is transport.ensureSshChannel at line 93), 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(security): tighten approval, execution and endpoint boundaries for 0.10.1”; “fix(computer-use): report unknown outcomes and refuse ambiguous targets”; “fix(plugins): synchronize embedded Computer Use safety and Windows runtime”; “fix(cu): reconcile bound computer routes through dispatch failure”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/plugins/computer-use/src/transport.mjs`: 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: crates/tui/src/network_policy.rs crates/tui/src/network_policy.rs:724 — crates/tui/src/network_policy.rs changed 9 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 6 (its worst body is NetworkPolicyDecider::evaluate at line 724), 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(tui): a deny-by-default authority keeps the last word on allow”; “fix(tui): a resolved network authority is not the document's to widen”; “fix(tui): re-read the network policy so /network allow lands without a restart”; “fix(receipts): report blocked calls as blocked, list shell file changes per turn”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/network_policy.rs`: 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: crates/tui/src/runtime_api/jobs.rs crates/tui/src/runtime_api/jobs.rs:256 — crates/tui/src/runtime_api/jobs.rs changed 8 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 codewhale_tui::runtime_api::jobs::create_thread_job 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: “fix(session): stop three defects found on the 0.10.2 RC (CW-7466)”; “fix(sandbox): every local command path uses the session's configured sandbox”; “fix(runtime-api): launch jobs in the checked cwd, async push discovery, one .git rule”; “fix(runtime-api): review follow-ups for workspace, git and job paths”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/runtime_api/jobs.rs`: 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: crates/tui/src/runtime_api/terminal.rs crates/tui/src/runtime_api/terminal.rs:150 — crates/tui/src/runtime_api/terminal.rs changed 7 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is codewhale_tui::runtime_api::terminal::decode_bytes at line 150), 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(runtime-api): bound how many terminal route calls occupy blocking threads”; “fix(runtime-api): serve terminal routes off the runtime workers and advertise them only where they answer”; “fix(ci): keep the terminal request contract warning-free on the 501 builds”; “fix(ci): compile the non-Unix terminal stubs and list the sandbox row as an action”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/runtime_api/terminal.rs`: 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: crates/tui/src/tui/active_cell.rs crates/tui/src/tui/active_cell.rs:189 — crates/tui/src/tui/active_cell.rs changed 9 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is codewhale_tui::tui::active_cell::mark_running_as_interrupted at line 189), 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(tui): an interrupted tool reads stopped, not failed (#6931)”; “fix(CW-7087): preserve individual details in compact read groups [skip ci]”; “fix(tui): a shell command queued behind an approval says "queued", and card clocks start at execution”; “fix(tui): a shell card waiting on approval says so instead of "running (Ns)"”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 19:05:01 -07:00' --until='2026-10-25 19:05:01 -07:00' --full-history --no-merges -- crates/tui/src/tui/active_cell.rs`: 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.
  • + 44 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×69
  • Duplicated block (9 lines × 2) crates/app-server/src/lib.rs:3092 — crates/app-server/src/lib.rs:3092-3100 | crates/app-server/src/lib.rs:3103-3111 — both copies are in the same file, so extract the 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) REDACTED:6543 — REDACTED:6543-6551 | REDACTED:6558-6566 — both copies are in the same file, so extract the 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) crates/config/src/lib.rs:7321 — crates/config/src/lib.rs:7321-7329 | crates/tui/src/runtime_threads.rs:20727-20735 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) crates/lane/src/runtime.rs:260 — crates/lane/src/runtime.rs:260-268 | crates/lane/src/runtime.rs:393-401 — both copies are in the same file, so extract the 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) crates/telemetry/src/actor.rs:184 — crates/telemetry/src/actor.rs:184-192 | crates/telemetry/src/actor.rs:210-218 — both copies are in the same file, so extract the 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) crates/tui/src/automation_manager.rs:1344 — crates/tui/src/automation_manager.rs:1344-1352 | crates/tui/src/automation_manager.rs:1842-1850 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/tui/src/automation_manager.rs:1421 — crates/tui/src/automation_manager.rs:1421-1429 | crates/tui/src/model_profile.rs:332-340 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) crates/tui/src/client/provider_native_search.rs:551 — crates/tui/src/client/provider_native_search.rs:551-559 | crates/tui/src/client/provider_native_search/kimi.rs:273-281 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) crates/tui/src/client/provider_native_search/kimi.rs:67 — crates/tui/src/client/provider_native_search/kimi.rs:67-75 | crates/tui/src/client/provider_native_search/kimi.rs:145-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.
  • Duplicated block (9 lines × 2) crates/tui/src/commands/contract.rs:2807 — crates/tui/src/commands/contract.rs:2807-2815 | crates/tui/src/tui/ui/handlers.rs:1385-1393 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) crates/tui/src/commands/contract.rs:4485 — crates/tui/src/commands/contract.rs:4485-4493 | crates/tui/src/commands/contract.rs:4554-4562 — both copies are in the same file, so extract the 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) crates/tui/src/commands/groups/core/core.rs:190 — crates/tui/src/commands/groups/core/core.rs:190-198 | crates/tui/src/commands/groups/core/core.rs:302-310 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/tui/src/core/engine/compaction.rs:474 — crates/tui/src/core/engine/compaction.rs:474-482 | crates/tui/src/core/engine/compaction.rs:740-748 — both copies are in the same file, so extract the 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) crates/tui/src/core/engine/streaming.rs:723 — crates/tui/src/core/engine/streaming.rs:723-731 | crates/tui/src/core/engine/streaming.rs:745-753 — both copies are in the same file, so extract the 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) crates/tui/src/extension_host/registry.rs:1126 — crates/tui/src/extension_host/registry.rs:1126-1134 | crates/tui/src/extension_host/registry.rs:1251-1259 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/tui/src/hooks/executor.rs:2739 — crates/tui/src/hooks/executor.rs:2739-2747 | crates/tui/src/hooks/executor.rs:2760-2768 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_api.rs:11192 — crates/tui/src/runtime_api.rs:11192-11200 | crates/tui/src/runtime_api.rs:11226-11234 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_api.rs:12412 — crates/tui/src/runtime_api.rs:12412-12420 | crates/tui/src/tui/views/mod.rs:3894-3902 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) crates/tui/src/runtime_api/diagnostics.rs:182 — crates/tui/src/runtime_api/diagnostics.rs:182-190 | crates/tui/src/session_manager.rs:224-232 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) crates/tui/src/runtime_api/mcp_import.rs:30 — crates/tui/src/runtime_api/mcp_import.rs:30-38 | crates/tui/src/runtime_api/mcp_import.rs:77-85 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_chat_relay.rs:440 — crates/tui/src/runtime_chat_relay.rs:440-448 | crates/tui/src/runtime_chat_relay.rs:608-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.
  • Duplicated block (9 lines × 2) crates/tui/src/runtime_threads.rs:708 — crates/tui/src/runtime_threads.rs:708-716 | crates/tui/src/tui/tool_routing.rs:723-731 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) crates/tui/src/runtime_threads.rs:2725 — crates/tui/src/runtime_threads.rs:2725-2733 | crates/tui/src/runtime_threads.rs:2890-2898 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_threads.rs:2809 — crates/tui/src/runtime_threads.rs:2809-2817 | crates/tui/src/runtime_threads.rs:2953-2961 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_threads.rs:14197 — crates/tui/src/runtime_threads.rs:14197-14205 | crates/tui/src/runtime_threads.rs:14218-14226 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 44 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×62
  • Duplicated block (8 lines × 2) crates/app-server/src/lib.rs:797 — crates/app-server/src/lib.rs:797-804 | crates/app-server/src/lib.rs:829-836 — both copies are in the same file, so extract the 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) crates/commands/src/debug/change.rs:190 — crates/commands/src/debug/change.rs:190-197 | crates/commands/src/debug/change.rs:259-266 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) crates/config/src/private_directory.rs:1201 — crates/config/src/private_directory.rs:1201-1208 | crates/tui/src/tools/github/report.rs:1261-1268 — before extracting anything, compare `crates/config/src/private_directory.rs` and `crates/tui/src/tools/github/report.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 65 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 (8 lines × 2) crates/runtime/src/external_credentials.rs:523 — crates/runtime/src/external_credentials.rs:523-530 | crates/tui/src/tools/github/report.rs:1300-1307 — before extracting anything, compare `crates/runtime/src/external_credentials.rs` and `crates/tui/src/tools/github/report.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) crates/state/src/lib.rs:1005 — crates/state/src/lib.rs:1005-1012 | crates/state/src/lib.rs:1227-1234 — both copies are in the same file, so extract the 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) crates/tui/src/acp_server.rs:395 — crates/tui/src/acp_server.rs:395-402 | crates/tui/src/acp_server.rs:506-513 — both copies are in the same file, so extract the 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) crates/tui/src/automation_manager.rs:3108 — crates/tui/src/automation_manager.rs:3108-3115 | crates/tui/src/task_manager.rs:3893-3900 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) crates/tui/src/commands/contract.rs:458 — crates/tui/src/commands/contract.rs:458-465 | crates/tui/src/tui/prompt_suggestion.rs:484-491 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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) crates/tui/src/commands/groups/core/agent.rs:48 — crates/tui/src/commands/groups/core/agent.rs:48-55 | crates/tui/src/commands/groups/core/rlm.rs:33-40 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) crates/tui/src/config.rs:12000 — crates/tui/src/config.rs:12000-12007 | crates/tui/src/config.rs:12074-12081 — both copies are in the same file, so extract the 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) crates/tui/src/core/engine/tool_catalog.rs:855 — crates/tui/src/core/engine/tool_catalog.rs:855-862 | crates/tui/src/core/engine/tool_catalog.rs:922-929 — both copies are in the same file, so extract the 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) crates/tui/src/delivery_files.rs:132 — crates/tui/src/delivery_files.rs:132-139 | crates/tui/src/delivery_files.rs:167-174 — both copies are in the same file, so extract the 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) crates/tui/src/fleet/profile.rs:636 — crates/tui/src/fleet/profile.rs:636-643 | crates/tui/src/fleet/profile.rs:661-668 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) crates/tui/src/plugins/manifest.rs:1751 — crates/tui/src/plugins/manifest.rs:1751-1758 | crates/tui/src/plugins/manifest.rs:1765-1772 — both copies are in the same file, so extract the 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) crates/tui/src/plugins/registry.rs:754 — crates/tui/src/plugins/registry.rs:754-761 | crates/tui/src/plugins/registry/gc.rs:847-854 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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) crates/tui/src/runtime_api.rs:4501 — crates/tui/src/runtime_api.rs:4501-4508 | crates/tui/src/runtime_api.rs:4521-4528 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_api/diagnostics.rs:108 — crates/tui/src/runtime_api/diagnostics.rs:108-115 | crates/tui/src/runtime_api/diagnostics.rs:280-287 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_threads.rs:10004 — crates/tui/src/runtime_threads.rs:10004-10011 | crates/tui/src/runtime_threads.rs:10082-10089 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_threads.rs:11639 — crates/tui/src/runtime_threads.rs:11639-11646 | crates/tui/src/runtime_threads.rs:11694-11701 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_threads.rs:12006 — crates/tui/src/runtime_threads.rs:12006-12014 | crates/tui/src/runtime_threads.rs:12018-12025 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_threads.rs:12189 — crates/tui/src/runtime_threads.rs:12189-12196 | crates/tui/src/runtime_threads.rs:17731-17738 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_threads.rs:12424 — crates/tui/src/runtime_threads.rs:12424-12431 | crates/tui/src/runtime_threads.rs:12551-12558 — both copies are in the same file, so extract the 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) crates/tui/src/tools/automation.rs:302 — crates/tui/src/tools/automation.rs:302-309 | crates/tui/src/tools/tasks.rs:385-392 — before extracting anything, compare `crates/tui/src/tools/automation.rs` and `crates/tui/src/tools/tasks.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) REDACTED:1178 — REDACTED:1178-1185 | REDACTED:1283-1290 — both copies are in the same file, so extract the 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) crates/tui/src/tools/read_media.rs:934 — crates/tui/src/tools/read_media.rs:934-941 | crates/tui/src/tools/read_media.rs:963-970 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 37 more in this group — see findings.md.
D3 · God Classes · ClassTooLong · ×58
  • ClassTooLong: Engine crates/tui/src/core/engine.rs:994 — ClassTooLong — 5046 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 246 methods, 2 blocks, lines 994-9285. The bar is 400 significant lines; this is 4646 over it, 12.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: SubAgentManager crates/tui/src/tools/subagent/mod.rs:3878 — ClassTooLong — 4079 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 184 methods, 2 blocks, lines 3878-10175. The bar is 400 significant lines; this is 3679 over it, 10.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ProviderPickerView crates/tui/src/tui/provider_picker.rs:190 — ClassTooLong — 2602 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 95 methods, 3 blocks, lines 190-5450. The bar is 400 significant lines; this is 2202 over it, 6.51× 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: ConfigView crates/tui/src/tui/views/mod.rs:2182 — ClassTooLong — 2074 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 51 methods, 5 blocks, lines 2182-5818. The bar is 400 significant lines; this is 1674 over it, 5.19× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SessionManager crates/tui/src/session_manager.rs:1555 — ClassTooLong — 1702 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 115 methods, 2 blocks, lines 1555-4485. The bar is 400 significant lines; this is 1302 over it, 4.26× 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: FleetManager crates/tui/src/fleet/manager.rs:39 — ClassTooLong — 1539 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 59 methods, 3 blocks, lines 39-2333. The bar is 400 significant lines; this is 1139 over it, 3.85× 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: ModelPickerView crates/tui/src/tui/model_picker.rs:211 — ClassTooLong — 1453 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 48 methods, 6 blocks, lines 211-4777. The bar is 400 significant lines; this is 1053 over it, 3.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: RemoteControlController crates/tui/src/remote_control.rs:797 — ClassTooLong — 1441 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 70 methods, 4 blocks, lines 797-2966. The bar is 400 significant lines; this is 1041 over it, 3.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: FleetSetupView crates/tui/src/tui/views/fleet_setup.rs:717 — ClassTooLong — 1396 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 55 methods, 4 blocks, lines 717-2775. The bar is 400 significant lines; this is 996 over it, 3.49× 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: SetupWizardView crates/tui/src/tui/setup/mod.rs:160 — ClassTooLong — 1376 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 72 methods, 4 blocks, lines 160-4200. The bar is 400 significant lines; this is 976 over it, 3.44× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ShellManager crates/tui/src/tools/shell.rs:1925 — ClassTooLong — 1099 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 49 methods, 3 blocks, lines 1925-3780. The bar is 400 significant lines; this is 699 over it, 2.75× 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: BashTool crates/tui/src/tools/shell.rs:5634 — ClassTooLong — 1098 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 8 methods, 4 blocks, lines 5634-7205. The bar is 400 significant lines; this is 698 over it, 2.75× 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: OwnerRegistry crates/tui/src/extension_host/registry.rs:240 — ClassTooLong — 1097 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 49 methods, 2 blocks, lines 240-1782. The bar is 400 significant lines; this is 697 over it, 2.74× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ExtensionHostManager crates/tui/src/extension_host/mod.rs:1396 — ClassTooLong — 1009 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 47 methods, 3 blocks, lines 1396-3614. The bar is 400 significant lines; this is 609 over it, 2.52× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: WorkflowPanel crates/tui/src/tui/widgets/workflow_panel.rs:658 — ClassTooLong — 999 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 30 methods, 2 blocks, lines 658-2057. The bar is 400 significant lines; this is 599 over it, 2.50× 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: Settings crates/tui/src/settings.rs:243 — ClassTooLong — 963 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 30 methods, 4 blocks, lines 243-2178. The bar is 400 significant lines; this is 563 over it, 2.41× 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: ConfigToml crates/config/src/lib.rs:891 — ClassTooLong — 841 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 25 methods, 5 blocks, lines 891-7221. The bar is 400 significant lines; this is 441 over it, 2.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.
  • ClassTooLong: FleetDetailView crates/tui/src/tui/views/fleet_detail.rs:95 — ClassTooLong — 823 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 34 methods, 4 blocks, lines 95-1272. The bar is 400 significant lines; this is 423 over it, 2.06× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: WebSearchTool crates/tui/src/tools/web_search.rs:565 — ClassTooLong — 816 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 11 methods, 2 blocks, lines 568-1700. The bar is 400 significant lines; this is 416 over it, 2.04× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AutomationManager crates/tui/src/automation_manager.rs:1055 — ClassTooLong — 813 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 54 methods, 2 blocks, lines 1055-2269. The bar is 400 significant lines; this is 413 over it, 2.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SubAgentWorkflowDriver crates/tui/src/tools/workflow/mod.rs:3914 — ClassTooLong — 795 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 28 methods, 4 blocks, lines 3914-5137. The bar is 400 significant lines; this is 395 over it, 1.99× 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: StateStore crates/state/src/lib.rs:251 — ClassTooLong — 794 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 35 methods, 2 blocks, lines 251-1693. The bar is 400 significant lines; this is 394 over it, 1.99× 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: SessionPickerView crates/tui/src/tui/session_picker.rs:119 — ClassTooLong — 715 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 34 methods, 3 blocks, lines 119-1281. The bar is 400 significant lines; this is 315 over it, 1.79× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AutomationEditor crates/tui/src/tui/views/automations/editor.rs:319 — ClassTooLong — 708 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 23 methods, 2 blocks, lines 319-1236. The bar is 400 significant lines; this is 308 over it, 1.77× 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: CoordinationLedger crates/tui/src/tools/subagent/coord/ledger.rs:392 — ClassTooLong — 676 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 11 methods, 3 blocks, lines 392-1301. The bar is 400 significant lines; this is 276 over it, 1.69× 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.
  • + 33 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×54
  • Duplicated block (6 lines × 2) crates/command-contract/src/types.rs:29 — crates/command-contract/src/types.rs:29-34 | crates/config/src/app_mode.rs:25-34 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) crates/commands/src/debug/change.rs:235 — crates/commands/src/debug/change.rs:235-240 | crates/commands/src/debug/change.rs:350-355 — both copies are in the same file, so extract the 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) crates/core/src/tool_parser.rs:167 — crates/core/src/tool_parser.rs:167-172 | crates/core/src/tool_parser.rs:183-188 — both copies are in the same file, so extract the 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) crates/tui/src/client/chat.rs:3178 — crates/tui/src/client/chat.rs:3178-3183 | crates/tui/src/client/chat.rs:3198-3203 — both copies are in the same file, so extract the 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) crates/tui/src/commands/contract.rs:3259 — crates/tui/src/commands/contract.rs:3259-3264 | crates/tui/src/commands/contract.rs:3280-3285 — both copies are in the same file, so extract the 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) crates/tui/src/commands/groups/config/config.rs:1409 — crates/tui/src/commands/groups/config/config.rs:1409-1414 | crates/tui/src/commands/groups/config/config.rs:1441-1446 — both copies are in the same file, so extract the 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) crates/tui/src/config.rs:8156 — crates/tui/src/config.rs:8156-8162 | crates/tui/src/config.rs:8164-8169 — both copies are in the same file, so extract the 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) crates/tui/src/config.rs:8242 — crates/tui/src/config.rs:8242-8247 | crates/tui/src/config.rs:8359-8364 — both copies are in the same file, so extract the 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) crates/tui/src/config.rs:11854 — crates/tui/src/config.rs:11854-11859 | crates/tui/src/config.rs:11886-11891 — both copies are in the same file, so extract the 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) crates/tui/src/core/engine/approval.rs:325 — crates/tui/src/core/engine/approval.rs:325-332 | crates/tui/src/core/engine/approval.rs:490-495 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/tui/src/extension_host/windows.rs:1360 — crates/tui/src/extension_host/windows.rs:1360-1365 | crates/tui/src/extension_host/windows.rs:1478-1483 — both copies are in the same file, so extract the 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) crates/tui/src/fleet/manager.rs:491 — crates/tui/src/fleet/manager.rs:491-496 | crates/tui/src/fleet/manager.rs:582-591 — both copies are in the same file, so extract the 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) crates/tui/src/oauth.rs:4053 — crates/tui/src/oauth.rs:4053-4058 | crates/tui/src/oauth.rs:4267-4272 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_api.rs:4700 — crates/tui/src/runtime_api.rs:4700-4705 | crates/tui/src/runtime_api.rs:4722-4727 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_api.rs:7228 — crates/tui/src/runtime_api.rs:7228-7233 | crates/tui/src/runtime_api.rs:7269-7274 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_api/sessions.rs:157 — crates/tui/src/runtime_api/sessions.rs:157-162 | crates/tui/src/runtime_api/sessions.rs:187-192 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_threads.rs:8731 — crates/tui/src/runtime_threads.rs:8731-8736 | crates/tui/src/runtime_threads.rs:8744-8749 — both copies are in the same file, so extract the 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) crates/tui/src/session_manager.rs:2414 — crates/tui/src/session_manager.rs:2414-2419 | crates/tui/src/session_manager.rs:2510-2515 — both copies are in the same file, so extract the 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) crates/tui/src/session_reconcile.rs:302 — crates/tui/src/session_reconcile.rs:302-307 | crates/tui/src/session_reconcile.rs:454-459 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/tui/src/skills/mutation.rs:621 — crates/tui/src/skills/mutation.rs:621-626 | crates/tui/src/skills/mutation.rs:630-635 — both copies are in the same file, so extract the 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) crates/tui/src/tools/git.rs:226 — crates/tui/src/tools/git.rs:226-231 | crates/tui/src/tools/git_history.rs:112-117 — before extracting anything, compare `crates/tui/src/tools/git.rs` and `crates/tui/src/tools/git_history.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) crates/tui/src/tools/plan.rs:300 — crates/tui/src/tools/plan.rs:300-305 | crates/tui/src/tools/plan.rs:527-532 — both copies are in the same file, so extract the 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) crates/tui/src/tools/subagent/coord.rs:968 — crates/tui/src/tools/subagent/coord.rs:968-973 | crates/tui/src/tools/subagent/coord.rs:999-1004 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/tui/src/tools/web_search.rs:3145 — crates/tui/src/tools/web_search.rs:3145-3150 | crates/tui/src/tools/web_search.rs:3211-3216 — both copies are in the same file, so extract the 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) crates/tui/src/tui/file_mention.rs:426 — crates/tui/src/tui/file_mention.rs:426-432 | crates/tui/src/tui/slash_menu.rs:299-304 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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.
  • + 29 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×53
  • Duplicated block (10 lines × 2) crates/app-server/src/lib.rs:2531 — crates/app-server/src/lib.rs:2531-2540 | crates/app-server/src/lib.rs:2601-2610 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/config/src/config_document.rs:562 — crates/config/src/config_document.rs:562-571 | crates/tui/src/config_persistence.rs:469-478 — before extracting anything, compare `crates/config/src/config_document.rs` and `crates/tui/src/config_persistence.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) crates/config/src/lib.rs:5188 — crates/config/src/lib.rs:5188-5197 | crates/tui/src/config.rs:9840-9849 — before extracting anything, compare `crates/config/src/lib.rs` and `crates/tui/src/config.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 171 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) crates/execpolicy/src/shell_expand.rs:1793 — crates/execpolicy/src/shell_expand.rs:1793-1802 | crates/execpolicy/src/shell_expand.rs:1809-1818 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/tui/src/commands/config_main_host.rs:1848 — crates/tui/src/commands/config_main_host.rs:1848-1857 | crates/tui/src/commands/config_main_host.rs:1876-1885 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/tui/src/commands/contract.rs:1230 — crates/tui/src/commands/contract.rs:1230-1239 | crates/tui/src/commands/contract.rs:1404-1413 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/tui/src/commands/contract.rs:4236 — crates/tui/src/commands/contract.rs:4236-4245 | crates/tui/src/commands/contract.rs:4272-4281 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/tui/src/core/engine.rs:5293 — crates/tui/src/core/engine.rs:5293-5309 | crates/tui/src/core/engine/turn_loop.rs:5635-5644 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) crates/tui/src/cost_status.rs:2397 — crates/tui/src/cost_status.rs:2397-2406 | crates/tui/src/cost_status.rs:2483-2492 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/tui/src/exec_agent.rs:718 — crates/tui/src/exec_agent.rs:718-727 | crates/tui/src/runtime_threads.rs:16711-16720 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (10 lines × 2) crates/tui/src/extension_host/mod.rs:2539 — crates/tui/src/extension_host/mod.rs:2539-2550 | crates/tui/src/extension_host/mod.rs:2579-2588 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/tui/src/fleet/control.rs:81 — crates/tui/src/fleet/control.rs:81-90 | crates/tui/src/runtime_api.rs:5032-5041 — before extracting anything, compare `crates/tui/src/fleet/control.rs` and `crates/tui/src/runtime_api.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) REDACTED:357 — REDACTED:357-366 | REDACTED:402-411 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/tui/src/hooks/executor.rs:2069 — crates/tui/src/hooks/executor.rs:2069-2083 | crates/tui/src/hooks/executor.rs:2145-2154 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/tui/src/hooks/executor.rs:2590 — crates/tui/src/hooks/executor.rs:2590-2599 | crates/tui/src/hooks/executor.rs:2616-2625 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/tui/src/model_routing.rs:1870 — crates/tui/src/model_routing.rs:1870-1879 | crates/tui/src/model_routing.rs:1904-1913 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/tui/src/plugins/registry.rs:542 — crates/tui/src/plugins/registry.rs:542-551 | crates/tui/src/plugins/registry.rs:626-635 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/tui/src/provider_readiness.rs:746 — crates/tui/src/provider_readiness.rs:746-755 | crates/tui/src/provider_readiness.rs:762-771 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/tui/src/runtime_api.rs:4266 — crates/tui/src/runtime_api.rs:4266-4275 | crates/tui/src/runtime_api.rs:4612-4621 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/tui/src/runtime_api.rs:6495 — crates/tui/src/runtime_api.rs:6495-6504 | crates/tui/src/runtime_api.rs:6529-6538 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/tui/src/runtime_api.rs:6602 — crates/tui/src/runtime_api.rs:6602-6611 | crates/tui/src/runtime_api.rs:6752-6761 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/tui/src/runtime_api/plugins.rs:704 — crates/tui/src/runtime_api/plugins.rs:704-713 | crates/tui/src/runtime_api/plugins.rs:737-746 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/tui/src/runtime_threads.rs:6134 — crates/tui/src/runtime_threads.rs:6134-6143 | crates/tui/src/runtime_threads.rs:6154-6163 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/tui/src/runtime_threads.rs:14207 — crates/tui/src/runtime_threads.rs:14207-14216 | crates/tui/src/runtime_threads.rs:14228-14237 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/tui/src/tools/apply_patch.rs:1328 — crates/tui/src/tools/apply_patch.rs:1328-1337 | crates/tui/src/tools/apply_patch.rs:1394-1403 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 28 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×50
  • Duplicated block (11 lines × 2) crates/config/src/lib.rs:7386 — crates/config/src/lib.rs:7386-7396 | crates/config/src/lib.rs:7401-7411 — both copies are in the same file, so extract the 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) crates/config/src/xai_credentials.rs:436 — crates/config/src/xai_credentials.rs:436-446 | crates/config/src/xai_credentials.rs:491-501 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) crates/core/src/fragments.rs:62 — crates/core/src/fragments.rs:62-72 | crates/runtime/src/model_context/fragment.rs:64-74 — before extracting anything, compare `crates/core/src/fragments.rs` and `crates/runtime/src/model_context/fragment.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 68 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (11 lines × 2) crates/execpolicy/src/lib.rs:1030 — crates/execpolicy/src/lib.rs:1030-1040 | crates/execpolicy/src/shell_expand.rs:1858-1868 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (11 lines × 2) crates/runtime/src/skill_state.rs:254 — crates/runtime/src/skill_state.rs:254-264 | crates/tui/src/automation_manager.rs:1074-1084 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) crates/tui/src/commands/contract.rs:1216 — crates/tui/src/commands/contract.rs:1216-1226 | crates/tui/src/commands/contract.rs:1390-1400 — both copies are in the same file, so extract the 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) crates/tui/src/commands/groups/plugins/mod.rs:466 — crates/tui/src/commands/groups/plugins/mod.rs:466-476 | crates/tui/src/commands/groups/plugins/mod.rs:641-651 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) crates/tui/src/config.rs:3282 — crates/tui/src/config.rs:3282-3292 | crates/tui/src/tui/provider_picker.rs:1807-1817 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) crates/tui/src/core/engine/turn_loop.rs:1700 — crates/tui/src/core/engine/turn_loop.rs:1700-1710 | crates/tui/src/core/engine/turn_loop.rs:1713-1723 — both copies are in the same file, so extract the 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) crates/tui/src/eval.rs:530 — crates/tui/src/eval.rs:530-540 | crates/tui/src/eval.rs:626-636 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) crates/tui/src/fleet/manager.rs:1875 — crates/tui/src/fleet/manager.rs:1875-1885 | crates/tui/src/fleet/manager.rs:2014-2024 — both copies are in the same file, so extract the 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) crates/tui/src/lsp/registry.rs:34 — crates/tui/src/lsp/registry.rs:34-44 | crates/tui/src/lsp/registry.rs:54-64 — both copies are in the same file, so extract the 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) crates/tui/src/oauth.rs:3658 — crates/tui/src/oauth.rs:3658-3668 | crates/tui/src/oauth.rs:3705-3715 — both copies are in the same file, so extract the 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) crates/tui/src/operate.rs:604 — crates/tui/src/operate.rs:604-614 | crates/tui/src/operate.rs:621-631 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) crates/tui/src/plugins/export.rs:330 — crates/tui/src/plugins/export.rs:330-340 | crates/tui/src/tools/subagent/mod.rs:10778-10788 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) crates/tui/src/project_context.rs:1619 — crates/tui/src/project_context.rs:1619-1629 | crates/tui/src/project_context.rs:1668-1678 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_api.rs:5394 — crates/tui/src/runtime_api.rs:5394-5404 | crates/tui/src/runtime_api.rs:5435-5445 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_threads.rs:9611 — crates/tui/src/runtime_threads.rs:9611-9621 | crates/tui/src/runtime_threads.rs:9862-9872 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_threads.rs:16400 — crates/tui/src/runtime_threads.rs:16400-16410 | crates/tui/src/runtime_threads.rs:16418-16428 — both copies are in the same file, so extract the 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) crates/tui/src/session_manager.rs:3904 — crates/tui/src/session_manager.rs:3904-3914 | crates/tui/src/session_manager.rs:3962-3972 — both copies are in the same file, so extract the 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) crates/tui/src/tools/automation.rs:195 — crates/tui/src/tools/automation.rs:195-205 | crates/tui/src/tools/tasks.rs:241-251 — before extracting anything, compare `crates/tui/src/tools/automation.rs` and `crates/tui/src/tools/tasks.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) crates/tui/src/tools/automation.rs:245 — crates/tui/src/tools/automation.rs:245-255 | crates/tui/src/tools/tasks.rs:322-332 — before extracting anything, compare `crates/tui/src/tools/automation.rs` and `crates/tui/src/tools/tasks.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) crates/tui/src/tools/git_history.rs:244 — crates/tui/src/tools/git_history.rs:244-254 | crates/tui/src/tools/git_history.rs:383-393 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) crates/tui/src/tools/github/shape.rs:163 — crates/tui/src/tools/github/shape.rs:163-173 | crates/tui/src/tools/tasks.rs:1350-1360 — before extracting anything, compare `crates/tui/src/tools/github/shape.rs` and `crates/tui/src/tools/tasks.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 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 (11 lines × 2) crates/tui/src/tools/subagent/coord.rs:919 — crates/tui/src/tools/subagent/coord.rs:919-929 | crates/tui/src/tools/subagent/mod.rs:12579-12589 — before extracting anything, compare `crates/tui/src/tools/subagent/coord.rs` and `crates/tui/src/tools/subagent/mod.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • + 25 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×45
  • Duplicated block (7 lines × 2) crates/commands/src/debug/tokens.rs:159 — crates/commands/src/debug/tokens.rs:159-165 | crates/commands/src/debug/tokens.rs:211-217 — both copies are in the same file, so extract the 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) crates/config/src/lib.rs:4797 — crates/config/src/lib.rs:4797-4803 | crates/tui/src/config.rs:9171-9177 — before extracting anything, compare `crates/config/src/lib.rs` and `crates/tui/src/config.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 171 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) crates/config/src/windows_identity.rs:29 — crates/config/src/windows_identity.rs:29-35 | crates/tui/src/tools/github/report.rs:1308-1315 — before extracting anything, compare `crates/config/src/windows_identity.rs` and `crates/tui/src/tools/github/report.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) crates/core/src/fragments.rs:332 — crates/core/src/fragments.rs:332-338 | crates/core/src/fragments.rs:346-355 — both copies are in the same file, so extract the 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) crates/memory/src/store.rs:683 — crates/memory/src/store.rs:683-689 | crates/memory/src/store.rs:698-704 — both copies are in the same file, so extract the 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) crates/tui/src/client/anthropic.rs:843 — crates/tui/src/client/anthropic.rs:843-849 | crates/tui/src/client/responses.rs:792-798 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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) crates/tui/src/commands/groups/session/color.rs:40 — crates/tui/src/commands/groups/session/color.rs:40-46 | crates/tui/src/commands/groups/session/remote_env.rs:47-53 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (7 lines × 2) crates/tui/src/config.rs:3362 — crates/tui/src/config.rs:3362-3368 | crates/tui/src/config.rs:3476-3482 — both copies are in the same file, so extract the 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) crates/tui/src/fleet/control.rs:125 — crates/tui/src/fleet/control.rs:125-131 | crates/tui/src/runtime_api.rs:5086-5092 — before extracting anything, compare `crates/tui/src/fleet/control.rs` and `crates/tui/src/runtime_api.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 84 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) crates/tui/src/fleet/ledger.rs:860 — crates/tui/src/fleet/ledger.rs:860-866 | crates/tui/src/fleet/ledger.rs:1034-1040 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/tui/src/fleet/manager.rs:1306 — crates/tui/src/fleet/manager.rs:1306-1312 | crates/tui/src/fleet/manager.rs:1473-1479 — both copies are in the same file, so extract the 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) crates/tui/src/mcp/process_broker.rs:342 — crates/tui/src/mcp/process_broker.rs:342-348 | crates/tui/src/repl/runtime.rs:319-325 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) crates/tui/src/plugins/recommend.rs:170 — crates/tui/src/plugins/recommend.rs:170-176 | crates/tui/src/plugins/recommend.rs:317-323 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/tui/src/plugins/registry.rs:515 — crates/tui/src/plugins/registry.rs:515-521 | crates/tui/src/plugins/registry.rs:702-708 — both copies are in the same file, so extract the 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) crates/tui/src/provider_catalog_live.rs:1189 — crates/tui/src/provider_catalog_live.rs:1189-1195 | crates/tui/src/provider_catalog_live.rs:1247-1253 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_api.rs:6933 — crates/tui/src/runtime_api.rs:6933-6939 | crates/tui/src/runtime_api.rs:6963-6969 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_api.rs:11440 — crates/tui/src/runtime_api.rs:11440-11446 | crates/tui/src/runtime_api.rs:11516-11522 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_api/mobile.rs:264 — crates/tui/src/runtime_api/mobile.rs:264-270 | crates/tui/src/runtime_api/web.rs:291-297 — before extracting anything, compare `crates/tui/src/runtime_api/mobile.rs` and `crates/tui/src/runtime_api/web.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) crates/tui/src/tools/automation.rs:348 — crates/tui/src/tools/automation.rs:348-354 | crates/tui/src/tools/automation.rs:469-475 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/tui/src/tools/git_history.rs:236 — crates/tui/src/tools/git_history.rs:236-242 | crates/tui/src/tools/git_history.rs:375-381 — both copies are in the same file, so extract the 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) crates/tui/src/tools/shell.rs:6794 — crates/tui/src/tools/shell.rs:6794-6800 | crates/tui/src/tools/shell.rs:6873-6879 — both copies are in the same file, so extract the 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) crates/tui/src/tools/shell.rs:7089 — crates/tui/src/tools/shell.rs:7089-7095 | crates/tui/src/tools/shell.rs:7419-7425 — both copies are in the same file, so extract the 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) crates/tui/src/tools/tasks.rs:886 — crates/tui/src/tools/tasks.rs:886-892 | crates/tui/src/tools/tasks.rs:906-912 — both copies are in the same file, so extract the 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) crates/tui/src/tui/markdown_render.rs:1745 — crates/tui/src/tui/markdown_render.rs:1745-1751 | crates/tui/src/tui/markdown_render.rs:1800-1806 — both copies are in the same file, so extract the 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) crates/tui/src/tui/mouse_ui.rs:2244 — crates/tui/src/tui/mouse_ui.rs:2244-2250 | crates/tui/src/tui/mouse_ui.rs:2295-2301 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 20 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×44
  • Duplicated block (12 lines × 2) crates/app-server/src/lib.rs:1363 — crates/app-server/src/lib.rs:1363-1374 | crates/tui/src/runtime_api.rs:13189-13200 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (12 lines × 2) crates/lane/src/registry.rs:328 — crates/lane/src/registry.rs:328-339 | crates/lane/src/registry.rs:430-441 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) crates/tui/src/core/engine/compaction.rs:686 — crates/tui/src/core/engine/compaction.rs:686-697 | crates/tui/src/core/engine/compaction.rs:895-906 — both copies are in the same file, so extract the 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) crates/tui/src/core/engine/compaction.rs:961 — crates/tui/src/core/engine/compaction.rs:961-972 | crates/tui/src/core/engine/compaction.rs:977-988 — both copies are in the same file, so extract the 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) crates/tui/src/core/engine/tool_setup.rs:88 — crates/tui/src/core/engine/tool_setup.rs:88-100 | crates/tui/src/core/engine/tool_setup.rs:163-174 — both copies are in the same file, so extract the 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) crates/tui/src/core/engine/turn_loop.rs:1686 — crates/tui/src/core/engine/turn_loop.rs:1686-1698 | crates/tui/src/core/engine/turn_loop.rs:1700-1711 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) crates/tui/src/extension_host/core_call.rs:478 — crates/tui/src/extension_host/core_call.rs:478-489 | crates/tui/src/extension_host/core_call.rs:506-517 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) crates/tui/src/hooks/executor.rs:2666 — crates/tui/src/hooks/executor.rs:2666-2677 | crates/tui/src/hooks/executor.rs:2697-2708 — both copies are in the same file, so extract the 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) crates/tui/src/plugins/marketplace/parsers/claude.rs:251 — crates/tui/src/plugins/marketplace/parsers/claude.rs:251-262 | crates/tui/src/plugins/marketplace/parsers/kimi.rs:163-174 — before extracting anything, compare `crates/tui/src/plugins/marketplace/parsers/claude.rs` and `crates/tui/src/plugins/marketplace/parsers/kimi.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) crates/tui/src/plugins/marketplace/parsers/claude.rs:473 — crates/tui/src/plugins/marketplace/parsers/claude.rs:473-484 | crates/tui/src/plugins/marketplace/parsers/codex.rs:311-322 — before extracting anything, compare `crates/tui/src/plugins/marketplace/parsers/claude.rs` and `crates/tui/src/plugins/marketplace/parsers/codex.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 93 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) crates/tui/src/provider_catalog_live.rs:1849 — crates/tui/src/provider_catalog_live.rs:1849-1860 | crates/tui/src/provider_catalog_live.rs:1932-1943 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_api.rs:5573 — crates/tui/src/runtime_api.rs:5573-5584 | crates/tui/src/tui/ui/handlers.rs:1386-1397 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (12 lines × 2) crates/tui/src/runtime_api.rs:9692 — crates/tui/src/runtime_api.rs:9692-9703 | crates/tui/src/runtime_api.rs:9782-9793 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_api/mobile.rs:162 — crates/tui/src/runtime_api/mobile.rs:162-173 | crates/tui/src/runtime_api/mobile.rs:187-198 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) crates/tui/src/runtime_api/plans.rs:312 — crates/tui/src/runtime_api/plans.rs:312-323 | crates/tui/src/runtime_api/plans.rs:345-356 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) crates/tui/src/tui/approval/elevation.rs:232 — crates/tui/src/tui/approval/elevation.rs:232-243 | crates/tui/src/tui/approval/view.rs:426-437 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) crates/tui/src/tui/history/latex_render.rs:1195 — crates/tui/src/tui/history/latex_render.rs:1195-1206 | crates/tui/src/tui/history/latex_render.rs:1227-1238 — both copies are in the same file, so extract the 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) crates/tui/src/tui/markdown_render.rs:285 — crates/tui/src/tui/markdown_render.rs:285-296 | crates/tui/src/tui/markdown_render.rs:514-525 — both copies are in the same file, so extract the 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) crates/tui/src/tui/ui/event_loop.rs:7380 — crates/tui/src/tui/ui/event_loop.rs:7380-7391 | crates/tui/src/tui/ui/event_loop.rs:7392-7403 — both copies are in the same file, so extract the 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) crates/tui/src/tui/views/automations.rs:613 — crates/tui/src/tui/views/automations.rs:613-624 | crates/tui/src/tui/views/workflows_manager.rs:393-404 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) crates/tui/src/tui/widgets/composer_legacy.rs:372 — crates/tui/src/tui/widgets/composer_legacy.rs:372-383 | crates/tui/src/tui/widgets/composer_legacy.rs:413-424 — both copies are in the same file, so extract the 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) crates/tui/src/tui/widgets/mod.rs:1018 — crates/tui/src/tui/widgets/mod.rs:1018-1029 | crates/tui/src/tui/widgets/transcript_legacy.rs:923-934 — before extracting anything, compare `crates/tui/src/tui/widgets/mod.rs` and `crates/tui/src/tui/widgets/transcript_legacy.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 778 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) crates/core/src/fragments.rs:48 — crates/core/src/fragments.rs:48-59 | crates/runtime/src/model_context/fragment.rs:49-60 — before extracting anything, compare `crates/core/src/fragments.rs` and `crates/runtime/src/model_context/fragment.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 68 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) crates/core/src/fragments.rs:74 — crates/core/src/fragments.rs:74-85 | crates/runtime/src/model_context/fragment.rs:77-88 — before extracting anything, compare `crates/core/src/fragments.rs` and `crates/runtime/src/model_context/fragment.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 68 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) REDACTED:1709 — REDACTED:1709-1720 | crates/tui/src/fleet/manager.rs:2797-2808 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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.
  • + 19 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×43
  • Duplicated block (5 lines × 2) crates/app-server/src/thread_control.rs:636 — crates/app-server/src/thread_control.rs:636-643 | crates/app-server/src/thread_control.rs:1081-1085 — both copies are in the same file, so extract the 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) crates/config/src/lib.rs:5204 — crates/config/src/lib.rs:5204-5208 | crates/tui/src/config.rs:9856-9860 — before extracting anything, compare `crates/config/src/lib.rs` and `crates/tui/src/config.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 171 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 (5 lines × 2) crates/config/src/resolve.rs:95 — crates/config/src/resolve.rs:95-99 | crates/config/src/resolve.rs:114-118 — both copies are in the same file, so extract the 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) crates/config/src/user_constitution.rs:1335 — crates/config/src/user_constitution.rs:1335-1339 | crates/protocol/src/display.rs:126-130 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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) crates/tui/src/commands/config_host.rs:467 — crates/tui/src/commands/config_host.rs:467-471 | crates/tui/src/commands/groups/config/config.rs:164-168 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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) crates/tui/src/commands/mod.rs:513 — crates/tui/src/commands/mod.rs:513-518 | crates/tui/src/core/engine/tool_catalog.rs:988-992 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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) crates/tui/src/cost_status.rs:1435 — crates/tui/src/cost_status.rs:1435-1439 | crates/tui/src/cost_status.rs:1497-1504 — both copies are in the same file, so extract the 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) crates/tui/src/extension_host/avatars.rs:137 — crates/tui/src/extension_host/avatars.rs:137-141 | crates/tui/src/extension_host/native_mcp.rs:147-153 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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) crates/tui/src/git_status.rs:327 — crates/tui/src/git_status.rs:327-331 | crates/tui/src/runtime_api/workspace.rs:241-245 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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) crates/tui/src/model_inventory.rs:740 — crates/tui/src/model_inventory.rs:740-744 | crates/tui/src/model_inventory.rs:758-762 — both copies are in the same file, so extract the 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) crates/tui/src/plugins/install/mod.rs:606 — crates/tui/src/plugins/install/mod.rs:606-610 | crates/tui/src/skills/install.rs:552-556 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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) crates/tui/src/plugins/install/tarball.rs:179 — crates/tui/src/plugins/install/tarball.rs:179-183 | crates/tui/src/skills/install.rs:1560-1566 — before extracting anything, compare `crates/tui/src/plugins/install/tarball.rs` and `crates/tui/src/skills/install.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 60 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 (5 lines × 2) crates/tui/src/plugins/manifest.rs:1713 — crates/tui/src/plugins/manifest.rs:1713-1717 | crates/tui/src/plugins/registry.rs:1709-1713 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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) crates/tui/src/plugins/marketplace/parsers/codex.rs:344 — crates/tui/src/plugins/marketplace/parsers/codex.rs:344-348 | crates/tui/src/plugins/marketplace/parsers/kimi.rs:262-266 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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) crates/tui/src/plugins/providers.rs:186 — crates/tui/src/plugins/providers.rs:186-194 | crates/tui/src/tui/ui/event_loop.rs:7746-7750 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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) crates/tui/src/remote_control.rs:3931 — crates/tui/src/remote_control.rs:3931-3935 | crates/tui/src/remote_control.rs:4009-4013 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_api.rs:12407 — crates/tui/src/runtime_api.rs:12407-12411 | crates/tui/src/tui/views/mod.rs:3889-3893 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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) crates/tui/src/runtime_threads.rs:8891 — crates/tui/src/runtime_threads.rs:8891-8895 | crates/tui/src/runtime_threads.rs:8904-8908 — both copies are in the same file, so extract the 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) crates/tui/src/session_manager.rs:3164 — crates/tui/src/session_manager.rs:3164-3168 | crates/tui/src/session_manager.rs:3599-3603 — both copies are in the same file, so extract the 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) crates/tui/src/tools/apply_patch.rs:429 — crates/tui/src/tools/apply_patch.rs:429-433 | crates/tui/src/tools/apply_patch.rs:488-492 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) crates/tui/src/tools/runtime_mcp.rs:167 — crates/tui/src/tools/runtime_mcp.rs:167-171 | crates/tui/src/tools/runtime_mcp.rs:175-179 — both copies are in the same file, so extract the 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) crates/tui/src/tools/web/scrape.rs:88 — crates/tui/src/tools/web/scrape.rs:88-92 | crates/tui/src/tools/web/scrape.rs:126-130 — both copies are in the same file, so extract the 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) crates/tui/src/tools/web_search.rs:2791 — crates/tui/src/tools/web_search.rs:2791-2795 | crates/tui/src/tools/web_search.rs:3787-3791 — both copies are in the same file, so extract the 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) crates/tui/src/tui/command_palette.rs:795 — crates/tui/src/tui/command_palette.rs:795-799 | crates/tui/src/tui/theme_picker.rs:281-290 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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) crates/tui/src/tui/history/message.rs:114 — crates/tui/src/tui/history/message.rs:114-118 | crates/tui/src/tui/history/message.rs:233-237 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 18 more in this group — see findings.md.
PF3 · Async & latency hygiene · Sync-over-async blocking · ×40
  • Sync-over-async blocking crates/tui/plugins/computer-use/app/background-check.mjs:13 — `fs.existsSync` in `runBackgroundCheck` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/app/background-check.mjs:18 — `fs.mkdtempSync` in `runBackgroundCheck` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/app/background-check.mjs:49 — `fs.mkdirSync` in `runBackgroundCheck` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/app/background-check.mjs:76 — `fs.copyFileSync` in `runBackgroundCheck` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/app/background-check.mjs:89 — `fs.rmSync` in `runBackgroundCheck` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/app/daemon.mjs:60 — `fs.writeFileSync` in `userControl` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/app/daemon.mjs:61 — `fs.renameSync` in `userControl` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/app/daemon.mjs:247 — `fs.readFileSync` in `shutdown` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/app/daemon.mjs:247 — `fs.unlinkSync` in `shutdown` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/src/app-socket.mjs:220 — `fs.existsSync` in `ensureApp` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/src/app-socket.mjs:226 — `fs.existsSync` in `ensureApp` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/src/backends/darwin.mjs:81 — `fs.statSync` in `fitRasterToBudget` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/src/backends/darwin.mjs:238 — `fs.existsSync` in `nativeHelper` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/src/backends/darwin.mjs:240 — `fs.existsSync` in `nativeHelper` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/src/backends/darwin.mjs:245 — `fs.existsSync` in `nativeHelper` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/src/backends/darwin.mjs:247 — `fs.existsSync` in `nativeHelper` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/src/backends/darwin.mjs:249 — `fs.existsSync` in `nativeHelper` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/src/backends/darwin.mjs:251 — `fs.readFileSync` in `nativeHelper` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/src/backends/darwin.mjs:253 — `fs.mkdirSync` in `nativeHelper` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/src/backends/darwin.mjs:255 — `fs.existsSync` in `nativeHelper` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/src/backends/darwin.mjs:259 — `fs.renameSync` in `nativeHelper` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/src/backends/darwin.mjs:333 — `fs.mkdirSync` in `updatePreview` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/src/backends/darwin.mjs:337 — `fs.renameSync` in `updatePreview` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/src/backends/darwin.mjs:471 — `fs.mkdirSync` in `screenshot` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking crates/tui/plugins/computer-use/src/backends/darwin.mjs:508 — `fs.statSync` in `screenshot` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • + 15 more in this group — see findings.md.
R4 · Test Coverage · No test reaches this file · ×40
  • No test reaches this file crates/tui/src/tui/pet_watch/pet-native.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 pet/ios/Resources/pet-native.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 scripts/review-eval.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 integrations/wecom-bridge/src/index.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 crates/tui/src/integrations/dsh/scene.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 web/scripts/gt-site.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 crates/tui/src/compaction/validate_survival_contract.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 web/components/ratatui/explorer.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 web/app/[locale]/contribute/page.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 extensions/vscode/src/extension.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 web/app/[locale]/changelog/page.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 web/lib/content/plugins.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 scripts/opencode-chat2responses-proxy.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 extensions/vscode/src/status.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 web/app/[locale]/admin/admin-client.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 web/components/connection-banner.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 web/components/merch-storefront.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 web/scripts/compare-deployed-facts.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 scripts/release/windows-terminal-clipboard.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 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 web/app/[locale]/admin/page.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 workflows/stopship.workflow.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 web/lib/merch/sizing.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 web/scripts/check-locales.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 workflows/operate_best_of_n.workflow.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • + 15 more in this group — see findings.md.
D3 · God Classes · TooManyMethods · ×36
  • TooManyMethods: App crates/tui/src/tui/app.rs:1555 — TooManyMethods — 330 methods, declared across 8 files: tui/app.rs (235), app/composer.rs (67), app/status.rs (14), tui/plugin_suggestions.rs (7), +4 more file(s). The bar is 30 methods; this is 300 over it, 11.00× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Engine crates/tui/src/core/engine.rs:994 — TooManyMethods — 246 methods, declared across 17 files: core/engine.rs (138), engine/turn_loop.rs (33), engine/compaction.rs (18), engine/child_host.rs (12), +13 more file(s). The bar is 30 methods; this is 216 over it, 8.20× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: RuntimeThreadManager crates/tui/src/runtime_threads.rs:6840 — TooManyMethods — 215 methods. The bar is 30 methods; this is 185 over it, 7.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: SubAgentManager crates/tui/src/tools/subagent/mod.rs:3878 — TooManyMethods — 184 methods. The bar is 30 methods; this is 154 over it, 6.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Config crates/tui/src/config.rs:1949 — TooManyMethods — 172 methods. The bar is 30 methods; this is 142 over it, 5.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: SessionManager crates/tui/src/session_manager.rs:1555 — TooManyMethods — 115 methods. The bar is 30 methods; this is 85 over it, 3.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ProviderPickerView crates/tui/src/tui/provider_picker.rs:190 — TooManyMethods — 95 methods. The bar is 30 methods; this is 65 over it, 3.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: CodewhaleClient crates/tui/src/client.rs:274 — TooManyMethods — 83 methods, declared across 6 files: src/client.rs (70), client/anthropic.rs (5), client/chat.rs (3), client/responses.rs (2), +2 more file(s). The bar is 30 methods; this is 53 over it, 2.77× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: RuntimeThreadStore crates/tui/src/runtime_threads.rs:2440 — TooManyMethods — 83 methods. The bar is 30 methods; this is 53 over it, 2.77× 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: SetupWizardView crates/tui/src/tui/setup/mod.rs:160 — TooManyMethods — 72 methods. The bar is 30 methods; this is 42 over it, 2.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: RemoteControlController crates/tui/src/remote_control.rs:797 — TooManyMethods — 70 methods. The bar is 30 methods; this is 40 over it, 2.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SnapshotRepo crates/tui/src/snapshot/repo.rs:174 — TooManyMethods — 62 methods, declared across 2 files: snapshot/repo.rs (58), snapshot/delta.rs (4). The bar is 30 methods; this is 32 over it, 2.07× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: TaskManager crates/tui/src/task_manager.rs:1477 — TooManyMethods — 60 methods. The bar is 30 methods; this is 30 over it, 2.00× 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: FleetManager crates/tui/src/fleet/manager.rs:39 — TooManyMethods — 59 methods. The bar is 30 methods; this is 29 over it, 1.97× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ToolRegistryBuilder crates/tui/src/tools/registry.rs:885 — TooManyMethods — 56 methods. The bar is 30 methods; this is 26 over it, 1.87× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: FleetSetupView crates/tui/src/tui/views/fleet_setup.rs:717 — TooManyMethods — 55 methods. The bar is 30 methods; this is 25 over it, 1.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AutomationManager crates/tui/src/automation_manager.rs:1055 — TooManyMethods — 54 methods. The bar is 30 methods; this is 24 over it, 1.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ConfigView crates/tui/src/tui/views/mod.rs:2182 — TooManyMethods — 51 methods. The bar is 30 methods; this is 21 over it, 1.70× 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: OwnerRegistry crates/tui/src/extension_host/registry.rs:240 — TooManyMethods — 49 methods. The bar is 30 methods; this is 19 over it, 1.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ShellManager crates/tui/src/tools/shell.rs:1925 — TooManyMethods — 49 methods. The bar is 30 methods; this is 19 over it, 1.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ModelPickerView crates/tui/src/tui/model_picker.rs:211 — 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: ExtensionHostManager crates/tui/src/extension_host/mod.rs:1396 — TooManyMethods — 47 methods, declared across 2 files: extension_host/mod.rs (36), extension_host/execution.rs (11). The bar is 30 methods; this is 17 over it, 1.57× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: EngineHandle crates/tui/src/core/engine.rs:720 — TooManyMethods — 45 methods, declared across 2 files: engine/handle.rs (41), core/engine.rs (4). The bar is 30 methods; this is 15 over it, 1.50× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: PluginRegistry crates/tui/src/plugins/registry.rs:65 — TooManyMethods — 44 methods, declared across 2 files: plugins/registry.rs (43), registry/gc.rs (1). The bar is 30 methods; this is 14 over it, 1.47× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: CloudClient crates/cli/src/cloud.rs:983 — TooManyMethods — 38 methods. The bar is 30 methods; this is 8 over it, 1.27× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • + 11 more in this group — see findings.md.
D3 · God Classes · TooManyFields · ×35
  • TooManyFields: App crates/tui/src/tui/app.rs:1555 — TooManyFields — 373 stored fields beside 330 methods. The bar is 30 stored fields; this is 343 over it, 12.43× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Config crates/tui/src/config.rs:1949 — TooManyFields — 102 stored fields beside 172 methods. The bar is 30 stored fields; this is 72 over it, 3.40× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: EnvRuntimeOverrides crates/config/src/lib.rs:7424 — TooManyFields — 100 stored fields beside 5 methods. The bar is 30 stored fields; this is 70 over it, 3.33× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Engine crates/tui/src/core/engine.rs:994 — TooManyFields — 82 stored fields beside 246 methods. The bar is 30 stored fields; this is 52 over it, 2.73× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: EngineConfig crates/tui/src/core/engine.rs:280 — TooManyFields — 81 stored fields. The bar is 30 stored fields; this is 51 over it, 2.70× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: StatusMessages crates/tui/src/commands/groups/config/policy_messages.rs:256 — TooManyFields — 79 stored fields beside 2 methods. The bar is 30 stored fields; this is 49 over it, 2.63× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Settings crates/tui/src/settings.rs:243 — TooManyFields — 67 stored fields beside 30 methods. The bar is 30 stored fields; this is 37 over it, 2.23× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: ProvidersToml crates/config/src/lib.rs:282 — TooManyFields — 53 stored fields beside 3 methods. The bar is 30 stored fields; this is 23 over it, 1.77× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: ProvidersConfig crates/tui/src/config.rs:2790 — TooManyFields — 53 stored fields beside 2 methods. The bar is 30 stored fields; this is 23 over it, 1.77× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: SetupRuntimeFacts crates/tui/src/tui/setup/mod.rs:200 — TooManyFields — 53 stored fields beside 1 method. The bar is 30 stored fields; this is 23 over it, 1.77× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: SessionState crates/tui/src/tui/app.rs:1138 — TooManyFields — 50 stored fields beside 10 methods. The bar is 30 stored fields; this is 20 over it, 1.67× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: ProviderPickerView crates/tui/src/tui/provider_picker.rs:190 — TooManyFields — 47 stored fields beside 95 methods. The bar is 30 stored fields; this is 17 over it, 1.57× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: WorkSurfaceState crates/tui/src/tui/work_surface/model.rs:337 — TooManyFields — 44 stored fields beside 11 methods. The bar is 30 stored fields; this is 14 over it, 1.47× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: SubAgentRuntime crates/tui/src/tools/subagent/mod.rs:2876 — TooManyFields — 43 stored fields beside 28 methods. The bar is 30 stored fields; this is 13 over it, 1.43× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: UiTheme crates/palette/src/themes.rs:11 — TooManyFields — 43 stored fields beside 4 methods. The bar is 30 stored fields; this is 13 over it, 1.43× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: UserThemeColors crates/palette/src/user_theme.rs:34 — TooManyFields — 41 stored fields. The bar is 30 stored fields; this is 11 over it, 1.37× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: CodewhaleClient crates/tui/src/client.rs:274 — TooManyFields — 39 stored fields beside 83 methods. The bar is 30 stored fields; this is 9 over it, 1.30× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: RuntimeCapabilities crates/protocol/src/runtime/mod.rs:55 — TooManyFields — 39 stored fields. The bar is 30 stored fields; this is 9 over it, 1.30× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: RuntimeThreadManager crates/tui/src/runtime_threads.rs:6840 — TooManyFields — 38 stored fields beside 215 methods. The bar is 30 stored fields; this is 8 over it, 1.27× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: SubAgentManager crates/tui/src/tools/subagent/mod.rs:3878 — TooManyFields — 38 stored fields beside 184 methods. The bar is 30 stored fields; this is 8 over it, 1.27× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: BackgroundShell crates/tui/src/tools/shell.rs:1079 — TooManyFields — 38 stored fields beside 24 methods. The bar is 30 stored fields; this is 8 over it, 1.27× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: TurnRecord crates/tui/src/runtime_threads.rs:1471 — TooManyFields — 38 stored fields beside 4 methods. The bar is 30 stored fields; this is 8 over it, 1.27× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: CatalogOffering crates/config/src/catalog.rs:122 — TooManyFields — 37 stored fields beside 10 methods. The bar is 30 stored fields; this is 7 over it, 1.23× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: ConfigStatusView crates/command-contract/src/config_policy.rs:155 — TooManyFields — 37 stored fields. The bar is 30 stored fields; this is 7 over it, 1.23× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: TaskRecord crates/tui/src/task_manager.rs:304 — TooManyFields — 37 stored fields. The bar is 30 stored fields; this is 7 over it, 1.23× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • + 10 more in this group — see findings.md.
X3 · Exception handling · Swallowed exception (empty catch) · ×35
  • Swallowed exception (empty catch) web/scripts/facts-publish.mjs:542 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) REDACTED:304 — 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) web/lib/bounded-body.ts:11 — 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) web/lib/bounded-body.ts:33 — 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) web/lib/bounded-body.ts:72 — 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) web/lib/cloud-facts.ts:212 — 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) web/lib/cloud-facts.ts:297 — 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) web/lib/cloud-facts.ts:332 — 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) web/lib/community-agent-tasks.ts:195 — 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) web/lib/community-agent.ts:380 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) REDACTED:302 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) REDACTED:329 — 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) web/lib/telemetry/product-usage.ts:252 — 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) web/lib/telemetry/product-usage.ts:274 — 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) web/lib/telemetry/product-usage.ts:364 — 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) web/lib/telemetry/product-usage.ts:371 — 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) web/components/feed-retry.tsx:20 — 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) web/components/install-code-block.tsx:30 — 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) web/components/theme-toggle.tsx:40 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) web/components/whale-live.tsx:153 — `.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) web/app/api/admin/post/route.ts:293 — 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) web/app/api/admin/post/route.ts:355 — 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) web/app/[locale]/roadmap/page.tsx:181 — 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) telemetry-ingest/src/posthog.ts:59 — `.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) telemetry-ingest/src/posthog.ts:60 — 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.
  • + 10 more in this group — see findings.md.
D2 · Cognitive Complexity · codewhale_cli · ×34
  • codewhale_cli::cloud::computer::run (cognitive 122) crates/cli/src/cloud/computer.rs:171 — codewhale_cli::cloud::computer::run has cognitive complexity 122 (threshold 15). Drivers by points: if/else 66 (85 pts), boolean chains 24, loops 3 (8 pts), match/switch 3 (5 pts) (nesting depth added 26). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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.
  • codewhale_cli::cloud::run_agents (cognitive 86) crates/cli/src/cloud.rs:2324 — codewhale_cli::cloud::run_agents has cognitive complexity 86 (threshold 15). Drivers by points: if/else 36 (69 pts), boolean chains 9, loops 2 (4 pts), match/switch 2 (4 pts) (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_cli::run_config_command (cognitive 68) REDACTED:5355 — codewhale_cli::run_config_command has cognitive complexity 68 (threshold 15). Drivers by points: if/else 28 (56 pts), loops 2 (5 pts), boolean chains 4, match/switch 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.
  • codewhale_cli::run_auth_command_with_secrets_and_runtime (cognitive 55) REDACTED:4836 — codewhale_cli::run_auth_command_with_secrets_and_runtime has cognitive complexity 55 (threshold 15). Drivers by points: if/else 23 (39 pts), loops 4 (10 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 24). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codewhale_cli::run_model_command (cognitive 54) REDACTED:5860 — codewhale_cli::run_model_command has cognitive complexity 54 (threshold 15). Drivers by points: if/else 19 (40 pts), boolean chains 5, loops 2 (5 pts), match/switch 2 (4 pts) (nesting depth added 26). 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.
  • codewhale_cli::run (cognitive 52) REDACTED:2273 — codewhale_cli::run has cognitive complexity 52 (threshold 15). Drivers by points: if/else 26 (37 pts), boolean chains 9, match/switch 4 (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.
  • codewhale_cli::metrics::print_human (cognitive 46) crates/cli/src/metrics.rs:1241 — codewhale_cli::metrics::print_human has cognitive complexity 46 (threshold 15). Drivers by points: if/else 22 (30 pts), match/switch 5 (11 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.
  • codewhale_cli::metrics::read_audit_log (cognitive 42) crates/cli/src/metrics.rs:466 — codewhale_cli::metrics::read_audit_log has cognitive complexity 42 (threshold 15). Drivers by points: if/else 10 (26 pts), match/switch 5 (11 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_cli::update::run_update (cognitive 42) crates/cli/src/update.rs:53 — codewhale_cli::update::run_update has cognitive complexity 42 (threshold 15). Drivers by points: if/else 21 (30 pts), boolean chains 6, loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_cli::cloud::work::write_work_result (cognitive 39) crates/cli/src/cloud/work.rs:524 — codewhale_cli::cloud::work::write_work_result has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (21 pts), loops 4 (9 pts), match/switch 5 (6 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • codewhale_cli::metrics::read_session_file (cognitive 39) crates/cli/src/metrics.rs:699 — codewhale_cli::metrics::read_session_file has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (26 pts), match/switch 5 (8 pts), loops 3 (4 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.
  • codewhale_cli::config_bundles::prepare_import (cognitive 37) crates/cli/src/config_bundles.rs:1192 — codewhale_cli::config_bundles::prepare_import has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 6 (9 pts), boolean chains 4, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_cli::cloud::work::quote (cognitive 36) crates/cli/src/cloud/work.rs:987 — codewhale_cli::cloud::work::quote has cognitive complexity 36 (threshold 15). Drivers by points: if/else 23 (25 pts), boolean chains 9, match/switch 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.
  • codewhale_cli::cloud::run_with (cognitive 33) crates/cli/src/cloud.rs:3157 — codewhale_cli::cloud::run_with has cognitive complexity 33 (threshold 15). Drivers by points: match/switch 6 (16 pts), if/else 7 (13 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 18). 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.
  • codewhale_cli::apply_tui_env (cognitive 30) REDACTED:6584 — codewhale_cli::apply_tui_env has cognitive complexity 30 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 7, loops 2 (5 pts) (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codewhale_cli::update::compiled_host::prepare (cognitive 30) crates/cli/src/update/compiled_host.rs:286 — codewhale_cli::update::compiled_host::prepare has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 6, 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.
  • codewhale_cli::run_lane_command (cognitive 25) REDACTED:1084 — codewhale_cli::run_lane_command has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 3 (7 pts), loops 2 (4 pts) (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codewhale_cli::cloud::work::launch (cognitive 25) crates/cli/src/cloud/work.rs:1267 — codewhale_cli::cloud::work::launch has cognitive complexity 25 (threshold 15). Drivers by points: if/else 18 (19 pts), match/switch 3 (4 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codewhale_cli::dispatch::run (cognitive 25) crates/cli/src/dispatch.rs:50 — codewhale_cli::dispatch::run has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 7 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_cli::cloud::parse_agent_turn_events (cognitive 23) crates/cli/src/cloud.rs:2133 — codewhale_cli::cloud::parse_agent_turn_events has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (3 pts), match/switch 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.
  • codewhale_cli::cloud::run_computer_files (cognitive 23) crates/cli/src/cloud.rs:2905 — codewhale_cli::cloud::run_computer_files has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 3 (6 pts), boolean chains 5 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_cli::auth_status_all_providers_with_runtime (cognitive 22) REDACTED:4079 — codewhale_cli::auth_status_all_providers_with_runtime has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (21 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.
  • codewhale_cli::config_bundles::plan_import (cognitive 22) crates/cli/src/config_bundles.rs:613 — codewhale_cli::config_bundles::plan_import has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 4 (7 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.
  • codewhale_cli::run_auth_migrate (cognitive 20) REDACTED:5260 — codewhale_cli::run_auth_migrate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_cli::cloud::work::assign (cognitive 20) crates/cli/src/cloud/work.rs:209 — codewhale_cli::cloud::work::assign has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 3 (4 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.
  • + 9 more in this group — see findings.md.
D2 · Cognitive Complexity · (anonymous) · ×32
  • (anonymous)::compilePetTelemetry (cognitive 87) pet/ios/Resources/pet-native.js:1219 — (anonymous)::compilePetTelemetry has cognitive complexity 87 (threshold 15). Drivers by points: if/else 18 (37 pts), ternaries 9 (18 pts), loops 10 (17 pts), boolean chains 14, other 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • (anonymous)::compilePetTelemetry (cognitive 87) crates/tui/src/tui/pet_watch/pet-native.js:1219 — (anonymous)::compilePetTelemetry has cognitive complexity 87 (threshold 15). Drivers by points: if/else 18 (37 pts), ternaries 9 (18 pts), loops 10 (17 pts), boolean chains 14, other 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • (anonymous)::observe (cognitive 81) pet/ios/Resources/pet-native.js:1909 — (anonymous)::observe has cognitive complexity 81 (threshold 15). Drivers by points: if/else 19 (36 pts), boolean chains 24, ternaries 8 (18 pts), loops 1 (2 pts), match/switch 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.
  • (anonymous)::observe (cognitive 81) crates/tui/src/tui/pet_watch/pet-native.js:1909 — (anonymous)::observe has cognitive complexity 81 (threshold 15). Drivers by points: if/else 19 (36 pts), boolean chains 24, ternaries 8 (18 pts), loops 1 (2 pts), match/switch 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.
  • (anonymous)::makeFrame (cognitive 71) pet/ios/Resources/pet-native.js:540 — (anonymous)::makeFrame has cognitive complexity 71 (threshold 15). Drivers by points: ternaries 22 (26 pts), if/else 14 (23 pts), boolean chains 12, other 6, loops 4 (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.
  • (anonymous)::makeFrame (cognitive 71) crates/tui/src/tui/pet_watch/pet-native.js:540 — (anonymous)::makeFrame has cognitive complexity 71 (threshold 15). Drivers by points: ternaries 22 (26 pts), if/else 14 (23 pts), boolean chains 12, other 6, loops 4 (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.
  • (anonymous)::gaitTarget (cognitive 62) pet/ios/Resources/pet-native.js:819 — (anonymous)::gaitTarget has cognitive complexity 62 (threshold 15). Drivers by points: if/else 21 (30 pts), ternaries 10 (30 pts), boolean chains 2 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • (anonymous)::gaitTarget (cognitive 62) crates/tui/src/tui/pet_watch/pet-native.js:819 — (anonymous)::gaitTarget has cognitive complexity 62 (threshold 15). Drivers by points: if/else 21 (30 pts), ternaries 10 (30 pts), boolean chains 2 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • (anonymous)::buildPyramid (cognitive 58) pet/ios/Resources/pet-native.js:1363 — (anonymous)::buildPyramid has cognitive complexity 58 (threshold 15). Drivers by points: loops 11 (21 pts), if/else 10 (20 pts), ternaries 3 (11 pts), boolean chains 3, other 3 (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.
  • (anonymous)::buildPyramid (cognitive 58) crates/tui/src/tui/pet_watch/pet-native.js:1363 — (anonymous)::buildPyramid has cognitive complexity 58 (threshold 15). Drivers by points: loops 11 (21 pts), if/else 10 (20 pts), ternaries 3 (11 pts), boolean chains 3, other 3 (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.
  • (anonymous)::restore (cognitive 48) pet/ios/Resources/pet-native.js:391 — (anonymous)::restore has cognitive complexity 48 (threshold 15). Drivers by points: boolean chains 40, if/else 4, other 2, ternaries 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • (anonymous)::restore (cognitive 48) crates/tui/src/tui/pet_watch/pet-native.js:391 — (anonymous)::restore has cognitive complexity 48 (threshold 15). Drivers by points: boolean chains 40, if/else 4, other 2, ternaries 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • (anonymous)::voices (cognitive 45) pet/ios/Resources/pet-native.js:1622 — (anonymous)::voices has cognitive complexity 45 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 9, ternaries 2 (9 pts), loops 3 (8 pts) (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • (anonymous)::projectDotField (cognitive 45) pet/ios/Resources/pet-native.js:2159 — (anonymous)::projectDotField has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 16 (27 pts), if/else 3 (7 pts), boolean chains 4, match/switch 1 (3 pts), other 3, 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.
  • (anonymous)::voices (cognitive 45) crates/tui/src/tui/pet_watch/pet-native.js:1622 — (anonymous)::voices has cognitive complexity 45 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 9, ternaries 2 (9 pts), loops 3 (8 pts) (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • (anonymous)::projectDotField (cognitive 45) crates/tui/src/tui/pet_watch/pet-native.js:2159 — (anonymous)::projectDotField has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 16 (27 pts), if/else 3 (7 pts), boolean chains 4, match/switch 1 (3 pts), other 3, 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.
  • (anonymous)::activity (cognitive 37) pet/ios/Resources/pet-native.js:1757 — (anonymous)::activity has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 14, ternaries 12, if/else 5 (6 pts), other 5 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • (anonymous)::activity (cognitive 37) crates/tui/src/tui/pet_watch/pet-native.js:1757 — (anonymous)::activity has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 14, ternaries 12, if/else 5 (6 pts), other 5 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • (anonymous)::fromRecording (cognitive 29) pet/ios/Resources/pet-native.js:297 — (anonymous)::fromRecording has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 14, if/else 8 (10 pts), other 2, ternaries 2, 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.
  • (anonymous)::fromRecording (cognitive 29) crates/tui/src/tui/pet_watch/pet-native.js:297 — (anonymous)::fromRecording has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 14, if/else 8 (10 pts), other 2, ternaries 2, 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.
  • (anonymous)::step (cognitive 23) pet/ios/Resources/pet-native.js:1008 — (anonymous)::step has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 10 (12 pts), if/else 5 (8 pts), loops 2, other 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • (anonymous)::step (cognitive 23) crates/tui/src/tui/pet_watch/pet-native.js:1008 — (anonymous)::step has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 10 (12 pts), if/else 5 (8 pts), loops 2, other 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • (anonymous)::presentation (cognitive 18) pet/ios/Resources/pet-native.js:51 — (anonymous)::presentation has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (8 pts), boolean chains 4, if/else 3, other 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.
  • (anonymous)::presentation (cognitive 18) crates/tui/src/tui/pet_watch/pet-native.js:51 — (anonymous)::presentation has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (8 pts), boolean chains 4, if/else 3, other 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.
  • (anonymous)::constructor (cognitive 17) pet/ios/Resources/pet-native.js:250 — (anonymous)::constructor has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 6, if/else 4 (6 pts), ternaries 1 (3 pts), 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.
  • + 7 more in this group — see findings.md.
D2 · Cognitive Complexity · Engine · ×31
  • Engine::execute_planned_tools (cognitive 225) crates/tui/src/core/engine/turn_loop.rs:2674 — Engine::execute_planned_tools has cognitive complexity 225 (threshold 15). Drivers by points: if/else 57 (162 pts), match/switch 9 (29 pts), loops 7 (20 pts), boolean chains 14 (nesting depth added 138). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Engine::plan_tool_calls (cognitive 216) crates/tui/src/core/engine/turn_loop.rs:1803 — Engine::plan_tool_calls has cognitive complexity 216 (threshold 15). Drivers by points: if/else 62 (138 pts), match/switch 12 (38 pts), boolean chains 33, loops 5 (7 pts) (nesting depth added 104). 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.
  • Engine::run_owned (cognitive 203) crates/tui/src/core/engine.rs:3641 — Engine::run_owned has cognitive complexity 203 (threshold 15). Drivers by points: if/else 50 (159 pts), match/switch 10 (35 pts), boolean chains 7, loops 2 (nesting depth added 134). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Engine::process_stream (cognitive 194) crates/tui/src/core/engine/turn_loop.rs:4556 — Engine::process_stream has cognitive complexity 194 (threshold 15). Drivers by points: if/else 56 (148 pts), match/switch 10 (30 pts), boolean chains 12, loops 3 (4 pts) (nesting depth added 113). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Engine::run_model_step (cognitive 161) crates/tui/src/core/engine/turn_loop/model_step.rs:7 — Engine::run_model_step has cognitive complexity 161 (threshold 15). Drivers by points: if/else 63 (103 pts), boolean chains 27, match/switch 12 (23 pts), loops 5 (8 pts) (nesting depth added 54). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Engine::run_inline_repl_phase (cognitive 113) crates/tui/src/core/engine/turn_loop/inline_repl.rs:7 — Engine::run_inline_repl_phase has cognitive complexity 113 (threshold 15). Drivers by points: if/else 33 (83 pts), match/switch 6 (17 pts), boolean chains 7, loops 2 (6 pts) (nesting depth added 65). 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.
  • Engine::build_turn_tool_registry_and_catalog (cognitive 92) crates/tui/src/core/engine.rs:5786 — Engine::build_turn_tool_registry_and_catalog has cognitive complexity 92 (threshold 15). Drivers by points: if/else 43 (65 pts), loops 5 (11 pts), match/switch 3 (9 pts), boolean chains 7 (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.
  • Engine::handle_admitted_message (cognitive 80) crates/tui/src/core/engine.rs:6264 — Engine::handle_admitted_message has cognitive complexity 80 (threshold 15). Drivers by points: if/else 45 (52 pts), boolean chains 15, match/switch 7 (11 pts), loops 2 (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.
  • Engine::execute_tool_admitted (cognitive 78) crates/tui/src/core/engine/tool_execution.rs:494 — Engine::execute_tool_admitted has cognitive complexity 78 (threshold 15). Drivers by points: if/else 41 (56 pts), match/switch 9 (14 pts), boolean chains 8 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Engine::continue_model_step (cognitive 72) crates/tui/src/core/engine/turn_loop/continuation.rs:6 — Engine::continue_model_step has cognitive complexity 72 (threshold 15). Drivers by points: if/else 27 (55 pts), boolean chains 9, match/switch 2 (5 pts), loops 1 (3 pts) (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.
  • Engine::prepare_model_step (cognitive 69) crates/tui/src/core/engine/turn_loop/preparation.rs:6 — Engine::prepare_model_step has cognitive complexity 69 (threshold 15). Drivers by points: if/else 40 (53 pts), boolean chains 9, match/switch 4 (6 pts), loops 1 (nesting depth added 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Engine::run_auto_compaction (cognitive 65) crates/tui/src/core/engine/compaction.rs:575 — Engine::run_auto_compaction has cognitive complexity 65 (threshold 15). Drivers by points: if/else 19 (49 pts), match/switch 5 (11 pts), boolean chains 5 (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.
  • Engine::next_run_input (cognitive 53) crates/tui/src/core/engine.rs:3387 — Engine::next_run_input has cognitive complexity 53 (threshold 15). Drivers by points: if/else 9 (29 pts), match/switch 6 (18 pts), boolean chains 5, loops 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.
  • Engine::recover_context_overflow (cognitive 45) crates/tui/src/core/engine/compaction.rs:829 — Engine::recover_context_overflow has cognitive complexity 45 (threshold 15). Drivers by points: if/else 25 (38 pts), boolean chains 5, match/switch 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.
  • Engine::process_tool_results (cognitive 43) crates/tui/src/core/engine/turn_loop.rs:4273 — Engine::process_tool_results has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (32 pts), boolean chains 5, match/switch 2 (5 pts), 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.
  • Engine::run_tool_batch_phase (cognitive 38) crates/tui/src/core/engine/turn_loop/tool_batch.rs:6 — Engine::run_tool_batch_phase has cognitive complexity 38 (threshold 15). Drivers by points: if/else 20 (26 pts), boolean chains 6, match/switch 2 (4 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Engine::await_user_input_decision (cognitive 33) crates/tui/src/core/engine/approval.rs:475 — Engine::await_user_input_decision has cognitive complexity 33 (threshold 15). Drivers by points: if/else 5 (21 pts), match/switch 4 (11 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.
  • Engine::reconcile_restored_work_bindings (cognitive 33) crates/tui/src/core/engine.rs:7799 — Engine::reconcile_restored_work_bindings has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 4 (6 pts), match/switch 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.
  • Engine::new_admitted_with_subagent_manager (cognitive 31) crates/tui/src/core/engine.rs:2057 — Engine::new_admitted_with_subagent_manager has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16, match/switch 9 (11 pts), boolean chains 4 (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.
  • Engine::gate_nested_call (cognitive 29) crates/tui/src/core/engine/turn_loop.rs:3910 — Engine::gate_nested_call has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17 (20 pts), match/switch 4 (7 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
  • Engine::handle_set_goal_status (cognitive 28) crates/tui/src/core/engine.rs:5620 — Engine::handle_set_goal_status has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 7, match/switch 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Engine::wait_for_named_mcp_boot (cognitive 25) crates/tui/src/core/engine.rs:8334 — Engine::wait_for_named_mcp_boot has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 4 (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.
  • Engine::build_request_manifest (cognitive 24) crates/tui/src/core/engine/preview.rs:182 — Engine::build_request_manifest has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15, match/switch 6 (7 pts), boolean chains 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Engine::start_mcp_session_boot (cognitive 23) crates/tui/src/core/engine.rs:8537 — Engine::start_mcp_session_boot has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 3, loops 2, match/switch 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Engine::handle_manual_compaction (cognitive 22) crates/tui/src/core/engine/compaction.rs:354 — Engine::handle_manual_compaction has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 2, match/switch 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.
  • + 6 more in this group — see findings.md.
D1 · Cyclomatic Complexity · (anonymous) · ×30
  • (anonymous)::observe (cyclomatic 72) pet/ios/Resources/pet-native.js:1909 — (anonymous)::observe 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.
  • (anonymous)::observe (cyclomatic 72) crates/tui/src/tui/pet_watch/pet-native.js:1909 — (anonymous)::observe 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.
  • (anonymous)::compilePetTelemetry (cyclomatic 61) pet/ios/Resources/pet-native.js:1219 — (anonymous)::compilePetTelemetry has cyclomatic complexity 61 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • (anonymous)::compilePetTelemetry (cyclomatic 61) crates/tui/src/tui/pet_watch/pet-native.js:1219 — (anonymous)::compilePetTelemetry has cyclomatic complexity 61 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • (anonymous)::restore (cyclomatic 60) pet/ios/Resources/pet-native.js:391 — (anonymous)::restore has cyclomatic complexity 60 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • (anonymous)::makeFrame (cyclomatic 60) pet/ios/Resources/pet-native.js:540 — (anonymous)::makeFrame 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.
  • (anonymous)::restore (cyclomatic 60) crates/tui/src/tui/pet_watch/pet-native.js:391 — (anonymous)::restore has cyclomatic complexity 60 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • (anonymous)::makeFrame (cyclomatic 60) crates/tui/src/tui/pet_watch/pet-native.js:540 — (anonymous)::makeFrame 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.
  • (anonymous)::projectDotField (cyclomatic 43) pet/ios/Resources/pet-native.js:2159 — (anonymous)::projectDotField 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.
  • (anonymous)::projectDotField (cyclomatic 43) crates/tui/src/tui/pet_watch/pet-native.js:2159 — (anonymous)::projectDotField 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.
  • (anonymous)::activity (cyclomatic 40) pet/ios/Resources/pet-native.js:1757 — (anonymous)::activity has cyclomatic complexity 40 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • (anonymous)::activity (cyclomatic 40) crates/tui/src/tui/pet_watch/pet-native.js:1757 — (anonymous)::activity has cyclomatic complexity 40 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • (anonymous)::buildPyramid (cyclomatic 33) pet/ios/Resources/pet-native.js:1363 — (anonymous)::buildPyramid 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.
  • (anonymous)::buildPyramid (cyclomatic 33) crates/tui/src/tui/pet_watch/pet-native.js:1363 — (anonymous)::buildPyramid 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.
  • (anonymous)::fromRecording (cyclomatic 31) pet/ios/Resources/pet-native.js:297 — (anonymous)::fromRecording has cyclomatic complexity 31 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • (anonymous)::fromRecording (cyclomatic 31) crates/tui/src/tui/pet_watch/pet-native.js:297 — (anonymous)::fromRecording has cyclomatic complexity 31 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • (anonymous)::gaitTarget (cyclomatic 29) pet/ios/Resources/pet-native.js:819 — (anonymous)::gaitTarget 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.
  • (anonymous)::gaitTarget (cyclomatic 29) crates/tui/src/tui/pet_watch/pet-native.js:819 — (anonymous)::gaitTarget 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.
  • (anonymous)::restore (cyclomatic 27) pet/ios/Resources/pet-native.js:984 — (anonymous)::restore 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.
  • (anonymous)::restore (cyclomatic 27) crates/tui/src/tui/pet_watch/pet-native.js:984 — (anonymous)::restore 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.
  • (anonymous)::voices (cyclomatic 25) pet/ios/Resources/pet-native.js:1622 — (anonymous)::voices 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.
  • (anonymous)::voices (cyclomatic 25) crates/tui/src/tui/pet_watch/pet-native.js:1622 — (anonymous)::voices 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.
  • (anonymous)::renderPetPCM (cyclomatic 23) pet/ios/Resources/pet-native.js:1673 — (anonymous)::renderPetPCM 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.
  • (anonymous)::renderPetPCM (cyclomatic 23) crates/tui/src/tui/pet_watch/pet-native.js:1673 — (anonymous)::renderPetPCM 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.
  • (anonymous)::step (cyclomatic 19) pet/ios/Resources/pet-native.js:1008 — (anonymous)::step has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: (anonymous)::validatePetBucket (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
  • + 5 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×27
  • Duplicated block (14 lines × 2) REDACTED:3370 — REDACTED:3370-3383 | crates/tui/src/oauth.rs:4469-4482 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14 lines × 2) REDACTED:5952 — REDACTED:5952-5965 | REDACTED:6023-6036 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) crates/cli/src/update.rs:1633 — crates/cli/src/update.rs:1633-1646 | crates/cli/src/update.rs:1804-1817 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) crates/state/src/lib.rs:991 — crates/state/src/lib.rs:991-1004 | crates/state/src/lib.rs:1213-1226 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) crates/tui/src/client.rs:6450 — crates/tui/src/client.rs:6450-6463 | crates/tui/src/client.rs:6558-6571 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) crates/tui/src/config/search.rs:97 — crates/tui/src/config/search.rs:97-110 | crates/tui/src/tools/web/contract.rs:43-56 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14 lines × 2) crates/tui/src/core/engine/tool_catalog.rs:1665 — crates/tui/src/core/engine/tool_catalog.rs:1665-1678 | crates/tui/src/tools/js_execution.rs:168-181 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14 lines × 2) crates/tui/src/models_dev_live.rs:182 — crates/tui/src/models_dev_live.rs:182-195 | crates/tui/src/provider_catalog_live.rs:595-608 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (14 lines × 2) crates/tui/src/plugins/marketplace/parsers/claude.rs:88 — crates/tui/src/plugins/marketplace/parsers/claude.rs:88-101 | crates/tui/src/plugins/marketplace/parsers/codex.rs:63-76 — before extracting anything, compare `crates/tui/src/plugins/marketplace/parsers/claude.rs` and `crates/tui/src/plugins/marketplace/parsers/codex.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 93 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) crates/tui/src/provider_lake.rs:2406 — crates/tui/src/provider_lake.rs:2406-2419 | crates/tui/src/provider_lake.rs:2422-2435 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) crates/tui/src/runtime_chat_relay.rs:1666 — crates/tui/src/runtime_chat_relay.rs:1666-1679 | crates/tui/src/runtime_threads.rs:7459-7472 — before extracting anything, compare `crates/tui/src/runtime_chat_relay.rs` and `crates/tui/src/runtime_threads.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) crates/tui/src/tools/cargo_failure_summary.rs:343 — crates/tui/src/tools/cargo_failure_summary.rs:343-356 | crates/tui/src/tools/workflow/mod.rs:2678-2691 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14 lines × 2) crates/tui/src/tools/shell.rs:2622 — crates/tui/src/tools/shell.rs:2622-2635 | crates/tui/src/tools/shell.rs:2654-2668 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) crates/tui/src/tools/subagent/mod.rs:14677 — crates/tui/src/tools/subagent/mod.rs:14677-14690 | crates/tui/src/tools/subagent/mod.rs:14702-14715 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) crates/tui/src/tools/terminal_session.rs:1065 — crates/tui/src/tools/terminal_session.rs:1065-1078 | crates/tui/src/tools/terminal_session.rs:1152-1165 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) crates/tui/src/tools/truncate.rs:592 — crates/tui/src/tools/truncate.rs:592-605 | crates/tui/src/tools/truncate.rs:1094-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.
  • Duplicated block (14 lines × 2) crates/tui/src/tools/verifier.rs:1191 — crates/tui/src/tools/verifier.rs:1191-1204 | crates/tui/src/tools/verifier.rs:1210-1223 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) crates/tui/src/tui/history/checklist.rs:142 — crates/tui/src/tui/history/checklist.rs:142-155 | crates/tui/src/tui/history/checklist.rs:244-257 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) crates/tui/src/tui/ui/apply.rs:1591 — crates/tui/src/tui/ui/apply.rs:1591-1604 | crates/tui/src/tui/ui/handlers.rs:2079-2092 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (14 lines × 2) crates/tui/src/tui/ui/apply.rs:1827 — crates/tui/src/tui/ui/apply.rs:1827-1840 | crates/tui/src/tui/ui/apply.rs:2926-2939 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) crates/tui/src/tui/widgets/approval_band_legacy.rs:81 — crates/tui/src/tui/widgets/approval_band_legacy.rs:81-94 | crates/tui/src/tui/widgets/mod.rs:1606-1619 — before extracting anything, compare `crates/tui/src/tui/widgets/approval_band_legacy.rs` and `crates/tui/src/tui/widgets/mod.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) crates/tui/src/tui/widgets/approval_band_legacy.rs:837 — crates/tui/src/tui/widgets/approval_band_legacy.rs:837-850 | crates/tui/src/tui/widgets/mod.rs:2028-2041 — before extracting anything, compare `crates/tui/src/tui/widgets/approval_band_legacy.rs` and `crates/tui/src/tui/widgets/mod.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) crates/tui/src/tui/widgets/composer_legacy.rs:488 — crates/tui/src/tui/widgets/composer_legacy.rs:488-501 | crates/tui/src/tui/widgets/composer_legacy.rs:810-823 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) crates/tui/src/remote_control.rs:3390 — crates/tui/src/remote_control.rs:3390-3403 | crates/tui/src/remote_control.rs:3509-3522 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) crates/tui/src/core/engine/compaction.rs:779 — crates/tui/src/core/engine/compaction.rs:779-792 | crates/tui/src/core/engine/compaction.rs:1025-1038 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 2 more in this group — see findings.md.
D1 · Cyclomatic Complexity · Engine · ×26
  • Engine::plan_tool_calls (cyclomatic 116) crates/tui/src/core/engine/turn_loop.rs:1803 — Engine::plan_tool_calls has cyclomatic complexity 116 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Engine::run_model_step (cyclomatic 109) crates/tui/src/core/engine/turn_loop/model_step.rs:7 — Engine::run_model_step has cyclomatic complexity 109 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Engine::run_owned (cyclomatic 96) crates/tui/src/core/engine.rs:3641 — Engine::run_owned has cyclomatic complexity 96 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Engine::process_stream (cyclomatic 90) crates/tui/src/core/engine/turn_loop.rs:4556 — Engine::process_stream has cyclomatic complexity 90 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Engine::execute_planned_tools (cyclomatic 76) crates/tui/src/core/engine/turn_loop.rs:2674 — Engine::execute_planned_tools has cyclomatic complexity 76 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Engine::handle_admitted_message (cyclomatic 60) crates/tui/src/core/engine.rs:6264 — Engine::handle_admitted_message has cyclomatic complexity 60 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Engine::execute_tool_admitted (cyclomatic 57) crates/tui/src/core/engine/tool_execution.rs:494 — Engine::execute_tool_admitted has cyclomatic complexity 57 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Engine::prepare_model_step (cyclomatic 54) crates/tui/src/core/engine/turn_loop/preparation.rs:6 — Engine::prepare_model_step has cyclomatic complexity 54 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Engine::build_turn_tool_registry_and_catalog (cyclomatic 48) crates/tui/src/core/engine.rs:5786 — Engine::build_turn_tool_registry_and_catalog has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Engine::run_inline_repl_phase (cyclomatic 46) crates/tui/src/core/engine/turn_loop/inline_repl.rs:7 — Engine::run_inline_repl_phase has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Engine::continue_model_step (cyclomatic 38) crates/tui/src/core/engine/turn_loop/continuation.rs:6 — Engine::continue_model_step 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.
  • Engine::new_admitted_with_subagent_manager (cyclomatic 31) crates/tui/src/core/engine.rs:2057 — Engine::new_admitted_with_subagent_manager has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Engine::recover_context_overflow (cyclomatic 28) crates/tui/src/core/engine/compaction.rs:829 — Engine::recover_context_overflow 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.
  • Engine::next_run_input (cyclomatic 28) crates/tui/src/core/engine.rs:3387 — Engine::next_run_input 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.
  • Engine::run_auto_compaction (cyclomatic 27) crates/tui/src/core/engine/compaction.rs:575 — Engine::run_auto_compaction 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.
  • Engine::run_tool_batch_phase (cyclomatic 26) crates/tui/src/core/engine/turn_loop/tool_batch.rs:6 — Engine::run_tool_batch_phase 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.
  • Engine::run_turn (cyclomatic 25) crates/tui/src/core/engine/turn_loop.rs:1488 — Engine::run_turn has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Engine::gate_nested_call (cyclomatic 25) crates/tui/src/core/engine/turn_loop.rs:3910 — Engine::gate_nested_call 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.
  • Engine::process_tool_results (cyclomatic 22) crates/tui/src/core/engine/turn_loop.rs:4273 — Engine::process_tool_results 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.
  • Engine::wait_for_named_mcp_boot (cyclomatic 22) crates/tui/src/core/engine.rs:8334 — Engine::wait_for_named_mcp_boot 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.
  • Engine::build_request_manifest (cyclomatic 21) crates/tui/src/core/engine/preview.rs:182 — Engine::build_request_manifest 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.
  • Engine::handle_set_goal_status (cyclomatic 20) crates/tui/src/core/engine.rs:5620 — Engine::handle_set_goal_status 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.
  • Engine::discover_mcp_for_tool_search (cyclomatic 18) crates/tui/src/core/engine/turn_loop.rs:1088 — Engine::discover_mcp_for_tool_search 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.
  • Engine::await_tool_approval (cyclomatic 17) crates/tui/src/core/engine/approval.rs:313 — Engine::await_tool_approval has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Engine::reconcile_restored_work_bindings (cyclomatic 17) crates/tui/src/core/engine.rs:7799 — Engine::reconcile_restored_work_bindings 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.
  • + 1 more in this group — see findings.md.
D1 · Cyclomatic Complexity · codewhale_cli · ×25
  • codewhale_cli::cloud::computer::run (cyclomatic 89) crates/cli/src/cloud/computer.rs:171 — codewhale_cli::cloud::computer::run has cyclomatic complexity 89 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codewhale_cli::run (cyclomatic 87) REDACTED:2273 — codewhale_cli::run has cyclomatic complexity 87 (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.
  • codewhale_cli::cloud::run_agents (cyclomatic 57) crates/cli/src/cloud.rs:2324 — codewhale_cli::cloud::run_agents has cyclomatic complexity 57 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codewhale_cli::run_config_command (cyclomatic 42) REDACTED:5355 — codewhale_cli::run_config_command 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.
  • codewhale_cli::run_auth_command_with_secrets_and_runtime (cyclomatic 38) REDACTED:4836 — codewhale_cli::run_auth_command_with_secrets_and_runtime 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.
  • codewhale_cli::cloud::work::quote (cyclomatic 31) crates/cli/src/cloud/work.rs:987 — codewhale_cli::cloud::work::quote 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.
  • codewhale_cli::metrics::read_audit_log (cyclomatic 31) crates/cli/src/metrics.rs:466 — codewhale_cli::metrics::read_audit_log 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.
  • codewhale_cli::cloud::work::write_work_result (cyclomatic 30) crates/cli/src/cloud/work.rs:524 — codewhale_cli::cloud::work::write_work_result has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codewhale_cli::cloud::run_with (cyclomatic 28) crates/cli/src/cloud.rs:3157 — codewhale_cli::cloud::run_with has cyclomatic complexity 28 (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.
  • codewhale_cli::update::run_update (cyclomatic 28) crates/cli/src/update.rs:53 — codewhale_cli::update::run_update 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.
  • codewhale_cli::metrics::print_human (cyclomatic 27) crates/cli/src/metrics.rs:1241 — codewhale_cli::metrics::print_human 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.
  • codewhale_cli::apply_tui_env (cyclomatic 25) REDACTED:6584 — codewhale_cli::apply_tui_env 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.
  • codewhale_cli::run_model_command (cyclomatic 24) REDACTED:5860 — codewhale_cli::run_model_command 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.
  • codewhale_cli::cloud::work::launch (cyclomatic 24) crates/cli/src/cloud/work.rs:1267 — codewhale_cli::cloud::work::launch 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.
  • codewhale_cli::config_bundles::prepare_import (cyclomatic 24) crates/cli/src/config_bundles.rs:1192 — codewhale_cli::config_bundles::prepare_import 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.
  • codewhale_cli::run_lane_command (cyclomatic 21) REDACTED:1084 — codewhale_cli::run_lane_command has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • codewhale_cli::cloud::run_computer_files (cyclomatic 21) crates/cli/src/cloud.rs:2905 — codewhale_cli::cloud::run_computer_files has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • codewhale_cli::cloud::work::assign (cyclomatic 20) crates/cli/src/cloud/work.rs:209 — codewhale_cli::cloud::work::assign 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.
  • codewhale_cli::update::compiled_host::prepare (cyclomatic 20) crates/cli/src/update/compiled_host.rs:286 — codewhale_cli::update::compiled_host::prepare 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.
  • codewhale_cli::dispatch::run (cyclomatic 19) crates/cli/src/dispatch.rs:50 — codewhale_cli::dispatch::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.
  • codewhale_cli::metrics::read_session_file (cyclomatic 19) crates/cli/src/metrics.rs:699 — codewhale_cli::metrics::read_session_file 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.
  • codewhale_cli::cloud::work::cancel (cyclomatic 18) crates/cli/src/cloud/work.rs:326 — codewhale_cli::cloud::work::cancel 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.
  • codewhale_cli::cloud::run_computers (cyclomatic 16) crates/cli/src/cloud.rs:2816 — codewhale_cli::cloud::run_computers 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.
  • codewhale_cli::cloud::validate_verification_url (cyclomatic 16) crates/cli/src/cloud.rs:3473 — codewhale_cli::cloud::validate_verification_url 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.
  • codewhale_cli::config_bundles::run_import (cyclomatic 16) crates/cli/src/config_bundles.rs:1542 — codewhale_cli::config_bundles::run_import 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.
D2 · Cognitive Complexity · RuntimeThreadManager · ×21
  • RuntimeThreadManager::monitor_turn (cognitive 379) crates/tui/src/runtime_threads.rs:17749 — RuntimeThreadManager::monitor_turn has cognitive complexity 379 (threshold 15). Drivers by points: if/else 100 (274 pts), match/switch 19 (59 pts), loops 9 (26 pts), boolean chains 20 (nesting depth added 231). 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.
  • RuntimeThreadManager::seed_thread_from_messages_with_history_operation (cognitive 116) crates/tui/src/runtime_threads.rs:13919 — RuntimeThreadManager::seed_thread_from_messages_with_history_operation has cognitive complexity 116 (threshold 15). Drivers by points: if/else 34 (86 pts), loops 9 (15 pts), match/switch 4 (13 pts), boolean chains 2 (nesting depth added 67). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RuntimeThreadManager::update_thread_under_history_guard (cognitive 82) crates/tui/src/runtime_threads.rs:11794 — RuntimeThreadManager::update_thread_under_history_guard has cognitive complexity 82 (threshold 15). Drivers by points: if/else 45 (55 pts), boolean chains 22, match/switch 3 (4 pts), loops 1 (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.
  • RuntimeThreadManager::start_turn_with_narrowing (cognitive 76) crates/tui/src/runtime_threads.rs:15298 — RuntimeThreadManager::start_turn_with_narrowing has cognitive complexity 76 (threshold 15). Drivers by points: if/else 51 (58 pts), boolean chains 13, match/switch 3 (5 pts) (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • RuntimeThreadManager::reconstruct_messages_from_turns_with (cognitive 63) crates/tui/src/runtime_threads.rs:17427 — RuntimeThreadManager::reconstruct_messages_from_turns_with has cognitive complexity 63 (threshold 15). Drivers by points: if/else 15 (46 pts), loops 6 (14 pts), match/switch 1 (3 pts) (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RuntimeThreadManager::recover_interrupted_state (cognitive 63) crates/tui/src/runtime_threads.rs:20114 — RuntimeThreadManager::recover_interrupted_state has cognitive complexity 63 (threshold 15). Drivers by points: if/else 18 (45 pts), loops 7 (11 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RuntimeThreadManager::prepare_fork_from_cutoff (cognitive 50) crates/tui/src/runtime_threads.rs:13520 — RuntimeThreadManager::prepare_fork_from_cutoff has cognitive complexity 50 (threshold 15). Drivers by points: if/else 19 (33 pts), match/switch 4 (10 pts), loops 3 (4 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.
  • RuntimeThreadManager::route_engine_events (cognitive 48) crates/tui/src/runtime_threads.rs:16832 — RuntimeThreadManager::route_engine_events has cognitive complexity 48 (threshold 15). Drivers by points: if/else 9 (25 pts), match/switch 6 (19 pts), loops 2 (3 pts), boolean chains 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.
  • RuntimeThreadManager::settle_claimed_turn_failure (cognitive 47) crates/tui/src/runtime_threads.rs:14700 — RuntimeThreadManager::settle_claimed_turn_failure has cognitive complexity 47 (threshold 15). Drivers by points: if/else 19 (29 pts), loops 5 (9 pts), match/switch 4 (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.
  • RuntimeThreadManager::ensure_engine_loaded (cognitive 47) crates/tui/src/runtime_threads.rs:16397 — RuntimeThreadManager::ensure_engine_loaded has cognitive complexity 47 (threshold 15). Drivers by points: if/else 20 (35 pts), boolean chains 5, loops 3 (5 pts), match/switch 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RuntimeThreadManager::aggregate_usage (cognitive 42) crates/tui/src/runtime_threads.rs:11418 — RuntimeThreadManager::aggregate_usage has cognitive complexity 42 (threshold 15). Drivers by points: if/else 8 (25 pts), loops 7 (15 pts), boolean chains 1, match/switch 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RuntimeThreadManager::shutdown_and_wait (cognitive 26) crates/tui/src/runtime_threads.rs:8410 — RuntimeThreadManager::shutdown_and_wait has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 9 (10 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.
  • RuntimeThreadManager::create_thread_with_reserved_id (cognitive 23) crates/tui/src/runtime_threads.rs:10912 — RuntimeThreadManager::create_thread_with_reserved_id has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 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.
  • RuntimeThreadManager::saved_session_prefix_from_session (cognitive 22) crates/tui/src/runtime_threads.rs:17321 — RuntimeThreadManager::saved_session_prefix_from_session has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 2 (4 pts), loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RuntimeThreadManager::spawn_dynamic_tool_settlement (cognitive 21) crates/tui/src/runtime_threads.rs:10623 — RuntimeThreadManager::spawn_dynamic_tool_settlement has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 3, 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.
  • RuntimeThreadManager::execute_dynamic_tool (cognitive 21) crates/tui/src/runtime_threads.rs:20403 — RuntimeThreadManager::execute_dynamic_tool has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 7 (18 pts), loops 1 (2 pts), if/else 1 (nesting depth added 12). 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.
  • RuntimeThreadManager::settle_claimed_user_input (cognitive 18) crates/tui/src/runtime_threads.rs:9048 — RuntimeThreadManager::settle_claimed_user_input has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RuntimeThreadManager::settle_thread_goal_after_turn (cognitive 18) crates/tui/src/runtime_threads.rs:9709 — RuntimeThreadManager::settle_thread_goal_after_turn has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 5, match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • RuntimeThreadManager::settle_dynamic_tools_for_terminal_turn (cognitive 16) crates/tui/src/runtime_threads.rs:10793 — RuntimeThreadManager::settle_dynamic_tools_for_terminal_turn has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (5 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.
  • RuntimeThreadManager::publish_fork (cognitive 16) crates/tui/src/runtime_threads.rs:13852 — RuntimeThreadManager::publish_fork has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 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.
  • RuntimeThreadManager::steer_turn (cognitive 16) crates/tui/src/runtime_threads.rs:16001 — RuntimeThreadManager::steer_turn has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, match/switch 3 (4 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
R11 · Import Boundaries · Boundary violation [package · ×21
  • Boundary violation [package:test-cross-package-internals] integrations/bridge-core/test/approvals.test.mjs:13 — integrations/bridge-core/test/approvals.test.mjs:13 reaches past another workspace package's public entry into its internals with a relative path (../../wecom-bridge/src/lib.mjs) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
  • Boundary violation [package:test-cross-package-internals] integrations/bridge-core/test/approvals.test.mjs:285 — integrations/bridge-core/test/approvals.test.mjs:285 reaches past another workspace package's public entry into its internals with a relative path (../../telegram-bridge/src/lib.mjs) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
  • Boundary violation [package:test-cross-package-internals] integrations/bridge-core/test/approvals.test.mjs:402 — integrations/bridge-core/test/approvals.test.mjs:402 reaches past another workspace package's public entry into its internals with a relative path (../../wecom-bridge/src/lib.mjs) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
  • Boundary violation [package:relative-cross-package] integrations/feishu-bridge/src/index.mjs:21 — integrations/feishu-bridge/src/index.mjs:21 reaches into another package with a relative path (../../bridge-core/src/lib.mjs) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] integrations/feishu-bridge/src/lib.mjs:1 — integrations/feishu-bridge/src/lib.mjs:1 reaches into another package with a relative path (../../bridge-core/src/lib.mjs) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] integrations/telegram-bridge/src/index.mjs:30 — integrations/telegram-bridge/src/index.mjs:30 reaches into another package with a relative path (../../bridge-core/src/lib.mjs) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] REDACTED:1 — REDACTED:1 reaches into another package with a relative path (../../bridge-core/src/lib.mjs) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] integrations/wecom-bridge/src/index.mjs:24 — integrations/wecom-bridge/src/index.mjs:24 reaches into another package with a relative path (../../bridge-core/src/lib.mjs) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] integrations/wecom-bridge/src/lib.mjs:1 — integrations/wecom-bridge/src/lib.mjs:1 reaches into another package with a relative path (../../bridge-core/src/lib.mjs) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] integrations/weixin-bridge/src/index.mjs:37 — integrations/weixin-bridge/src/index.mjs:37 reaches into another package with a relative path (../../bridge-core/src/lib.mjs) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] integrations/weixin-bridge/src/lib.mjs:3 — integrations/weixin-bridge/src/lib.mjs:3 reaches into another package with a relative path (../../bridge-core/src/lib.mjs) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] pet/scripts/lib/pet-runtime.mjs:24 — pet/scripts/lib/pet-runtime.mjs:24 reaches into another package with a relative path (../../../npm/runtime-sdk/index.js) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] scripts/release/assemble-release-assets.js:13 — scripts/release/assemble-release-assets.js:13 reaches into another package with a relative path (../../npm/codewhale/scripts/artifacts) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] scripts/release/assemble-release-assets.js:15 — scripts/release/assemble-release-assets.js:15 reaches into another package with a relative path (../../npm/codewhale/scripts/compiled-hosts) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] scripts/release/fetch-compiled-host-proof.js:7 — scripts/release/fetch-compiled-host-proof.js:7 reaches into another package with a relative path (../../npm/codewhale/scripts/compiled-hosts) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] scripts/release/prepare-local-release-assets.js:13 — scripts/release/prepare-local-release-assets.js:13 reaches into another package with a relative path (../../npm/codewhale/scripts/artifacts) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] scripts/release/stage-compiled-host.mjs:10 — scripts/release/stage-compiled-host.mjs:10 reaches into another package with a relative path (../../npm/codewhale/scripts/compiled-hosts.js) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] scripts/release/verify-release-inventory.js:27 — scripts/release/verify-release-inventory.js:27 reaches into another package with a relative path (../../npm/codewhale/scripts/artifacts) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] scripts/release/verify-release-inventory.js:28 — scripts/release/verify-release-inventory.js:28 reaches into another package with a relative path (../../npm/codewhale/scripts/compiled-hosts) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] web/scripts/derive-install.mjs:5 — web/scripts/derive-install.mjs:5 reaches into another package with a relative path (../../docs/INSTALL.md) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] web/scripts/derive-install.mjs:6 — web/scripts/derive-install.mjs:6 reaches into another package with a relative path (../../docs/zh_hans/INSTALL.md) — import the package by name instead.
D1 · Cyclomatic Complexity · RuntimeThreadManager · ×17
  • RuntimeThreadManager::monitor_turn (cyclomatic 186) crates/tui/src/runtime_threads.rs:17749 — RuntimeThreadManager::monitor_turn has cyclomatic complexity 186 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • RuntimeThreadManager::update_thread_under_history_guard (cyclomatic 63) crates/tui/src/runtime_threads.rs:11794 — RuntimeThreadManager::update_thread_under_history_guard has cyclomatic complexity 63 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • RuntimeThreadManager::start_turn_with_narrowing (cyclomatic 57) crates/tui/src/runtime_threads.rs:15298 — RuntimeThreadManager::start_turn_with_narrowing has cyclomatic complexity 57 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • RuntimeThreadManager::seed_thread_from_messages_with_history_operation (cyclomatic 50) crates/tui/src/runtime_threads.rs:13919 — RuntimeThreadManager::seed_thread_from_messages_with_history_operation 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.
  • RuntimeThreadManager::recover_interrupted_state (cyclomatic 34) crates/tui/src/runtime_threads.rs:20114 — RuntimeThreadManager::recover_interrupted_state 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.
  • RuntimeThreadManager::settle_claimed_turn_failure (cyclomatic 27) crates/tui/src/runtime_threads.rs:14700 — RuntimeThreadManager::settle_claimed_turn_failure 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.
  • RuntimeThreadManager::prepare_fork_from_cutoff (cyclomatic 26) crates/tui/src/runtime_threads.rs:13520 — RuntimeThreadManager::prepare_fork_from_cutoff 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.
  • RuntimeThreadManager::ensure_engine_loaded (cyclomatic 24) crates/tui/src/runtime_threads.rs:16397 — RuntimeThreadManager::ensure_engine_loaded 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.
  • RuntimeThreadManager::reconstruct_messages_from_turns_with (cyclomatic 24) crates/tui/src/runtime_threads.rs:17427 — RuntimeThreadManager::reconstruct_messages_from_turns_with 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.
  • RuntimeThreadManager::aggregate_usage (cyclomatic 19) crates/tui/src/runtime_threads.rs:11418 — RuntimeThreadManager::aggregate_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.
  • RuntimeThreadManager::route_engine_events (cyclomatic 19) crates/tui/src/runtime_threads.rs:16832 — RuntimeThreadManager::route_engine_events 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.
  • RuntimeThreadManager::shutdown_and_wait (cyclomatic 18) crates/tui/src/runtime_threads.rs:8410 — RuntimeThreadManager::shutdown_and_wait 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.
  • RuntimeThreadManager::settle_thread_goal_after_turn (cyclomatic 18) crates/tui/src/runtime_threads.rs:9709 — RuntimeThreadManager::settle_thread_goal_after_turn 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.
  • RuntimeThreadManager::steer_turn (cyclomatic 18) crates/tui/src/runtime_threads.rs:16001 — RuntimeThreadManager::steer_turn 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.
  • RuntimeThreadManager::deliver_agent_mail (cyclomatic 17) crates/tui/src/runtime_threads.rs:10110 — RuntimeThreadManager::deliver_agent_mail 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.
  • RuntimeThreadManager::create_thread_with_reserved_id (cyclomatic 16) crates/tui/src/runtime_threads.rs:10912 — RuntimeThreadManager::create_thread_with_reserved_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.
  • RuntimeThreadManager::lookup_turn_operation (cyclomatic 16) crates/tui/src/runtime_threads.rs:14524 — RuntimeThreadManager::lookup_turn_operation has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×17
  • Duplicated block (13 lines × 2) crates/core/src/prefix_cache.rs:816 — crates/core/src/prefix_cache.rs:816-828 | crates/runtime/src/prompt_zones.rs:34-46 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (13 lines × 2) crates/tui/src/commands/contract.rs:3203 — crates/tui/src/commands/contract.rs:3203-3215 | crates/tui/src/commands/contract.rs:3233-3245 — both copies are in the same file, so extract the 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) crates/tui/src/core/protocol_parity.rs:88 — crates/tui/src/core/protocol_parity.rs:88-100 | crates/tui/src/tools/subagent/mod.rs:18257-18269 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (13 lines × 2) crates/tui/src/fleet/files.rs:177 — crates/tui/src/fleet/files.rs:177-189 | crates/tui/src/tools/github/report.rs:517-529 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (13 lines × 2) crates/tui/src/fleet/ledger.rs:804 — crates/tui/src/fleet/ledger.rs:804-816 | crates/tui/src/fleet/ledger.rs:852-864 — both copies are in the same file, so extract the 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) crates/tui/src/fleet/ledger.rs:910 — crates/tui/src/fleet/ledger.rs:910-922 | crates/tui/src/fleet/ledger.rs:1026-1038 — both copies are in the same file, so extract the 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) crates/tui/src/lib.rs:2722 — crates/tui/src/lib.rs:2722-2734 | crates/tui/src/lib.rs:14416-14428 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_api/plans.rs:370 — crates/tui/src/runtime_api/plans.rs:370-382 | crates/tui/src/runtime_api/plans.rs:399-411 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_threads.rs:19403 — crates/tui/src/runtime_threads.rs:19403-19415 | crates/tui/src/runtime_threads.rs:19686-19698 — both copies are in the same file, so extract the 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) crates/tui/src/tools/subagent/coord.rs:818 — crates/tui/src/tools/subagent/coord.rs:818-830 | crates/tui/src/tools/subagent/mod.rs:12464-12476 — before extracting anything, compare `crates/tui/src/tools/subagent/coord.rs` and `crates/tui/src/tools/subagent/mod.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) crates/tui/src/tui/history/latex_render.rs:881 — crates/tui/src/tui/history/latex_render.rs:881-893 | crates/tui/src/tui/history/latex_render.rs:895-907 — both copies are in the same file, so extract the 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) crates/tui/src/tui/mouse_ui.rs:658 — crates/tui/src/tui/mouse_ui.rs:658-670 | crates/tui/src/tui/mouse_ui.rs:865-877 — both copies are in the same file, so extract the 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) crates/tui/src/tui/widgets/approval_band_legacy.rs:283 — crates/tui/src/tui/widgets/approval_band_legacy.rs:283-295 | crates/tui/src/tui/widgets/mod.rs:1808-1820 — before extracting anything, compare `crates/tui/src/tui/widgets/approval_band_legacy.rs` and `crates/tui/src/tui/widgets/mod.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) crates/tui/src/tui/widgets/composer_legacy.rs:205 — crates/tui/src/tui/widgets/composer_legacy.rs:205-217 | crates/tui/src/tui/widgets/mod.rs:1215-1227 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (13 lines × 2) crates/tui/src/tui/ui/event_loop.rs:7631 — crates/tui/src/tui/ui/event_loop.rs:7631-7643 | crates/tui/src/tui/ui/event_loop.rs:7848-7860 — both copies are in the same file, so extract the 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) crates/execpolicy/src/lib.rs:637 — crates/execpolicy/src/lib.rs:637-649 | crates/execpolicy/src/lib.rs:660-672 — both copies are in the same file, so extract the 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) crates/tui/src/sandbox/mod.rs:523 — crates/tui/src/sandbox/mod.rs:523-535 | crates/tui/src/sandbox/read_guard.rs:764-776 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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.
D29 · Static Analysis (SAST) · REDACTED · ×16
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×15
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×14
  • Duplicated block (15 lines × 2) crates/cli/src/metrics.rs:521 — crates/cli/src/metrics.rs:521-535 | crates/cli/src/metrics.rs:941-955 — both copies are in the same file, so extract the 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) crates/config/src/lib.rs:4760 — crates/config/src/lib.rs:4760-4774 | crates/tui/src/config.rs:9141-9155 — before extracting anything, compare `crates/config/src/lib.rs` and `crates/tui/src/config.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 171 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) crates/sanitize/src/sanitize.rs:164 — crates/sanitize/src/sanitize.rs:164-178 | crates/tui/src/tui/osc8.rs:279-293 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (15 lines × 2) crates/tui/src/commands/groups/skills/skills.rs:767 — crates/tui/src/commands/groups/skills/skills.rs:767-781 | crates/tui/src/commands/groups/skills/skills.rs:800-814 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) crates/tui/src/core/engine.rs:1951 — crates/tui/src/core/engine.rs:1951-1965 | crates/tui/src/core/engine.rs:2000-2014 — both copies are in the same file, so extract the 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) crates/tui/src/exec_agent.rs:645 — crates/tui/src/exec_agent.rs:645-659 | crates/tui/src/runtime_threads.rs:16653-16667 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (15 lines × 2) crates/tui/src/purge.rs:550 — crates/tui/src/purge.rs:550-564 | crates/tui/src/purge.rs:568-582 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_api.rs:9377 — crates/tui/src/runtime_api.rs:9377-9391 | crates/tui/src/runtime_api.rs:9426-9440 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_threads.rs:1796 — crates/tui/src/runtime_threads.rs:1796-1813 | crates/tui/src/runtime_threads.rs:1824-1838 — both copies are in the same file, so extract the 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) crates/tui/src/tools/review_core.rs:285 — crates/tui/src/tools/review_core.rs:285-299 | crates/tui/src/tools/review_core.rs:330-344 — both copies are in the same file, so extract the 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) crates/tui/src/tui/history/latex_render.rs:1336 — crates/tui/src/tui/history/latex_render.rs:1336-1350 | crates/tui/src/tui/history/latex_render.rs:1384-1398 — both copies are in the same file, so extract the 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) crates/tui/src/tui/widgets/mod.rs:810 — crates/tui/src/tui/widgets/mod.rs:810-824 | crates/tui/src/tui/widgets/transcript_legacy.rs:701-715 — before extracting anything, compare `crates/tui/src/tui/widgets/mod.rs` and `crates/tui/src/tui/widgets/transcript_legacy.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 778 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) crates/tui/src/tui/ui/event_loop.rs:2189 — crates/tui/src/tui/ui/event_loop.rs:2189-2203 | crates/tui/src/tui/ui/event_loop.rs:2259-2273 — both copies are in the same file, so extract the 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) crates/tui/src/fleet/manager.rs:1386 — crates/tui/src/fleet/manager.rs:1386-1400 | crates/tui/src/fleet/manager.rs:1427-1441 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D2 · Cognitive Complexity · codewhale_execpolicy · ×13
  • codewhale_execpolicy::shell_expand::command_heads (cognitive 108) crates/execpolicy/src/shell_expand.rs:1913 — codewhale_execpolicy::shell_expand::command_heads has cognitive complexity 108 (threshold 15). Drivers by points: if/else 23 (76 pts), match/switch 4 (18 pts), boolean chains 8, loops 2 (6 pts) (nesting depth added 71). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • codewhale_execpolicy::shell_expand::mark_replacement_operands (cognitive 56) crates/execpolicy/src/shell_expand.rs:1570 — codewhale_execpolicy::shell_expand::mark_replacement_operands has cognitive complexity 56 (threshold 15). Drivers by points: if/else 12 (40 pts), loops 4 (9 pts), match/switch 1 (4 pts), boolean chains 3 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_execpolicy::command_safety::lex_readonly_command (cognitive 54) crates/execpolicy/src/command_safety.rs:726 — codewhale_execpolicy::command_safety::lex_readonly_command has cognitive complexity 54 (threshold 15). Drivers by points: if/else 13 (35 pts), match/switch 3 (9 pts), loops 3 (7 pts), boolean chains 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.
  • codewhale_execpolicy::command_safety::analyze_command (cognitive 35) crates/execpolicy/src/command_safety.rs:1798 — codewhale_execpolicy::command_safety::analyze_command has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 12, loops 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • codewhale_execpolicy::shell_expand::shell_input (cognitive 34) crates/execpolicy/src/shell_expand.rs:2107 — codewhale_execpolicy::shell_expand::shell_input has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 6, match/switch 2 (5 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_execpolicy::denied_prefix_matches (cognitive 29) crates/execpolicy/src/lib.rs:881 — codewhale_execpolicy::denied_prefix_matches has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 3, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_execpolicy::shell_expand::read_substitution (cognitive 26) crates/execpolicy/src/shell_expand.rs:1765 — codewhale_execpolicy::shell_expand::read_substitution has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (7 pts), match/switch 2 (6 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_execpolicy::command_safety::agent_text_filter_options_match (cognitive 20) crates/execpolicy/src/command_safety.rs:1321 — codewhale_execpolicy::command_safety::agent_text_filter_options_match has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 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.
  • codewhale_execpolicy::command_safety::options_match_allowlist (cognitive 19) crates/execpolicy/src/command_safety.rs:1504 — codewhale_execpolicy::command_safety::options_match_allowlist has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 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.
  • codewhale_execpolicy::shell_expand::command_option_payloads (cognitive 19) crates/execpolicy/src/shell_expand.rs:1530 — codewhale_execpolicy::shell_expand::command_option_payloads has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 2 (7 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_execpolicy::command_safety::walk_invocations::collect (cognitive 17) crates/execpolicy/src/command_safety.rs:2159 — codewhale_execpolicy::command_safety::walk_invocations::collect has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (8 pts), if/else 3 (5 pts), boolean chains 4 (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.
  • codewhale_execpolicy::command_safety::agent_segment_verdict (cognitive 16) crates/execpolicy/src/command_safety.rs:1048 — codewhale_execpolicy::command_safety::agent_segment_verdict has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), match/switch 3 (6 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.
  • codewhale_execpolicy::command_safety::github_command_targets_unsupported_host (cognitive 16) crates/execpolicy/src/command_safety.rs:1540 — codewhale_execpolicy::command_safety::github_command_targets_unsupported_host has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D17 · Explicit Debt · TodoComment · ×12
  • TodoComment crates/tui/src/work_graph/reducer.rs:335 — // todo list on every call, so once an item is cancelled every later call — 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 crates/tui/src/tui/app.rs:2275 — /// Todo list for the canonical `work_update` progress surface. — 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 crates/tui/src/tui/phase_strip.rs:988 — // TODO view title; it disappears while the dock is up. — 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 crates/tui/src/tui/work_surface/input.rs:48 — // when another view was up (the dock opens on TODO), any painted row — 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 crates/tui/src/tui/work_surface/mod.rs:3794 — /// dock opens on TODO; AGENTS is the next tab (founder, 2026-09-03). — 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 crates/tui/src/tui/work_surface/model.rs:161 — /// text beside them. The plan-step list reads TODO, not TASKS — the — 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 crates/tui/src/tui/work_surface/model.rs:884 — // open on TODO when the workers themselves live one tab over. — 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 crates/tui/src/tui/work_surface/render/layout.rs:58 — // resolved view stays TODO. — 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 crates/tui/src/tui/widgets/agent_card.rs:814 — // The oldest two actions ("read README.md", "grep TODO") were dropped. — 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 crates/tui/src/tui/ui/frame.rs:721 — /// → BACKGROUND, automations → their own view, the idle `todo` word → TODO). — 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 crates/tui/src/tools/todo.rs:1 — //! Todo list tool and supporting data structures. — 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 crates/tui/src/commands/user_commands.rs:736 — // todo list and a non-empty plan. These should NOT bleed into the — 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.
D35 · Change Coupling · Change coupling · ×12
  • Change coupling: REDACTED ↔ mod.rs crates/localization/src/lib.rs:1 — `crates/localization/src/lib.rs` and `crates/tui/src/commands/groups/core/mod.rs` 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, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `32e8b637` feat(tui): /router setup view with tested presets (also /model router); `9f9a3d86` feat(tui): add copy command for latest response (at that commit the file was still `crates/tui/src/localization.rs`); `3c363039` feat(tui): /workflows run dashboard backed by the durable run journal (at that commit the file was still `crates/tui/src/localization.rs`) — run `git show` on any of them.
  • Change coupling: darwin.mjs ↔ tools.mjs crates/tui/plugins/computer-use/src/backends/darwin.mjs:1 — `crates/tui/plugins/computer-use/src/backends/darwin.mjs` and `crates/tui/plugins/computer-use/src/tools.mjs` 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, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `87cdaea8` feat(cu): integrate current Driver observation and named-batch contracts; `433bae98` fix(computer-use): keep capture output paths in the recordings directory; `d91125ae` Sync vendored Computer Use @ 17c30c5: agent never drives the user's c… — run `git show` on any of them.
  • Change coupling: REDACTED ↔ contract.rs crates/tui/src/config/search.rs:1 — `crates/tui/src/config/search.rs` and `crates/tui/src/tools/web/contract.rs` change together 70% of the time (7 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `85688ac2` feat(search): DeepSeek Search API as a web_search backend; `96555d81` fix(search): a pinned provider wins over native search; full native a…; `636bd4d9` Revert "Add TinyFish as a first-class search provider with key autode… — run `git show` on any of them.
  • Change coupling: setup.rs ↔ mod.rs crates/tui/src/commands/groups/core/setup.rs:1 — `crates/tui/src/commands/groups/core/setup.rs` and `crates/tui/src/tui/setup/mod.rs` 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, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `4009d592` Add persistence setup card; `ee741dd9` Add tools MCP setup card; `198ec3a0` Add remote runtime setup card — run `git show` on any of them.
  • Change coupling: session.rs ↔ REDACTED crates/tui/src/commands/groups/session/session.rs:1 — `crates/tui/src/commands/groups/session/session.rs` and `crates/tui/src/tui/ui/tests.rs` change together 61% of the time (14 of the 23 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 14 shared commits counted here, the most recent 3 are `2365ead4` fix(cost): count detached interactive agent usage in session totals; `81e2c4a7` fix(tui): dedupe child usage by response; `df0afabb` fix(gates): land the owed workspace clippy baseline (-D warnings) and… — run `git show` on any of them.
  • Change coupling: REDACTED ↔ REDACTED crates/agent/src/lib.rs:1 — `crates/agent/src/lib.rs` and `crates/config/src/lib.rs` change together 57% of the time (17 of the 30 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 17 shared commits counted here, the most recent 3 are `c5e69b82` feat(models): add current Anthropic, OpenAI, Google and Z.ai models; …; `e2470e9f` feat(providers): add CSDN 星图 with Coding Plan billing; `ba62522a` feat(providers): add ModelScope as a built-in provider — run `git show` on any of them.
  • Change coupling: external_editor.rs ↔ REDACTED crates/tui/src/tui/external_editor.rs:1 — `crates/tui/src/tui/external_editor.rs` and `crates/tui/src/tui/ui/tests.rs` 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, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `dd5d7e4f` fix(tui): pause the input pump inside the editor handoff, not at each…; `07226b2d` fix(tui): make notifications background-only by default; `d794cd12` fix(tui): keep alternate scroll off while mouse capture is active (#5… — run `git show` on any of them.
  • Change coupling: session.rs ↔ ui.rs crates/tui/src/commands/groups/session/session.rs:1 — `crates/tui/src/commands/groups/session/session.rs` and `crates/tui/src/tui/ui.rs` 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, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 12 shared commits counted here, the most recent 3 are `53d3d5fe` refactor(tui): delete the unrendered Sessions rail cache; `5f977ec2` fix(tui): address auto reasoning review gaps; `4f266694` feat(tui): sessions rail, picker archive controls, and rail handoff (… — run `git show` on any of them.
  • Change coupling: agent_details.rs ↔ mod.rs crates/tui/src/tui/agent_details.rs:1 — `crates/tui/src/tui/agent_details.rs` and `crates/tui/src/tui/work_surface/mod.rs` change together 50% of the time (7 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `ab9d13b0` feat(agents): show a parked child as parked, not "waiting for input"; `4ed1869a` feat(subagent): persist child route receipts (#5305); `3815bd70` feat(tui): open an agent's transcript directly from every agent row — run `git show` on any of them.
  • Change coupling: REDACTED ↔ footer.tsx web/app/[locale]/page.tsx:1 — `web/app/[locale]/page.tsx` and `web/components/footer.tsx` change together 50% of the time (7 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `095588c5` fix(web): keep shared branding locale-neutral; `f77d6dfd` feat(web): surface the getting-started path in the homepage, nav, and…; `3714b8a4` fix(web): enforce source-backed public facts — run `git show` on any of them.
  • Change coupling: voice.rs ↔ event_loop.rs crates/tui/src/commands/groups/core/voice.rs:1 — `crates/tui/src/commands/groups/core/voice.rs` and `crates/tui/src/tui/ui/event_loop.rs` 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, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `a1b7888b` fix(tui): repaint when a session preview lands; voice status says how…; `47834cc6` fix(runtime): keep blocking calls off Tokio workers (#6149); `f7b5c412` feat(openrouter): pin upstream vendors across request paths — run `git show` on any of them.
  • Change coupling: auto_review.rs ↔ repo_law.rs crates/tui/src/core/authority/auto_review.rs:1 — `crates/tui/src/core/authority/auto_review.rs` and `crates/tui/src/repo_law.rs` 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, and counted over this repository's 10,000 most recent commits rather than its whole history — 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 — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `2dfe79ac` WIP: preserve recovered file-policy alignment work (UNVERIFIED) (at that commit the file was still `crates/tui/src/tui/auto_review.rs`); `59299dff` fix(tui): make Auto-Review risk-first (at that commit the file was still `crates/tui/src/tui/auto_review.rs`); `de15b5c6` fix(tui): align permission postures and compact approvals (#4608) (at that commit the file was still `crates/tui/src/tui/auto_review.rs`) — run `git show` on any of them.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×12
  • Duplicated block (17 lines × 2) crates/secrets/src/lib.rs:246 — crates/secrets/src/lib.rs:246-262 | crates/secrets/src/lib.rs:311-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.
  • Duplicated block (17 lines × 2) crates/tui/src/core/engine/tool_catalog.rs:1679 — crates/tui/src/core/engine/tool_catalog.rs:1679-1695 | crates/tui/src/tools/js_execution.rs:182-198 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (17 lines × 2) crates/tui/src/core/engine/turn_loop.rs:3206 — crates/tui/src/core/engine/turn_loop.rs:3206-3222 | crates/tui/src/core/engine/turn_loop.rs:3263-3279 — both copies are in the same file, so extract the 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) crates/tui/src/fleet/manager.rs:1789 — crates/tui/src/fleet/manager.rs:1789-1805 | crates/tui/src/fleet/manager.rs:1852-1868 — both copies are in the same file, so extract the 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) crates/tui/src/plugins/marketplace/parsers/claude.rs:603 — crates/tui/src/plugins/marketplace/parsers/claude.rs:603-619 | crates/tui/src/plugins/marketplace/parsers/codex.rs:418-434 — before extracting anything, compare `crates/tui/src/plugins/marketplace/parsers/claude.rs` and `crates/tui/src/plugins/marketplace/parsers/codex.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 93 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (17 lines × 2) crates/tui/src/runtime_threads.rs:19328 — crates/tui/src/runtime_threads.rs:19328-19344 | crates/tui/src/runtime_threads.rs:19370-19386 — both copies are in the same file, so extract the 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) crates/tui/src/tui/command_palette.rs:838 — crates/tui/src/tui/command_palette.rs:838-854 | crates/tui/src/tui/views/mod.rs:4187-4203 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (17 lines × 2) crates/tui/src/tui/history.rs:3192 — crates/tui/src/tui/history.rs:3192-3208 | crates/tui/src/tui/history.rs:3239-3255 — both copies are in the same file, so extract the 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) crates/tui/src/tui/history/latex_render.rs:1365 — crates/tui/src/tui/history/latex_render.rs:1365-1381 | crates/tui/src/tui/history/latex_render.rs:1402-1418 — both copies are in the same file, so extract the 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) crates/tui/src/tui/ui/apply.rs:1287 — crates/tui/src/tui/ui/apply.rs:1287-1303 | crates/tui/src/tui/ui/provider_routes.rs:826-842 — before extracting anything, compare `crates/tui/src/tui/ui/apply.rs` and `crates/tui/src/tui/ui/provider_routes.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (17 lines × 2) crates/tui/src/tui/widgets/mod.rs:119 — crates/tui/src/tui/widgets/mod.rs:119-135 | crates/tui/src/tui/widgets/transcript_legacy.rs:82-98 — before extracting anything, compare `crates/tui/src/tui/widgets/mod.rs` and `crates/tui/src/tui/widgets/transcript_legacy.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 778 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (17 lines × 2) crates/tui/src/hooks/executor.rs:1233 — crates/tui/src/hooks/executor.rs:1233-1251 | crates/tui/src/hooks/executor.rs:1386-1402 — both copies are in the same file, so extract the 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 · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×11
  • Members sharing a duplicated core (4 members, 50+ identical tokens) REDACTED:3214 — REDACTED:3214-3228 | REDACTED:4196-4226 | crates/tui/src/commands/config_main_host.rs:2865-2880 | crates/tui/src/commands/contract/config_main.rs:336-369 — 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) crates/config/src/lib.rs:4759 — crates/config/src/lib.rs:4759-4774 | crates/config/src/provider.rs:457-471 | crates/config/src/provider.rs:476-492 | crates/tui/src/config.rs:9140-9155 — 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) crates/tui/src/commands/contract.rs:4187 — crates/tui/src/commands/contract.rs:4187-4233 | crates/tui/src/commands/contract.rs:4235-4269 | crates/tui/src/commands/contract.rs:4271-4307 | crates/tui/src/commands/contract.rs:4445-4482 — 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) crates/tui/src/compaction.rs:2353 — crates/tui/src/compaction.rs:2353-2368 | crates/tui/src/compaction/last_round.rs:394-409 | crates/tui/src/remote_control.rs:3142-3166 | crates/tui/src/superfast.rs:242-255 — 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) crates/tui/src/core/engine/context.rs:81 — crates/tui/src/core/engine/context.rs:81-89 | crates/tui/src/notify/payload.rs:279-287 | crates/tui/src/purge.rs:266-274 | crates/tui/src/rlm/session.rs:415-423 — 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) crates/tui/src/remote_control.rs:358 — crates/tui/src/remote_control.rs:358-380 | crates/tui/src/runtime_chat_relay.rs:1695-1715 | crates/tui/src/runtime_threads.rs:7498-7529 | crates/tui/src/session_manager.rs:1580-1603 — 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) crates/tui/src/tui/setup/mod.rs:3272 — crates/tui/src/tui/setup/mod.rs:3272-3375 | crates/tui/src/tui/views/fleet_roster.rs:546-730 | crates/tui/src/tui/views/fleet_setup.rs:2500-2723 | crates/tui/src/tui/views/fleet_setup.rs:2781-2797 — 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) crates/tui/src/tui/ui.rs:559 — crates/tui/src/tui/ui.rs:559-586 | crates/tui/src/tui/ui/apply.rs:1204-1320 | crates/tui/src/tui/ui/provider_routes.rs:654-887 | crates/tui/src/tui/ui/session_state.rs:924-964 — 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) crates/tui/src/tui/views/fleet_detail.rs:970 — crates/tui/src/tui/views/fleet_detail.rs:970-1024 | crates/tui/src/tui/views/fleet_list.rs:380-431 | crates/tui/src/tui/views/fleet_roster.rs:457-531 | crates/tui/src/tui/views/workflows_manager.rs:551-574 — 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) crates/tui/src/client/test_cases_01.rs:419 — crates/tui/src/client/test_cases_01.rs:419-437 | crates/tui/src/client/test_cases_01.rs:443-462 | crates/tui/src/client/test_cases_01.rs:468-487 | crates/tui/src/client/test_cases_01.rs:1595-1614 — 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) crates/tui/src/client/test_cases_01.rs:894 — crates/tui/src/client/test_cases_01.rs:894-969 | crates/tui/src/client/test_cases_01.rs:1451-1502 | crates/tui/src/client/test_cases_01.rs:1508-1561 | crates/tui/src/client/test_cases_05.rs:53-148 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×11
  • Duplicated block (18 lines × 2) REDACTED:4608 — REDACTED:4608-4625 | REDACTED:4761-4778 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) crates/config/src/xai_credentials.rs:505 — crates/config/src/xai_credentials.rs:505-522 | crates/config/src/xai_credentials.rs:536-553 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) crates/localization/src/lib.rs:75 — crates/localization/src/lib.rs:75-92 | crates/localization/src/lib.rs:96-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 (18 lines × 2) crates/tui/src/client.rs:6482 — crates/tui/src/client.rs:6482-6499 | crates/tui/src/client.rs:6585-6602 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) crates/tui/src/lib.rs:4530 — crates/tui/src/lib.rs:4530-4547 | crates/tui/src/lib.rs:4554-4571 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) crates/tui/src/remote_control.rs:363 — crates/tui/src/remote_control.rs:363-380 | crates/tui/src/runtime_chat_relay.rs:1698-1715 — before extracting anything, compare `crates/tui/src/remote_control.rs` and `crates/tui/src/runtime_chat_relay.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (18 lines × 2) crates/tui/src/runtime_threads.rs:18038 — crates/tui/src/runtime_threads.rs:18038-18055 | crates/tui/src/runtime_threads.rs:18113-18130 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) crates/tui/src/tui/tool_routing.rs:85 — crates/tui/src/tui/tool_routing.rs:85-102 | crates/tui/src/tui/tool_routing.rs:124-141 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) crates/tui/src/tui/ui/event_loop.rs:4416 — crates/tui/src/tui/ui/event_loop.rs:4416-4433 | crates/tui/src/tui/ui/event_loop.rs:4495-4512 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) crates/tui/src/tui/widgets/approval_band_legacy.rs:1160 — crates/tui/src/tui/widgets/approval_band_legacy.rs:1160-1177 | crates/tui/src/tui/widgets/mod.rs:2289-2306 — before extracting anything, compare `crates/tui/src/tui/widgets/approval_band_legacy.rs` and `crates/tui/src/tui/widgets/mod.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (18 lines × 2) crates/tui/src/client/test_cases_01.rs:1463 — crates/tui/src/client/test_cases_01.rs:1463-1480 | crates/tui/src/client/test_cases_01.rs:1520-1537 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D1 · Cyclomatic Complexity · Config · ×10
  • Config::resolve_active_route_api_key (cyclomatic 61) crates/tui/src/config.rs:6170 — Config::resolve_active_route_api_key has cyclomatic complexity 61 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Config::default_model (cyclomatic 31) crates/tui/src/config.rs:5308 — Config::default_model 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. This is NOT this file's highest cyclomatic complexity: codewhale_tui::config::provider_env_base_url_override (cyclomatic 36) 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 function is counted neither in this dimension's figures nor in its score.
  • Config::validate (cyclomatic 24) crates/tui/src/config.rs:4038 — Config::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. This is NOT this file's highest cyclomatic complexity: codewhale_tui::config::provider_env_base_url_override (cyclomatic 36) 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 function is counted neither in this dimension's figures nor in its score.
  • Config::runtime_preset_blocker (cyclomatic 22) crates/tui/src/config.rs:3328 — Config::runtime_preset_blocker 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. This is NOT this file's highest cyclomatic complexity: codewhale_tui::config::provider_env_base_url_override (cyclomatic 36) 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 function is counted neither in this dimension's figures nor in its score.
  • Config::apply_saved_selection (cyclomatic 20) crates/tui/src/config.rs:3936 — Config::apply_saved_selection has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: codewhale_tui::config::provider_env_base_url_override (cyclomatic 36) 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 function is counted neither in this dimension's figures nor in its score.
  • Config::resolve_persisted_provider_identity (cyclomatic 20) crates/tui/src/config.rs:4610 — Config::resolve_persisted_provider_identity has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: codewhale_tui::config::provider_env_base_url_override (cyclomatic 36) 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 function is counted neither in this dimension's figures nor in its score.
  • Config::resolve_provider_identity (cyclomatic 19) crates/tui/src/config.rs:4363 — Config::resolve_provider_identity has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: codewhale_tui::config::provider_env_base_url_override (cyclomatic 36) 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 function is counted neither in this dimension's figures nor in its score.
  • Config::readonly_health_credential_generation (cyclomatic 18) crates/tui/src/config.rs:5961 — Config::readonly_health_credential_generation has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: codewhale_tui::config::provider_env_base_url_override (cyclomatic 36) 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 function is counted neither in this dimension's figures nor in its score.
  • Config::approval_policy_control (cyclomatic 17) crates/tui/src/config.rs:3458 — Config::approval_policy_control has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: codewhale_tui::config::provider_env_base_url_override (cyclomatic 36) 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 function is counted neither in this dimension's figures nor in its score.
  • Config::allow_shell_control (cyclomatic 16) crates/tui/src/config.rs:3556 — Config::allow_shell_control has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: codewhale_tui::config::provider_env_base_url_override (cyclomatic 36) 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 function is counted neither in this dimension's figures nor in its score.
D10 · Test Quality · Fixed-sleep synchronisation · ×10
  • Fixed-sleep synchronisation: the CLI follows real Runtime SSE envelopes through disconnect and cursor recovery, recording no prompt content pet/tests/pet-runtime.test.mjs:81 — This test starts work it did not wait for (`exited`, still running when the sleep starts) and then orders itself against it with `delay(25)` — 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.
  • Fixed-sleep synchronisation: live Runtime recording retains human waits and a brief late failure exactly once between timer ticks pet/tests/pet-runtime.test.mjs:139 — This test starts work it did not wait for (`exited`, still running when the sleep starts) and then orders itself against it with `delay(20)` — 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.
  • Fixed-sleep synchronisation: replayed requests remain unknown until catch-up, including reentry to replay after a live connection pet/tests/pet-runtime.test.mjs:190 — This test starts work it did not wait for (`wait`, still running when the sleep starts) and then orders itself against it with `delay(450)` — 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.
  • Fixed-sleep synchronisation: human Pause and Stop cannot be bypassed; a lost owner exits and can reopen stopped crates/tui/plugins/computer-use/tests/app-controls.test.mjs:58 — This test starts work it did not wait for (`control`, still running when the sleep starts) and then orders itself against it with `delay(200)` — 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.
  • Fixed-sleep synchronisation: browser navigate waits for load and reports url+title from the target, not from us crates/tui/plugins/computer-use/tests/browser-cdp.test.mjs:117 — This test starts work it did not wait for (`nav`, still running when the sleep starts) and then orders itself against it with `new Promise((r) => setTimeout(r, 5))` — 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.
  • Fixed-sleep synchronisation: recording startup cancellation owns and stops the pending child crates/tui/plugins/computer-use/tests/darwin-recording.test.mjs:68 — This test starts work it did not wait for (`owner`, still running when the sleep starts) and then orders itself against it with `new Promise(resolve => setTimeout(resolve, 10))` — 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.
  • Fixed-sleep synchronisation: Harmony route close aborts a pending capture, retains frames, and stops its timer crates/tui/plugins/computer-use/tests/harmony-route-lifecycle.test.mjs:91 — This test starts work it did not wait for (`f`, still running when the sleep starts) and then orders itself against it with `delay(350)` — 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.
  • Fixed-sleep synchronisation: Harmony close during its initial frame preserves partial output and prevents a late timer crates/tui/plugins/computer-use/tests/harmony-route-lifecycle.test.mjs:110 — This test starts work it did not wait for (`f`, still running when the sleep starts) and then orders itself against it with `delay(350)` — 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.
  • Fixed-sleep synchronisation: Harmony recording startup cancellation propagates to its owned frame crates/tui/plugins/computer-use/tests/harmony-route-lifecycle.test.mjs:125 — This test starts work it did not wait for (`f`, still running when the sleep starts) and then orders itself against it with `delay(350)` — 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.
  • Fixed-sleep synchronisation: Harmony failed quiesce retains recorder ownership until a later cleanup succeeds crates/tui/plugins/computer-use/tests/harmony-route-lifecycle.test.mjs:140 — This test starts work it did not wait for (`f`, still running when the sleep starts) and then orders itself against it with `delay(350)` — 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.
D2 · Cognitive Complexity · Config · ×10
  • Config::resolve_active_route_api_key (cognitive 60) crates/tui/src/config.rs:6170 — Config::resolve_active_route_api_key has cognitive complexity 60 (threshold 15). Drivers by points: if/else 29 (35 pts), boolean chains 16, match/switch 5 (9 pts) (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Config::default_model (cognitive 33) crates/tui/src/config.rs:5308 — Config::default_model has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 13 (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.
  • Config::validate (cognitive 31) crates/tui/src/config.rs:4038 — Config::validate has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 4, match/switch 2 (4 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Config::apply_saved_selection (cognitive 30) crates/tui/src/config.rs:3936 — Config::apply_saved_selection has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (23 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.
  • Config::resolve_provider_identity (cognitive 27) crates/tui/src/config.rs:4363 — Config::resolve_provider_identity has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 7 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Config::resolve_persisted_provider_identity (cognitive 26) crates/tui/src/config.rs:4610 — Config::resolve_persisted_provider_identity has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 7, match/switch 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Config::runtime_preset_blocker (cognitive 24) crates/tui/src/config.rs:3328 — Config::runtime_preset_blocker has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 9, match/switch 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.
  • Config::approval_policy_control (cognitive 22) crates/tui/src/config.rs:3458 — Config::approval_policy_control has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (17 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
  • Config::allow_shell_control (cognitive 20) crates/tui/src/config.rs:3556 — Config::allow_shell_control has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3, match/switch 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.
  • Config::readonly_health_credential_generation (cognitive 18) crates/tui/src/config.rs:5961 — Config::readonly_health_credential_generation has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11, boolean chains 5, match/switch 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.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×10
  • Duplicated block (6 lines × 3) crates/config/src/config_document.rs:422 — crates/config/src/config_document.rs:422-428 | crates/config/src/private_directory.rs:1045-1050 | crates/runtime/src/external_credentials.rs:302-308 — before extracting anything, compare `crates/config/src/private_directory.rs` and `crates/runtime/src/external_credentials.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 3) crates/tui/src/runtime_api.rs:11440 — crates/tui/src/runtime_api.rs:11440-11445 | crates/tui/src/runtime_api.rs:11516-11521 | crates/tui/src/runtime_api.rs:11561-11566 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) crates/tui/src/runtime_threads.rs:2621 — crates/tui/src/runtime_threads.rs:2621-2626 | crates/tui/src/runtime_threads.rs:7356-7361 | crates/tui/src/runtime_threads.rs:20813-20819 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) crates/tui/src/tools/session.rs:118 — crates/tui/src/tools/session.rs:118-123 | crates/tui/src/tools/session.rs:203-208 | crates/tui/src/tools/tui_help.rs:113-118 — 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 (6 lines × 3) crates/tui/src/tui/approval/elevation.rs:239 — crates/tui/src/tui/approval/elevation.rs:239-244 | crates/tui/src/tui/approval/view.rs:433-438 | crates/tui/src/tui/views/mode_picker.rs:121-126 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (6 lines × 3) crates/tui/src/tui/views/fleet_roster.rs:719 — crates/tui/src/tui/views/fleet_roster.rs:719-724 | crates/tui/src/tui/views/fleet_setup.rs:2712-2717 | crates/tui/src/tui/views/fleet_setup.rs:2786-2791 — 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 (6 lines × 3) crates/tui/src/tools/automation.rs:294 — crates/tui/src/tools/automation.rs:294-299 | crates/tui/src/tools/github/mod.rs:194-199 | crates/tui/src/tools/tasks.rs:369-374 — before extracting anything, compare `crates/tui/src/tools/automation.rs` and `crates/tui/src/tools/tasks.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 3) crates/tui/src/tools/git_tool.rs:45 — crates/tui/src/tools/git_tool.rs:45-50 | crates/tui/src/tools/run_tool.rs:44-49 | crates/tui/src/tools/web_tool.rs:45-50 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (6 lines × 3) crates/tui/src/remote_control.rs:3206 — crates/tui/src/remote_control.rs:3206-3211 | crates/tui/src/runtime_chat_relay.rs:1477-1482 | crates/tui/src/runtime_chat_relay.rs:1516-1521 — before extracting anything, compare `crates/tui/src/remote_control.rs` and `crates/tui/src/runtime_chat_relay.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 3) crates/tui/src/tools/speech.rs:192 — crates/tui/src/tools/speech.rs:192-197 | crates/tui/src/tools/speech.rs:200-205 | crates/tui/src/tools/verify.rs:398-403 — 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.
D6 · Cohesion (LCOM4) · Low cohesion · ×10
  • Low cohesion: ToolContext (LCOM4 27) crates/tui/src/tools/spec.rs:563 — ToolContext's methods fall into 27 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 27 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Config (LCOM4 11) crates/tui/src/config.rs:1949 — Config's methods fall into 11 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 11 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: App (LCOM4 9) crates/tui/src/tui/app.rs:1555 — App's methods fall into 9 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: EngineHandle (LCOM4 7) crates/tui/src/core/engine.rs:720 — EngineHandle's methods fall into 7 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: RuntimeThreadStore (LCOM4 6) crates/tui/src/runtime_threads.rs:2440 — RuntimeThreadStore's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: SessionCounters (LCOM4 4) crates/telemetry/src/counters.rs:17 — SessionCounters's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: PluginRegistry (LCOM4 4) crates/tui/src/plugins/registry.rs:65 — PluginRegistry's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: CommandSpec (LCOM4 4) crates/tui/src/sandbox/mod.rs:80 — CommandSpec's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: SnapshotRepo (LCOM4 4) crates/tui/src/snapshot/repo.rs:174 — SnapshotRepo's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: PagerPage (LCOM4 4) crates/tui/src/tui/pager.rs:54 — PagerPage's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
D2 · Cognitive Complexity · codewhale_config · ×9
  • codewhale_config::cloud_facts::verify::verify_envelope (cognitive 49) crates/config/src/cloud_facts/verify.rs:154 — codewhale_config::cloud_facts::verify::verify_envelope has cognitive complexity 49 (threshold 15). Drivers by points: if/else 30 (37 pts), boolean chains 10, loops 2 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • codewhale_config::cloud_facts::scope::scoped_view (cognitive 45) crates/config/src/cloud_facts/scope.rs:107 — codewhale_config::cloud_facts::scope::scoped_view has cognitive complexity 45 (threshold 15). Drivers by points: if/else 18 (34 pts), boolean chains 8, loops 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.
  • codewhale_config::catalog::offerings_from_models_dev (cognitive 35) crates/config/src/catalog.rs:623 — codewhale_config::catalog::offerings_from_models_dev has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (30 pts), loops 3 (4 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.
  • codewhale_config::cloud_facts::catalog_patch::apply_patches (cognitive 32) crates/config/src/cloud_facts/catalog_patch.rs:62 — codewhale_config::cloud_facts::catalog_patch::apply_patches has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (21 pts), match/switch 3 (8 pts), boolean chains 2, 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.
  • codewhale_config::legacy_root::plan_scope (cognitive 31) crates/config/src/legacy_root.rs:473 — codewhale_config::legacy_root::plan_scope has cognitive complexity 31 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 9 (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.
  • codewhale_config::catalog::configured::validate_configured_models (cognitive 27) crates/config/src/catalog/configured.rs:70 — codewhale_config::catalog::configured::validate_configured_models has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 10, 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.
  • codewhale_config::private_directory::open_owned_directory (cognitive 26) crates/config/src/private_directory.rs:105 — codewhale_config::private_directory::open_owned_directory has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 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.
  • codewhale_config::notifications::edit_extras (cognitive 17) crates/config/src/notifications.rs:428 — codewhale_config::notifications::edit_extras has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 2, loops 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_config::merge_decor_table (cognitive 16) crates/config/src/lib.rs:6070 — codewhale_config::merge_decor_table has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 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.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×9
  • Duplicated block (12–13 lines × 2) crates/lane/src/control.rs:1904 — crates/lane/src/control.rs:1904-1916 | crates/lane/src/control.rs:1967-1978 — both copies are in the same file, so extract the 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) crates/tui/src/lib.rs:5600 — crates/tui/src/lib.rs:5600-5612 | crates/tui/src/lib.rs:8147-8158 — both copies are in the same file, so extract the 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) crates/tui/src/provider_catalog_live.rs:1209 — crates/tui/src/provider_catalog_live.rs:1209-1221 | crates/tui/src/provider_catalog_live.rs:1277-1288 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_threads.rs:6211 — crates/tui/src/runtime_threads.rs:6211-6223 | crates/tui/src/runtime_threads.rs:6236-6247 — both copies are in the same file, so extract the 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) crates/tui/src/tools/shell.rs:2418 — crates/tui/src/tools/shell.rs:2418-2430 | crates/tui/src/tools/shell.rs:2574-2585 — both copies are in the same file, so extract the 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) crates/tui/src/tools/subagent/coord.rs:779 — crates/tui/src/tools/subagent/coord.rs:779-790 | crates/tui/src/tools/subagent/mod.rs:12423-12435 — before extracting anything, compare `crates/tui/src/tools/subagent/coord.rs` and `crates/tui/src/tools/subagent/mod.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12–13 lines × 2) crates/tui/src/tools/subagent/coord.rs:802 — crates/tui/src/tools/subagent/coord.rs:802-814 | crates/tui/src/tools/subagent/mod.rs:12440-12451 — before extracting anything, compare `crates/tui/src/tools/subagent/coord.rs` and `crates/tui/src/tools/subagent/mod.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12–13 lines × 2) crates/tui/src/tui/history.rs:1177 — crates/tui/src/tui/history.rs:1177-1188 | crates/tui/src/tui/history.rs:1306-1318 — both copies are in the same file, so extract the 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) crates/tui/src/tui/history/latex_render.rs:785 — crates/tui/src/tui/history/latex_render.rs:785-797 | crates/tui/src/tui/history/latex_render.rs:866-877 — both copies are in the same file, so extract the 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 lines × 3) · ×9
  • Duplicated block (12 lines × 3) crates/config/src/config_document.rs:454 — crates/config/src/config_document.rs:454-465 | crates/config/src/private_directory.rs:1110-1121 | crates/runtime/src/external_credentials.rs:350-361 — before extracting anything, compare `crates/config/src/private_directory.rs` and `crates/runtime/src/external_credentials.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 3) crates/secrets/src/lib.rs:231 — crates/secrets/src/lib.rs:231-242 | crates/secrets/src/lib.rs:265-276 | crates/secrets/src/lib.rs:297-308 — 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) crates/tui/src/plugins/marketplace/parsers/claude.rs:276 — crates/tui/src/plugins/marketplace/parsers/claude.rs:276-287 | crates/tui/src/plugins/marketplace/parsers/codewhale.rs:234-245 | crates/tui/src/plugins/marketplace/parsers/kimi.rs:194-205 — before extracting anything, compare `crates/tui/src/plugins/marketplace/parsers/claude.rs` and `crates/tui/src/plugins/marketplace/parsers/codewhale.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 3) crates/tui/src/tools/automation.rs:166 — crates/tui/src/tools/automation.rs:166-177 | crates/tui/src/tools/send_later.rs:112-123 | crates/tui/src/tools/tasks.rs:223-234 — before extracting anything, compare `crates/tui/src/tools/automation.rs` and `crates/tui/src/tools/tasks.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 3) crates/tui/src/tui/hotbar/setup.rs:946 — crates/tui/src/tui/hotbar/setup.rs:946-965 | crates/tui/src/tui/provider_picker.rs:4322-4333 | crates/tui/src/tui/provider_picker.rs:4393-4405 — before extracting anything, compare `crates/tui/src/tui/hotbar/setup.rs` and `crates/tui/src/tui/provider_picker.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 3) crates/tui/src/tui/ui/remote_control_bridge.rs:124 — crates/tui/src/tui/ui/remote_control_bridge.rs:124-135 | crates/tui/src/tui/ui/remote_control_bridge.rs:172-183 | crates/tui/src/tui/ui/remote_control_bridge.rs:320-333 — 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) crates/tui/src/tui/widgets/composer_legacy.rs:542 — crates/tui/src/tui/widgets/composer_legacy.rs:542-553 | crates/tui/src/tui/widgets/composer_legacy.rs:590-601 | crates/tui/src/tui/widgets/composer_legacy.rs:655-666 — 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) crates/tui/src/tools/automation.rs:107 — crates/tui/src/tools/automation.rs:107-118 | crates/tui/src/tools/github/mod.rs:105-116 | crates/tui/src/tools/tasks.rs:145-156 — before extracting anything, compare `crates/tui/src/tools/automation.rs` and `crates/tui/src/tools/tasks.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 3) crates/tui/src/client/test_cases_01.rs:1418 — crates/tui/src/client/test_cases_01.rs:1418-1429 | crates/tui/src/client/test_cases_05.rs:99-110 | crates/tui/src/lib.rs:9148-9159 — before extracting anything, compare `crates/tui/src/client/test_cases_01.rs` and `crates/tui/src/client/test_cases_05.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×9
  • Duplicated block (11 lines × 3) crates/tui/src/compaction.rs:2358 — crates/tui/src/compaction.rs:2358-2368 | crates/tui/src/compaction/last_round.rs:399-409 | crates/tui/src/superfast.rs:245-255 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (11 lines × 3) crates/tui/src/remote_control.rs:363 — crates/tui/src/remote_control.rs:363-373 | crates/tui/src/runtime_chat_relay.rs:1698-1708 | crates/tui/src/runtime_threads.rs:7505-7515 — before extracting anything, compare `crates/tui/src/remote_control.rs` and `crates/tui/src/runtime_chat_relay.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 3) crates/tui/src/runtime_api.rs:9238 — crates/tui/src/runtime_api.rs:9238-9248 | crates/tui/src/runtime_api.rs:9352-9362 | crates/tui/src/runtime_api.rs:9399-9409 — 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 (11 lines × 3) crates/tui/src/runtime_threads.rs:3747 — crates/tui/src/runtime_threads.rs:3747-3757 | crates/tui/src/runtime_threads.rs:3906-3916 | crates/tui/src/runtime_threads.rs:4157-4167 — 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 (11 lines × 3) crates/tui/src/tools/web_search.rs:3004 — crates/tui/src/tools/web_search.rs:3004-3014 | crates/tui/src/tools/web_search.rs:3055-3065 | crates/tui/src/tools/web_search.rs:3363-3373 — 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 (11 lines × 3) crates/tui/src/tui/ui/apply.rs:1602 — crates/tui/src/tui/ui/apply.rs:1602-1612 | crates/tui/src/tui/ui/apply.rs:1829-1839 | crates/tui/src/tui/ui/apply.rs:2928-2938 — 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 (11 lines × 3) crates/tui/src/tools/git_history.rs:243 — crates/tui/src/tools/git_history.rs:243-253 | crates/tui/src/tools/git_history.rs:382-392 | crates/tui/src/tools/git_history.rs:515-525 — 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 (11 lines × 3) crates/tui/src/tui/ui/event_loop.rs:8617 — crates/tui/src/tui/ui/event_loop.rs:8617-8627 | crates/tui/src/tui/ui/event_loop.rs:8647-8657 | crates/tui/src/tui/ui/event_loop.rs:8669-8679 — 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 (11 lines × 3) crates/tui/src/runtime_api.rs:10232 — crates/tui/src/runtime_api.rs:10232-10242 | crates/tui/src/runtime_api.rs:10251-10261 | crates/tui/src/runtime_api.rs:10276-10286 — 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 (7 lines × 3) · ×9
  • Duplicated block (7 lines × 3) crates/tui/src/fleet/store.rs:774 — crates/tui/src/fleet/store.rs:774-780 | crates/tui/src/fleet/store.rs:805-811 | crates/tui/src/fleet/store.rs:820-826 — 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 (7 lines × 3) crates/tui/src/lib.rs:7661 — crates/tui/src/lib.rs:7661-7667 | crates/tui/src/lib.rs:8359-8365 | crates/tui/src/lib.rs:8451-8457 — 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 (7 lines × 3) crates/tui/src/plugins/marketplace/store.rs:205 — crates/tui/src/plugins/marketplace/store.rs:205-211 | crates/tui/src/plugins/registry.rs:755-761 | crates/tui/src/plugins/registry/gc.rs:848-854 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (7 lines × 3) crates/tui/src/tui/ui.rs:566 — crates/tui/src/tui/ui.rs:566-572 | crates/tui/src/tui/ui/apply.rs:1290-1296 | crates/tui/src/tui/ui/provider_routes.rs:829-835 — before extracting anything, compare `crates/tui/src/tui/ui/apply.rs` and `crates/tui/src/tui/ui/provider_routes.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 3) REDACTED:1554 — REDACTED:1554-1560 | crates/lane/src/runtime.rs:235-241 | crates/tui/src/core/authority/auto_review.rs:1665-1671 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (7 lines × 3) crates/tui/src/tools/git_history.rs:841 — crates/tui/src/tools/git_history.rs:841-847 | crates/tui/src/tools/review.rs:1947-1955 | crates/tui/src/tools/review.rs:1970-1976 — 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 (7 lines × 3) crates/app-server/src/lib.rs:3114 — crates/app-server/src/lib.rs:3114-3120 | crates/app-server/src/lib.rs:3123-3129 | crates/app-server/src/lib.rs:3132-3138 — 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 (7 lines × 3) REDACTED:4873 — REDACTED:4873-4879 | REDACTED:4882-4888 | REDACTED:4891-4897 — 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 (7 lines × 3) scripts/media/check-media-assets.py:137 — scripts/media/check-media-assets.py:137-143 | scripts/media/check-media-assets.py:153-159 | scripts/media/check-media-assets.py:180-186 — 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 `scripts/media/check-media-assets.py:137` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D5 · Coupling · Off the main sequence · ×9
  • Off the main sequence: codewhale-paths — codewhale-paths: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 8 project(s), so it's rigid to change.
  • Off the main sequence: codewhale-release — codewhale-release: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 6 project(s), so it's rigid to change.
  • Off the main sequence: codewhale-protocol — codewhale-protocol: abstractness 0.01, instability 0.00, distance 0.99 — zone of pain — concrete and depended on by 10 project(s), so it's rigid to change.
  • Off the main sequence: codewhale-workflow — codewhale-workflow: abstractness 0.01, instability 0.00, distance 0.99 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
  • Off the main sequence: codewhale-memory — codewhale-memory: abstractness 0.04, instability 0.00, distance 0.96 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: codewhale-workflow-js — codewhale-workflow-js: abstractness 0.12, instability 0.00, distance 0.88 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: codewhale-execpolicy — codewhale-execpolicy: abstractness 0.00, instability 0.17, distance 0.83 — zone of pain — concrete and depended on by 5 project(s), so it's rigid to change.
  • Off the main sequence: codewhale-config — codewhale-config: abstractness 0.01, instability 0.25, distance 0.74 — zone of pain — concrete and depended on by 12 project(s), so it's rigid to change.
  • Off the main sequence: codewhale-lane — codewhale-lane: abstractness 0.05, instability 0.25, distance 0.70 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
D1 · Cyclomatic Complexity · codewhale_execpolicy · ×8
  • codewhale_execpolicy::command_safety::lex_readonly_command (cyclomatic 36) crates/execpolicy/src/command_safety.rs:726 — codewhale_execpolicy::command_safety::lex_readonly_command 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. This is NOT this file's highest cyclomatic complexity: codewhale_execpolicy::command_safety::readonly_options_are_allowed (cyclomatic 37) 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 function is counted neither in this dimension's figures nor in its score.
  • codewhale_execpolicy::shell_expand::command_heads (cyclomatic 34) crates/execpolicy/src/shell_expand.rs:1913 — codewhale_execpolicy::shell_expand::command_heads 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.
  • codewhale_execpolicy::command_safety::analyze_command (cyclomatic 31) crates/execpolicy/src/command_safety.rs:1798 — codewhale_execpolicy::command_safety::analyze_command 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. This is NOT this file's highest cyclomatic complexity: codewhale_execpolicy::command_safety::readonly_options_are_allowed (cyclomatic 37) 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 function is counted neither in this dimension's figures nor in its score.
  • codewhale_execpolicy::shell_expand::shell_input (cyclomatic 22) crates/execpolicy/src/shell_expand.rs:2107 — codewhale_execpolicy::shell_expand::shell_input 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.
  • codewhale_execpolicy::shell_expand::read_substitution (cyclomatic 21) crates/execpolicy/src/shell_expand.rs:1765 — codewhale_execpolicy::shell_expand::read_substitution has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • codewhale_execpolicy::command_safety::agent_segment_verdict (cyclomatic 20) crates/execpolicy/src/command_safety.rs:1048 — codewhale_execpolicy::command_safety::agent_segment_verdict has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: codewhale_execpolicy::command_safety::readonly_options_are_allowed (cyclomatic 37) 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 function is counted neither in this dimension's figures nor in its score.
  • codewhale_execpolicy::shell_expand::mark_replacement_operands (cyclomatic 20) crates/execpolicy/src/shell_expand.rs:1570 — codewhale_execpolicy::shell_expand::mark_replacement_operands 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.
  • codewhale_execpolicy::denied_prefix_matches (cyclomatic 16) crates/execpolicy/src/lib.rs:881 — codewhale_execpolicy::denied_prefix_matches 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.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×8
  • Duplicated block (21 lines × 2) crates/tui/src/client.rs:3237 — crates/tui/src/client.rs:3237-3257 | crates/tui/src/client.rs:3272-3292 — both copies are in the same file, so extract the 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 (21 lines × 2) crates/tui/src/core/engine/turn_loop.rs:3100 — crates/tui/src/core/engine/turn_loop.rs:3100-3120 | crates/tui/src/core/engine/turn_loop.rs:3124-3144 — both copies are in the same file, so extract the 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 (21 lines × 2) crates/tui/src/fleet/control.rs:133 — crates/tui/src/fleet/control.rs:133-153 | crates/tui/src/runtime_api.rs:5096-5116 — before extracting anything, compare `crates/tui/src/fleet/control.rs` and `crates/tui/src/runtime_api.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 84 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 (21 lines × 2) crates/tui/src/runtime_api.rs:9986 — crates/tui/src/runtime_api.rs:9986-10006 | crates/tui/src/runtime_api.rs:10063-10083 — both copies are in the same file, so extract the 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 (21 lines × 2) crates/tui/src/runtime_threads.rs:17985 — crates/tui/src/runtime_threads.rs:17985-18005 | crates/tui/src/runtime_threads.rs:18063-18083 — both copies are in the same file, so extract the 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 (21 lines × 2) crates/tui/src/tools/shell.rs:6638 — crates/tui/src/tools/shell.rs:6638-6658 | crates/tui/src/tools/shell.rs:7290-7310 — both copies are in the same file, so extract the 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 (21 lines × 2) crates/tui/src/tools/verifier.rs:473 — crates/tui/src/tools/verifier.rs:473-493 | crates/tui/src/tools/verifier.rs:542-562 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (21 lines × 2) crates/tui/src/tui/ui/event_loop.rs:5415 — crates/tui/src/tui/ui/event_loop.rs:5415-5435 | crates/tui/src/tui/ui/event_loop.rs:6104-6124 — both copies are in the same file, so extract the 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 (16 lines × 2) · ×8
  • Duplicated block (16 lines × 2) REDACTED:5926 — REDACTED:5926-5941 | REDACTED:5998-6013 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) crates/tui/src/commands/debug_group.rs:24 — crates/tui/src/commands/debug_group.rs:24-39 | crates/tui/src/commands/session_group.rs:24-39 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (16 lines × 2) crates/tui/src/extension_host/execution.rs:1122 — crates/tui/src/extension_host/execution.rs:1122-1137 | crates/tui/src/extension_host/execution.rs:1267-1282 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) crates/tui/src/runtime_threads.rs:20676 — crates/tui/src/runtime_threads.rs:20676-20691 | crates/tui/src/task_manager.rs:3874-3889 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (16 lines × 2) crates/tui/src/tui/setup/mod.rs:2318 — crates/tui/src/tui/setup/mod.rs:2318-2333 | crates/tui/src/tui/setup/mod.rs:2346-2361 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) crates/tui/src/tui/widgets/approval_band_legacy.rs:922 — crates/tui/src/tui/widgets/approval_band_legacy.rs:922-937 | crates/tui/src/tui/widgets/mod.rs:2113-2128 — before extracting anything, compare `crates/tui/src/tui/widgets/approval_band_legacy.rs` and `crates/tui/src/tui/widgets/mod.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) crates/tui/src/tui/widgets/approval_band_legacy.rs:1089 — crates/tui/src/tui/widgets/approval_band_legacy.rs:1089-1104 | crates/tui/src/tui/widgets/mod.rs:2218-2233 — before extracting anything, compare `crates/tui/src/tui/widgets/approval_band_legacy.rs` and `crates/tui/src/tui/widgets/mod.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) crates/tui/src/tui/widgets/composer_legacy.rs:910 — crates/tui/src/tui/widgets/composer_legacy.rs:910-925 | crates/tui/src/tui/widgets/composer_legacy.rs:952-967 — both copies are in the same file, so extract the 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 × 3) · ×8
  • Duplicated block (9 lines × 3) crates/tui/src/client.rs:3661 — crates/tui/src/client.rs:3661-3669 | crates/tui/src/client.rs:4226-4234 | crates/tui/src/client.rs:6646-6654 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) crates/tui/src/compaction.rs:478 — crates/tui/src/compaction.rs:478-486 | crates/tui/src/prompts.rs:1514-1522 | crates/tui/src/rlm/session.rs:313-321 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (9 lines × 3) crates/tui/src/core/engine/turn_loop.rs:671 — crates/tui/src/core/engine/turn_loop.rs:671-679 | crates/tui/src/model_routing.rs:1337-1345 | crates/tui/src/tools/subagent/mod.rs:1177-1185 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (9 lines × 3) crates/tui/src/project_context.rs:1618 — crates/tui/src/project_context.rs:1618-1626 | crates/tui/src/project_context.rs:1639-1647 | crates/tui/src/project_context.rs:1667-1675 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) crates/tui/src/tools/shell.rs:6363 — crates/tui/src/tools/shell.rs:6363-6371 | crates/tui/src/tools/shell.rs:6647-6655 | crates/tui/src/tools/shell.rs:7299-7307 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) crates/tui/src/client/provider_native_search.rs:551 — crates/tui/src/client/provider_native_search.rs:551-559 | crates/tui/src/client/provider_native_search/kimi.rs:273-281 | crates/tui/src/client/provider_native_search/zai.rs:27-35 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (9 lines × 3) crates/app-server/src/lib.rs:3141 — crates/app-server/src/lib.rs:3141-3149 | crates/app-server/src/lib.rs:3152-3160 | crates/app-server/src/lib.rs:3163-3171 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) crates/tui/src/client/test_cases_01.rs:895 — crates/tui/src/client/test_cases_01.rs:895-903 | crates/tui/src/client/test_cases_01.rs:1453-1461 | crates/tui/src/client/test_cases_01.rs:1510-1518 — 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.
D1 · Cyclomatic Complexity · CodewhaleClient · ×7
  • CodewhaleClient::handle_responses_stream (cyclomatic 67) crates/tui/src/client/responses.rs:160 — CodewhaleClient::handle_responses_stream has cyclomatic complexity 67 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • CodewhaleClient::handle_chat_completion_stream (cyclomatic 42) crates/tui/src/client/chat.rs:1410 — CodewhaleClient::handle_chat_completion_stream 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.
  • CodewhaleClient::prepare_outbound_request (cyclomatic 37) crates/tui/src/client.rs:3005 — CodewhaleClient::prepare_outbound_request 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.
  • CodewhaleClient::build_anthropic_body (cyclomatic 33) crates/tui/src/client/anthropic.rs:48 — CodewhaleClient::build_anthropic_body 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.
  • CodewhaleClient::handle_responses_message (cyclomatic 24) crates/tui/src/client/responses.rs:657 — CodewhaleClient::handle_responses_message 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.
  • CodewhaleClient::handle_anthropic_stream (cyclomatic 22) crates/tui/src/client/anthropic.rs:331 — CodewhaleClient::handle_anthropic_stream 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.
  • CodewhaleClient::from_parts (cyclomatic 20) crates/tui/src/client.rs:1663 — CodewhaleClient::from_parts 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 · ConfigView · ×7
  • ConfigView::render_settings_shell (cyclomatic 50) crates/tui/src/tui/views/mod.rs:5379 — ConfigView::render_settings_shell 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.
  • ConfigView::handle_editing_key (cyclomatic 30) crates/tui/src/tui/views/mod.rs:3558 — ConfigView::handle_editing_key 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.
  • ConfigView::handle_key (cyclomatic 23) crates/tui/src/tui/views/mod.rs:4155 — ConfigView::handle_key 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.
  • ConfigView::handle_mouse (cyclomatic 23) crates/tui/src/tui/views/mod.rs:4253 — ConfigView::handle_mouse 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.
  • ConfigView::render (cyclomatic 21) crates/tui/src/tui/views/mod.rs:4385 — ConfigView::render 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.
  • ConfigView::handle_choice_key (cyclomatic 17) crates/tui/src/tui/views/mod.rs:3505 — ConfigView::handle_choice_key has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ConfigView::new_for_app (cyclomatic 16) crates/tui/src/tui/views/mod.rs:2241 — ConfigView::new_for_app has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · codewhale_palette · ×7
  • codewhale_palette::user_theme::apply_colors (cyclomatic 42) crates/palette/src/user_theme.rs:244 — codewhale_palette::user_theme::apply_colors 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.
  • codewhale_palette::adapt::adapt_fg_for_theme (cyclomatic 28) crates/palette/src/adapt.rs:236 — codewhale_palette::adapt::adapt_fg_for_theme 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.
  • codewhale_palette::adapt::adapt_fg_for_light_palette (cyclomatic 26) crates/palette/src/adapt.rs:30 — codewhale_palette::adapt::adapt_fg_for_light_palette 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.
  • codewhale_palette::adapt::nearest_ansi16 (cyclomatic 25) crates/palette/src/adapt.rs:773 — codewhale_palette::adapt::nearest_ansi16 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.
  • codewhale_palette::adapt::adapt_fg_for_solarized_light_palette (cyclomatic 24) crates/palette/src/adapt.rs:103 — codewhale_palette::adapt::adapt_fg_for_solarized_light_palette 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.
  • codewhale_palette::adapt::adapt_bg_for_grayscale_palette (cyclomatic 23) crates/palette/src/adapt.rs:410 — codewhale_palette::adapt::adapt_bg_for_grayscale_palette has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • codewhale_palette::adapt::adapt_fg_for_grayscale_palette (cyclomatic 21) crates/palette/src/adapt.rs:329 — codewhale_palette::adapt::adapt_fg_for_grayscale_palette 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.
D2 · Cognitive Complexity · CodewhaleClient · ×7
  • CodewhaleClient::handle_responses_stream (cognitive 153) crates/tui/src/client/responses.rs:160 — CodewhaleClient::handle_responses_stream has cognitive complexity 153 (threshold 15). Drivers by points: if/else 34 (122 pts), match/switch 5 (17 pts), boolean chains 11, loops 2 (3 pts) (nesting depth added 101). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CodewhaleClient::handle_chat_completion_stream (cognitive 87) crates/tui/src/client/chat.rs:1410 — CodewhaleClient::handle_chat_completion_stream has cognitive complexity 87 (threshold 15). Drivers by points: if/else 17 (44 pts), match/switch 7 (18 pts), loops 5 (16 pts), boolean chains 9 (nesting depth added 49). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CodewhaleClient::prepare_outbound_request (cognitive 79) crates/tui/src/client.rs:3005 — CodewhaleClient::prepare_outbound_request has cognitive complexity 79 (threshold 15). Drivers by points: if/else 30 (62 pts), loops 3 (10 pts), boolean chains 6, match/switch 1 (nesting depth added 39). 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.
  • CodewhaleClient::handle_anthropic_stream (cognitive 38) crates/tui/src/client/anthropic.rs:331 — CodewhaleClient::handle_anthropic_stream has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (24 pts), match/switch 3 (9 pts), loops 2 (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.
  • CodewhaleClient::build_anthropic_body (cognitive 37) crates/tui/src/client/anthropic.rs:48 — CodewhaleClient::build_anthropic_body has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 10, match/switch 3 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CodewhaleClient::handle_responses_message (cognitive 35) crates/tui/src/client/responses.rs:657 — CodewhaleClient::handle_responses_message has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (25 pts), match/switch 3 (8 pts), boolean chains 1, 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.
  • CodewhaleClient::from_parts (cognitive 25) crates/tui/src/client.rs:1663 — CodewhaleClient::from_parts has cognitive complexity 25 (threshold 15). Drivers by points: if/else 20 (21 pts), boolean chains 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ProviderPickerView · ×7
  • ProviderPickerView::handle_key (cognitive 128) crates/tui/src/tui/provider_picker.rs:4693 — ProviderPickerView::handle_key has cognitive complexity 128 (threshold 15). Drivers by points: if/else 29 (67 pts), match/switch 20 (43 pts), boolean chains 18 (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.
  • ProviderPickerView::render_list (cognitive 74) crates/tui/src/tui/provider_picker.rs:2887 — ProviderPickerView::render_list has cognitive complexity 74 (threshold 15). Drivers by points: if/else 46 (62 pts), boolean chains 8, match/switch 2 (3 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ProviderPickerView::handle_mouse (cognitive 30) crates/tui/src/tui/provider_picker.rs:5269 — ProviderPickerView::handle_mouse has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (18 pts), match/switch 5 (8 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.
  • ProviderPickerView::render_key_entry (cognitive 29) crates/tui/src/tui/provider_picker.rs:3636 — ProviderPickerView::render_key_entry has cognitive complexity 29 (threshold 15). Drivers by points: if/else 21 (24 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
  • ProviderPickerView::provider_detail_lines (cognitive 25) crates/tui/src/tui/provider_picker.rs:3312 — ProviderPickerView::provider_detail_lines has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (20 pts), loops 2, match/switch 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.
  • ProviderPickerView::render_model_pick (cognitive 17) crates/tui/src/tui/provider_picker.rs:4046 — ProviderPickerView::render_model_pick has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (16 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.
  • ProviderPickerView::activate_selected_row (cognitive 17) crates/tui/src/tui/provider_picker.rs:4527 — ProviderPickerView::activate_selected_row has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SubAgentManager · ×7
  • SubAgentManager::spawn_background_with_assignment_options (cognitive 81) crates/tui/src/tools/subagent/mod.rs:8607 — SubAgentManager::spawn_background_with_assignment_options has cognitive complexity 81 (threshold 15). Drivers by points: if/else 47 (69 pts), boolean chains 6, match/switch 5, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SubAgentManager::cleanup_inner (cognitive 29) crates/tui/src/tools/subagent/mod.rs:9696 — SubAgentManager::cleanup_inner has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 7, 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.
  • SubAgentManager::followup_child (cognitive 28) crates/tui/src/tools/subagent/mod.rs:7518 — SubAgentManager::followup_child has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 3, loops 1 (3 pts), match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SubAgentManager::ensure_caller_controls_descendant (cognitive 19) crates/tui/src/tools/subagent/mod.rs:9448 — SubAgentManager::ensure_caller_controls_descendant has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (17 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.
  • SubAgentManager::completion_usage (cognitive 18) crates/tui/src/tools/subagent/mod.rs:10040 — SubAgentManager::completion_usage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4 (5 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.
  • SubAgentManager::load_state (cognitive 16) crates/tui/src/tools/subagent/mod.rs:5910 — SubAgentManager::load_state has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), 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.
  • SubAgentManager::finish_terminal_result (cognitive 16) crates/tui/src/tools/subagent/mod.rs:9927 — SubAgentManager::finish_terminal_result has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · codewhale_palette · ×7
  • codewhale_palette::adapt::nearest_ansi16 (cognitive 44) crates/palette/src/adapt.rs:773 — codewhale_palette::adapt::nearest_ansi16 has cognitive complexity 44 (threshold 15). Drivers by points: if/else 28 (39 pts), boolean chains 5 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_palette::user_theme::apply_colors (cognitive 41) crates/palette/src/user_theme.rs:244 — codewhale_palette::user_theme::apply_colors has cognitive complexity 41 (threshold 15). Drivers by points: if/else 41. 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.
  • codewhale_palette::adapt::adapt_fg_for_theme (cognitive 30) crates/palette/src/adapt.rs:236 — codewhale_palette::adapt::adapt_fg_for_theme has cognitive complexity 30 (threshold 15). Drivers by points: if/else 21 (22 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.
  • codewhale_palette::adapt::adapt_fg_for_light_palette (cognitive 26) crates/palette/src/adapt.rs:30 — codewhale_palette::adapt::adapt_fg_for_light_palette has cognitive complexity 26 (threshold 15). Drivers by points: if/else 19, boolean chains 7. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codewhale_palette::adapt::adapt_fg_for_solarized_light_palette (cognitive 24) crates/palette/src/adapt.rs:103 — codewhale_palette::adapt::adapt_fg_for_solarized_light_palette has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16, boolean chains 8. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codewhale_palette::adapt::adapt_bg_for_grayscale_palette (cognitive 19) crates/palette/src/adapt.rs:410 — codewhale_palette::adapt::adapt_bg_for_grayscale_palette has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9, boolean chains 8, match/switch 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.
  • codewhale_palette::adapt::adapt_fg_for_grayscale_palette (cognitive 18) crates/palette/src/adapt.rs:329 — codewhale_palette::adapt::adapt_fg_for_grayscale_palette has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11, boolean chains 5, match/switch 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 · codewhale_commands · ×7
  • codewhale_commands::debug::cache_format::format_cache_stats (cognitive 34) crates/commands/src/debug/cache_format.rs:127 — codewhale_commands::debug::cache_format::format_cache_stats has cognitive complexity 34 (threshold 15). Drivers by points: if/else 20 (32 pts), match/switch 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.
  • codewhale_commands::diagnostics_reports::receipts::totals_line (cognitive 25) crates/commands/src/diagnostics_reports/receipts.rs:19 — codewhale_commands::diagnostics_reports::receipts::totals_line has cognitive complexity 25 (threshold 15). Drivers by points: if/else 20 (25 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.
  • codewhale_commands::debug::preview_request::parse_args (cognitive 22) crates/commands/src/debug/preview_request.rs:138 — codewhale_commands::debug::preview_request::parse_args has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (19 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_commands::diagnostics_reports::receipts::action_phrase (cognitive 19) crates/commands/src/diagnostics_reports/receipts.rs:227 — codewhale_commands::diagnostics_reports::receipts::action_phrase has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 5 (9 pts) (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codewhale_commands::debug::change::change_report (cognitive 18) crates/commands/src/debug/change.rs:62 — codewhale_commands::debug::change::change_report has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (17 pts), match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • codewhale_commands::debug::cache_format::format_cache_history (cognitive 16) crates/commands/src/debug/cache_format.rs:470 — codewhale_commands::debug::cache_format::format_cache_history has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 2 (3 pts), boolean chains 2, match/switch 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.
  • codewhale_commands::debug::change::count_changelog_entries (cognitive 16) crates/commands/src/debug/change.rs:287 — codewhale_commands::debug::change::count_changelog_entries has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
X24 · Document value interpolated into markup unescaped · Untrusted text written into markup unescaped · ×7
  • Untrusted text written into markup unescaped REDACTED:746 — `serializeJsonLd(jsonLd)` 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 web/app/[locale]/install/page.tsx:53 — `chunk.text` 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:104 — `serializeJsonLd(siteJsonLd)` 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 web/app/[locale]/page.tsx:72 — `serializeJsonLd(jsonLd)` 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:19 — `serializeJsonLd(jsonLd)` 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 web/components/ratatui/hero.tsx:32 — `preview` 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 web/components/ratatui/hero.tsx:40 — `narrow` 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.
D1 · Cyclomatic Complexity · codewhale_config · ×6
  • codewhale_config::cloud_facts::verify::verify_envelope (cyclomatic 43) crates/config/src/cloud_facts/verify.rs:154 — codewhale_config::cloud_facts::verify::verify_envelope has cyclomatic complexity 43 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codewhale_config::normalize_model_for_provider (cyclomatic 40) crates/config/src/lib.rs:4327 — codewhale_config::normalize_model_for_provider has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: ProvidersToml::for_provider (cyclomatic 52) 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 function is counted neither in this dimension's figures nor in its score.
  • codewhale_config::cloud_facts::scope::scoped_view (cyclomatic 28) crates/config/src/cloud_facts/scope.rs:107 — codewhale_config::cloud_facts::scope::scoped_view 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.
  • codewhale_config::legacy_root::plan_scope (cyclomatic 25) crates/config/src/legacy_root.rs:473 — codewhale_config::legacy_root::plan_scope 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.
  • codewhale_config::catalog::configured::validate_configured_models (cyclomatic 22) crates/config/src/catalog/configured.rs:70 — codewhale_config::catalog::configured::validate_configured_models 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.
  • codewhale_config::catalog::offerings_from_models_dev (cyclomatic 17) crates/config/src/catalog.rs:623 — codewhale_config::catalog::offerings_from_models_dev 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.
D2 · Cognitive Complexity · App · ×6
  • App::new_with_plugin_registry (cognitive 108) crates/tui/src/tui/app/init.rs:27 — App::new_with_plugin_registry has cognitive complexity 108 (threshold 15). Drivers by points: if/else 51 (65 pts), boolean chains 28, match/switch 6 (13 pts), loops 2 (nesting depth added 21). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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.
  • App::announce_settled_workflows (cognitive 27) crates/tui/src/tui/app.rs:6231 — App::announce_settled_workflows has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 9, loops 3, match/switch 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.
  • App::apply_route_save_choice (cognitive 25) crates/tui/src/tui/app.rs:2941 — App::apply_route_save_choice has cognitive complexity 25 (threshold 15). Drivers by points: match/switch 6 (13 pts), if/else 6 (10 pts), boolean chains 2 (nesting depth added 11). 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.
  • App::cumulative_usage_chip (cognitive 20) crates/tui/src/tui/app.rs:3107 — App::cumulative_usage_chip has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5, match/switch 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.
  • App::rebase_active_cell_bindings (cognitive 20) crates/tui/src/tui/app.rs:5833 — App::rebase_active_cell_bindings has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 3, 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.
  • App::submit_input (cognitive 17) crates/tui/src/tui/app/composer.rs:1724 — App::submit_input has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ConfigView · ×6
  • ConfigView::render_settings_shell (cognitive 86) crates/tui/src/tui/views/mod.rs:5379 — ConfigView::render_settings_shell has cognitive complexity 86 (threshold 15). Drivers by points: if/else 49 (70 pts), boolean chains 6, match/switch 3 (6 pts), loops 3 (4 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ConfigView::render (cognitive 49) crates/tui/src/tui/views/mod.rs:4385 — ConfigView::render has cognitive complexity 49 (threshold 15). Drivers by points: if/else 24 (43 pts), boolean chains 3, loops 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.
  • ConfigView::handle_editing_key (cognitive 40) crates/tui/src/tui/views/mod.rs:3558 — ConfigView::handle_editing_key has cognitive complexity 40 (threshold 15). Drivers by points: if/else 19 (38 pts), boolean chains 1, match/switch 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ConfigView::handle_mouse (cognitive 32) crates/tui/src/tui/views/mod.rs:4253 — ConfigView::handle_mouse has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (20 pts), match/switch 5 (10 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.
  • ConfigView::handle_key (cognitive 20) crates/tui/src/tui/views/mod.rs:4155 — ConfigView::handle_key has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 3, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ConfigView::new_for_app (cognitive 16) crates/tui/src/tui/views/mod.rs:2241 — ConfigView::new_for_app has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 7 (8 pts), if/else 5 (6 pts), boolean chains 1, loops 1 (nesting depth added 2). 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 · codewhale_core · ×6
  • codewhale_core::fragments::collect_candidate_files (cognitive 48) crates/core/src/fragments.rs:320 — codewhale_core::fragments::collect_candidate_files has cognitive complexity 48 (threshold 15). Drivers by points: if/else 8 (28 pts), loops 4 (15 pts), boolean chains 5 (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.
  • codewhale_core::tool_parser::parse_arrow_syntax (cognitive 27) crates/core/src/tool_parser.rs:363 — codewhale_core::tool_parser::parse_arrow_syntax has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (24 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.
  • codewhale_core::prefix_cache::context_update_message (cognitive 26) crates/core/src/prefix_cache.rs:748 — codewhale_core::prefix_cache::context_update_message has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 6 (7 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.
  • codewhale_core::tool_parser::parse_xml_parameters (cognitive 24) crates/core/src/tool_parser.rs:260 — codewhale_core::tool_parser::parse_xml_parameters has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 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.
  • codewhale_core::tool_parser::extract_braced_object (cognitive 17) crates/core/src/tool_parser.rs:521 — codewhale_core::tool_parser::extract_braced_object has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_core::tool_parser::parse_cli_style_args (cognitive 16) crates/core/src/tool_parser.rs:419 — codewhale_core::tool_parser::parse_cli_style_args has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 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 · create · ×6
  • create::probe (cognitive 45) crates/tui/plugins/computer-use/src/backends/linux.mjs:561 — create::probe has cognitive complexity 45 (threshold 15). Drivers by points: boolean chains 17, if/else 13 (15 pts), ternaries 5 (11 pts), error handling 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • create::kill_app (cognitive 30) crates/tui/plugins/computer-use/src/backends/linux.mjs:1071 — create::kill_app has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (19 pts), error handling 2 (4 pts), loops 2 (4 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.
  • create::type (cognitive 25) crates/tui/plugins/computer-use/src/backends/linux.mjs:876 — create::type has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (4 pts), ternaries 1 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • create::recordingStart (cognitive 20) crates/tui/plugins/computer-use/src/backends/linux.mjs:1160 — create::recordingStart has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6, ternaries 2, error handling 1, other 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • create::open_application (cognitive 19) crates/tui/plugins/computer-use/src/backends/linux.mjs:696 — create::open_application has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 2 (4 pts), boolean chains 3, other 2, 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.
  • create::list_displays (cognitive 17) crates/tui/plugins/computer-use/src/backends/linux.mjs:609 — create::list_displays has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codewhale_app_server · ×6
  • codewhale_app_server::run_stdio_loop (cognitive 44) crates/app-server/src/lib.rs:843 — codewhale_app_server::run_stdio_loop has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (23 pts), match/switch 5 (16 pts), loops 2 (4 pts), boolean chains 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.
  • codewhale_app_server::daemon_socket::attach (cognitive 31) crates/app-server/src/daemon_socket.rs:572 — codewhale_app_server::daemon_socket::attach has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 8, match/switch 3 (5 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • codewhale_app_server::thread_control::list (cognitive 28) crates/app-server/src/thread_control.rs:354 — codewhale_app_server::thread_control::list has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (20 pts), boolean chains 5, loops 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_app_server::chat_completions::chat_completions_handler (cognitive 21) crates/app-server/src/chat_completions.rs:309 — codewhale_app_server::chat_completions::chat_completions_handler has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 5 (6 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.
  • codewhale_app_server::thread_control::handle_owned (cognitive 21) crates/app-server/src/thread_control.rs:975 — codewhale_app_server::thread_control::handle_owned has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4, match/switch 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_app_server::runtime_app_models (cognitive 16) crates/app-server/src/lib.rs:2055 — codewhale_app_server::runtime_app_models has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (6 pts), match/switch 3 (6 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 · SessionManager · ×6
  • SessionManager::remove_session (cognitive 38) crates/tui/src/session_manager.rs:4094 — SessionManager::remove_session has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (20 pts), match/switch 7 (11 pts), boolean chains 5, 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.
  • SessionManager::apply_late_usage_to_metadata (cognitive 24) crates/tui/src/session_manager.rs:2405 — SessionManager::apply_late_usage_to_metadata has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 3, loops 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SessionManager::load_session_snapshot_with_limit (cognitive 22) crates/tui/src/session_manager.rs:3533 — SessionManager::load_session_snapshot_with_limit has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 2, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SessionManager::persist_late_usage_record (cognitive 19) crates/tui/src/session_manager.rs:2193 — SessionManager::persist_late_usage_record has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 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.
  • SessionManager::cleanup_old_sessions_inner (cognitive 17) crates/tui/src/session_manager.rs:4295 — SessionManager::cleanup_old_sessions_inner has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 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.
  • SessionManager::list_checkpoints (cognitive 16) crates/tui/src/session_manager.rs:3250 — SessionManager::list_checkpoints has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 1, loops 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×6
  • Duplicated block (5 lines × 3) crates/tui/src/extension_host/registry.rs:1683 — crates/tui/src/extension_host/registry.rs:1683-1690 | crates/tui/src/extension_host/registry.rs:1695-1699 | crates/tui/src/extension_host/registry.rs:1748-1752 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) crates/tui/src/runtime_api/jobs.rs:374 — crates/tui/src/runtime_api/jobs.rs:374-378 | crates/tui/src/runtime_api/jobs.rs:591-595 | crates/tui/src/runtime_api/jobs.rs:618-622 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) crates/config/src/windows_identity.rs:94 — crates/config/src/windows_identity.rs:94-98 | crates/runtime/src/external_credentials.rs:576-581 | crates/tui/src/tools/github/report.rs:1349-1353 — before extracting anything, compare `crates/config/src/windows_identity.rs` and `crates/tui/src/tools/github/report.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 3) crates/tui/src/commands/config_group.rs:86 — crates/tui/src/commands/config_group.rs:86-96 | crates/tui/src/commands/debug_group.rs:63-67 | crates/tui/src/commands/session_group.rs:67-71 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (5 lines × 3) crates/tui/src/automation_manager.rs:2542 — crates/tui/src/automation_manager.rs:2542-2549 | crates/tui/src/automation_manager.rs:2688-2692 | crates/tui/src/automation_manager.rs:2892-2897 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) crates/lane/src/registry.rs:332 — crates/lane/src/registry.rs:332-338 | crates/lane/src/registry.rs:434-440 | crates/runtime/src/continual_harness.rs:374-378 — 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.
D1 · Cyclomatic Complexity · ProviderPickerView · ×5
  • ProviderPickerView::handle_key (cyclomatic 134) crates/tui/src/tui/provider_picker.rs:4693 — ProviderPickerView::handle_key has cyclomatic complexity 134 (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.
  • ProviderPickerView::render_list (cyclomatic 48) crates/tui/src/tui/provider_picker.rs:2887 — ProviderPickerView::render_list has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ProviderPickerView::handle_mouse (cyclomatic 30) crates/tui/src/tui/provider_picker.rs:5269 — ProviderPickerView::handle_mouse has cyclomatic complexity 30 (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.
  • ProviderPickerView::render_key_entry (cyclomatic 21) crates/tui/src/tui/provider_picker.rs:3636 — ProviderPickerView::render_key_entry 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. This is NOT this file's highest cyclomatic complexity: ProviderPickerView::render (cyclomatic 28) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • ProviderPickerView::provider_detail_lines (cyclomatic 17) crates/tui/src/tui/provider_picker.rs:3312 — ProviderPickerView::provider_detail_lines has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: ProviderPickerView::render (cyclomatic 28) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · FleetSetupView · ×5
  • FleetSetupView::handle_key (cyclomatic 39) crates/tui/src/tui/views/fleet_setup.rs:2021 — FleetSetupView::handle_key has cyclomatic complexity 39 (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.
  • FleetSetupView::render (cyclomatic 22) crates/tui/src/tui/views/fleet_setup.rs:2159 — FleetSetupView::render has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • FleetSetupView::commit_route_assignment (cyclomatic 18) crates/tui/src/tui/views/fleet_setup.rs:999 — FleetSetupView::commit_route_assignment 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.
  • FleetSetupView::apply_motion (cyclomatic 18) crates/tui/src/tui/views/fleet_setup.rs:1630 — FleetSetupView::apply_motion has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • FleetSetupView::render_review (cyclomatic 17) crates/tui/src/tui/views/fleet_setup.rs:2500 — FleetSetupView::render_review 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 · ModelPickerView · ×5
  • ModelPickerView::handle_key (cyclomatic 37) crates/tui/src/tui/model_picker.rs:4239 — ModelPickerView::handle_key has cyclomatic complexity 37 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ModelPickerView::render_pane (cyclomatic 36) crates/tui/src/tui/model_picker.rs:1573 — ModelPickerView::render_pane 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.
  • ModelPickerView::render_route (cyclomatic 31) crates/tui/src/tui/model_picker.rs:4504 — ModelPickerView::render_route 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.
  • ModelPickerView::ensure_projection (cyclomatic 21) crates/tui/src/tui/model_picker.rs:746 — ModelPickerView::ensure_projection 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.
  • ModelPickerView::handle_mouse (cyclomatic 17) crates/tui/src/tui/model_picker.rs:4395 — ModelPickerView::handle_mouse 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 · codewhale_app_server · ×5
  • codewhale_app_server::daemon_socket::attach (cyclomatic 27) crates/app-server/src/daemon_socket.rs:572 — codewhale_app_server::daemon_socket::attach 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.
  • codewhale_app_server::thread_control::handle_owned (cyclomatic 26) crates/app-server/src/thread_control.rs:975 — codewhale_app_server::thread_control::handle_owned 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.
  • codewhale_app_server::run_stdio_loop (cyclomatic 18) crates/app-server/src/lib.rs:843 — codewhale_app_server::run_stdio_loop has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: codewhale_app_server::dispatch_stdio_request_with_writer (cyclomatic 35) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • codewhale_app_server::chat_completions::chat_completions_handler (cyclomatic 17) crates/app-server/src/chat_completions.rs:309 — codewhale_app_server::chat_completions::chat_completions_handler 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.
  • codewhale_app_server::thread_control::list (cyclomatic 16) crates/app-server/src/thread_control.rs:354 — codewhale_app_server::thread_control::list 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 · ModelPickerView · ×5
  • ModelPickerView::render_pane (cognitive 56) crates/tui/src/tui/model_picker.rs:1573 — ModelPickerView::render_pane has cognitive complexity 56 (threshold 15). Drivers by points: if/else 33 (45 pts), boolean chains 10, 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.
  • ModelPickerView::render_route (cognitive 31) crates/tui/src/tui/model_picker.rs:4504 — ModelPickerView::render_route has cognitive complexity 31 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 5, match/switch 4 (5 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.
  • ModelPickerView::ensure_projection (cognitive 29) crates/tui/src/tui/model_picker.rs:746 — ModelPickerView::ensure_projection has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 8 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • ModelPickerView::handle_mouse (cognitive 22) crates/tui/src/tui/model_picker.rs:4395 — ModelPickerView::handle_mouse has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 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.
  • ModelPickerView::handle_key (cognitive 21) crates/tui/src/tui/model_picker.rs:4239 — ModelPickerView::handle_key has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 13, if/else 3 (5 pts), match/switch 2 (3 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 · ExtensionHostManager · ×5
  • ExtensionHostManager::activate_owner (cognitive 37) crates/tui/src/extension_host/mod.rs:2321 — ExtensionHostManager::activate_owner has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (21 pts), match/switch 8 (11 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ExtensionHostManager::reconcile_with_policy (cognitive 25) crates/tui/src/extension_host/mod.rs:1985 — ExtensionHostManager::reconcile_with_policy has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 6, boolean chains 2, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ExtensionHostManager::ensure_host (cognitive 25) crates/tui/src/extension_host/mod.rs:2627 — ExtensionHostManager::ensure_host has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 4 (6 pts), boolean chains 4, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ExtensionHostManager::execute_launch_for_caller (cognitive 20) crates/tui/src/extension_host/execution.rs:1035 — ExtensionHostManager::execute_launch_for_caller has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, boolean chains 3, match/switch 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.
  • ExtensionHostManager::reconcile_builtin (cognitive 17) crates/tui/src/extension_host/mod.rs:2227 — ExtensionHostManager::reconcile_builtin has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 4, loops 2, match/switch 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codewhale_workflow · ×5
  • codewhale_workflow::redaction::redact_token (cognitive 30) crates/workflow/src/redaction.rs:282 — codewhale_workflow::redaction::redact_token has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 3, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_workflow::model_policy::balanced_json_payload (cognitive 23) crates/workflow/src/model_policy.rs:372 — codewhale_workflow::model_policy::balanced_json_payload has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 2 (6 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.
  • codewhale_workflow::named_fleet::strip_toml_comment (cognitive 17) crates/workflow/src/named_fleet.rs:456 — codewhale_workflow::named_fleet::strip_toml_comment has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 3 (9 pts), if/else 3 (7 pts), loops 1 (nesting depth added 10). 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.
  • codewhale_workflow::js_authoring::extract_workflow_object (cognitive 16) crates/workflow/src/js_authoring.rs:130 — codewhale_workflow::js_authoring::extract_workflow_object has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_workflow::redaction::redact_for_disclosure (cognitive 16) crates/workflow/src/redaction.rs:225 — codewhale_workflow::redaction::redact_for_disclosure has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (14 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 · HookExecutor · ×5
  • HookExecutor::execute_sync_legacy (cognitive 27) crates/tui/src/hooks/executor.rs:2435 — HookExecutor::execute_sync_legacy has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 8 (10 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.
  • HookExecutor::execute_message_submit_transform (cognitive 21) crates/tui/src/hooks/executor.rs:1850 — HookExecutor::execute_message_submit_transform has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • HookExecutor::execute (cognitive 17) crates/tui/src/hooks/executor.rs:2068 — HookExecutor::execute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • HookExecutor::tool_name_matches_condition (cognitive 17) crates/tui/src/hooks/executor.rs:2246 — HookExecutor::tool_name_matches_condition has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), match/switch 2 (7 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.
  • HookExecutor::execute_sync_inner (cognitive 17) crates/tui/src/hooks/executor.rs:2354 — HookExecutor::execute_sync_inner has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), match/switch 3 (5 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 · FleetSetupView · ×5
  • FleetSetupView::handle_key (cognitive 23) crates/tui/src/tui/views/fleet_setup.rs:2021 — FleetSetupView::handle_key has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 7, match/switch 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.
  • FleetSetupView::render (cognitive 20) crates/tui/src/tui/views/fleet_setup.rs:2159 — FleetSetupView::render has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 4 (5 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FleetSetupView::commit_route_assignment (cognitive 19) crates/tui/src/tui/views/fleet_setup.rs:999 — FleetSetupView::commit_route_assignment has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 5, loops 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.
  • FleetSetupView::render_review (cognitive 19) crates/tui/src/tui/views/fleet_setup.rs:2500 — FleetSetupView::render_review has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 2, match/switch 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
  • FleetSetupView::apply_motion (cognitive 17) crates/tui/src/tui/views/fleet_setup.rs:1630 — FleetSetupView::apply_motion has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 4 (8 pts) (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D3 · God Classes · TooManyFunctions · ×5
  • TooManyFunctions: codewhale_tui::tui::notifications crates/tui/src/tui/notifications.rs:46 — TooManyFunctions — 46 free functions. The bar is 30 free functions; this is 16 over it, 1.53× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: codewhale_tui::tui::ui::terminal crates/tui/src/tui/ui/terminal.rs:9 — TooManyFunctions — 43 free functions. The bar is 30 free functions; 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.
  • TooManyFunctions: codewhale_tui::config_persistence crates/tui/src/config_persistence.rs:24 — TooManyFunctions — 34 free functions. The bar is 30 free functions; this is 4 over it, 1.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: codewhale_tui::tui::ui::overlays crates/tui/src/tui/ui/overlays.rs:8 — TooManyFunctions — 33 free functions. The bar is 30 free functions; 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.
  • TooManyFunctions: codewhale_tui::git_status crates/tui/src/git_status.rs:177 — TooManyFunctions — 32 free functions. The bar is 30 free functions; 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.
D31 · IaC & Container Security · Medium IaC · ×5
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×5
  • Duplicated block (10–11 lines × 2) crates/config/src/private_directory.rs:1215 — crates/config/src/private_directory.rs:1215-1225 | crates/tui/src/tools/github/report.rs:1275-1284 — before extracting anything, compare `crates/config/src/private_directory.rs` and `crates/tui/src/tools/github/report.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10–11 lines × 2) crates/runtime/src/child_env.rs:89 — crates/runtime/src/child_env.rs:89-99 | crates/runtime/src/child_env.rs:245-254 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10–11 lines × 2) crates/tui/src/runtime_api/workspace.rs:287 — crates/tui/src/runtime_api/workspace.rs:287-296 | crates/tui/src/tools/subagent/mod.rs:1713-1723 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10–11 lines × 2) crates/tui/src/tui/agent_focus.rs:113 — crates/tui/src/tui/agent_focus.rs:113-122 | crates/tui/src/tui/mouse_ui.rs:980-990 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (10–11 lines × 2) crates/tui/src/tui/file_picker.rs:588 — crates/tui/src/tui/file_picker.rs:588-598 | crates/tui/src/tui/views/mode_picker.rs:114-123 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×5
  • Duplicated block (10 lines × 3) crates/runtime/src/skill_state.rs:252 — crates/runtime/src/skill_state.rs:252-261 | crates/tui/src/automation_manager.rs:1072-1081 | crates/tui/src/runtime_threads.rs:20789-20798 — 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 (10 lines × 3) crates/tui/src/client.rs:6360 — crates/tui/src/client.rs:6360-6369 | crates/tui/src/client.rs:6491-6500 | crates/tui/src/client.rs:6594-6603 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (10 lines × 3) crates/tui/src/extension_host/registry.rs:857 — crates/tui/src/extension_host/registry.rs:857-866 | crates/tui/src/extension_host/registry.rs:1648-1657 | crates/tui/src/extension_host/registry.rs:1709-1719 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (10 lines × 3) crates/tui/src/tools/subagent/coord.rs:818 — crates/tui/src/tools/subagent/coord.rs:818-827 | crates/tui/src/tools/subagent/coord.rs:1006-1015 | crates/tui/src/tools/subagent/mod.rs:12464-12473 — before extracting anything, compare `crates/tui/src/tools/subagent/coord.rs` and `crates/tui/src/tools/subagent/mod.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 3) crates/tui/src/client/test_cases_01.rs:1462 — crates/tui/src/client/test_cases_01.rs:1462-1475 | crates/tui/src/client/test_cases_01.rs:1519-1532 | crates/tui/src/client/test_cases_05.rs:81-90 — before extracting anything, compare `crates/tui/src/client/test_cases_01.rs` and `crates/tui/src/client/test_cases_05.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×5
  • Duplicated block (8–9 lines × 2) crates/tui/src/commands/groups/session/structcopy.rs:421 — crates/tui/src/commands/groups/session/structcopy.rs:421-428 | crates/tui/src/skills/mod.rs:1750-1758 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8–9 lines × 2) crates/tui/src/skills/mutation.rs:871 — crates/tui/src/skills/mutation.rs:871-879 | crates/tui/src/skills/mutation.rs:947-954 — both copies are in the same file, so extract the 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–9 lines × 2) crates/tui/src/tools/workflow/mod.rs:2906 — crates/tui/src/tools/workflow/mod.rs:2906-2913 | crates/tui/src/tools/workflow/mod.rs:2936-2944 — both copies are in the same file, so extract the 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–9 lines × 2) crates/tui/src/tui/history/message.rs:163 — crates/tui/src/tui/history/message.rs:163-170 | crates/tui/src/tui/history/message.rs:242-250 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8–9 lines × 2) crates/tui/src/tui/session_picker.rs:913 — crates/tui/src/tui/session_picker.rs:913-921 | crates/tui/src/tui/views/status_picker.rs:184-191 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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 (8 lines × 3) · ×5
  • Duplicated block (8 lines × 3) crates/tui/src/runtime_threads.rs:18579 — crates/tui/src/runtime_threads.rs:18579-18586 | crates/tui/src/runtime_threads.rs:18602-18609 | crates/tui/src/runtime_threads.rs:18620-18627 — 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) crates/tui/src/session_diagnostics.rs:381 — crates/tui/src/session_diagnostics.rs:381-388 | crates/tui/src/session_diagnostics.rs:413-420 | crates/tui/src/session_diagnostics.rs:445-452 — 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) crates/tui/src/tui/provider_picker.rs:2952 — crates/tui/src/tui/provider_picker.rs:2952-2959 | crates/tui/src/tui/provider_picker.rs:4384-4391 | crates/tui/src/tui/views/router_setup.rs:698-705 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (8 lines × 3) crates/tui/src/tui/ui/apply.rs:1286 — crates/tui/src/tui/ui/apply.rs:1286-1293 | crates/tui/src/tui/ui/provider_routes.rs:825-832 | crates/tui/src/tui/ui/session_state.rs:945-952 — before extracting anything, compare `crates/tui/src/tui/ui/apply.rs` and `crates/tui/src/tui/ui/provider_routes.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 3) crates/tui/src/tui/views/fleet_detail.rs:975 — crates/tui/src/tui/views/fleet_detail.rs:975-982 | crates/tui/src/tui/views/fleet_list.rs:384-392 | crates/tui/src/tui/views/fleet_roster.rs:461-472 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×5
  • Duplicated block (7–8 lines × 2) crates/tui/src/extension_host/windows.rs:1372 — crates/tui/src/extension_host/windows.rs:1372-1378 | crates/tui/src/extension_host/windows.rs:1487-1494 — both copies are in the same file, so extract the 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) crates/tui/src/hooks/executor.rs:1495 — crates/tui/src/hooks/executor.rs:1495-1502 | crates/tui/src/hooks/executor.rs:2603-2609 — both copies are in the same file, so extract the 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) crates/tui/src/integrations/dsh/mod.rs:522 — crates/tui/src/integrations/dsh/mod.rs:522-529 | crates/tui/src/integrations/dsh/mod.rs:566-572 — both copies are in the same file, so extract the 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) crates/tui/src/runtime_threads.rs:13314 — crates/tui/src/runtime_threads.rs:13314-13321 | crates/tui/src/runtime_threads.rs:13343-13349 — both copies are in the same file, so extract the 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) pet/ios/CodewhalePetApp.swift:67 — pet/ios/CodewhalePetApp.swift:67-74 | pet/macos/CodewhalePetApp.swift:62-68 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pet/ios/CodewhalePetApp.swift:67` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×5
  • Duplicated block (6–7 lines × 2) crates/tui/src/core/engine.rs:1943 — crates/tui/src/core/engine.rs:1943-1948 | crates/tui/src/core/engine.rs:1990-1996 — both copies are in the same file, so extract the 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–7 lines × 2) crates/tui/src/integrations/dsh/bundle.rs:450 — crates/tui/src/integrations/dsh/bundle.rs:450-456 | crates/tui/src/integrations/dsh/bundle.rs:462-467 — both copies are in the same file, so extract the 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–7 lines × 2) crates/tui/src/tools/plan.rs:308 — crates/tui/src/tools/plan.rs:308-314 | crates/tui/src/tools/plan.rs:535-540 — both copies are in the same file, so extract the 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–7 lines × 2) crates/tui/src/tools/subagent/coord.rs:230 — crates/tui/src/tools/subagent/coord.rs:230-236 | crates/tui/src/tools/subagent/coord.rs:424-429 — both copies are in the same file, so extract the 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–7 lines × 2) crates/tui/src/tools/subagent/mod.rs:18778 — crates/tui/src/tools/subagent/mod.rs:18778-18784 | crates/tui/src/tools/subagent/mod.rs:18799-18804 — both copies are in the same file, so extract the 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 (6 lines × 4) · ×5
  • Duplicated block (6 lines × 4) crates/commands/src/debug/change.rs:192 — crates/commands/src/debug/change.rs:192-197 | crates/commands/src/debug/change.rs:235-240 | crates/commands/src/debug/change.rs:261-266 | crates/commands/src/debug/change.rs:368-373 — 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 (6 lines × 4) crates/config/src/lib.rs:4766 — crates/config/src/lib.rs:4766-4771 | crates/config/src/provider.rs:458-463 | crates/config/src/provider.rs:477-482 | crates/tui/src/config.rs:9147-9152 — before extracting anything, compare `crates/config/src/lib.rs` and `crates/tui/src/config.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 171 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) crates/tui/src/fleet/ledger.rs:812 — crates/tui/src/fleet/ledger.rs:812-817 | crates/tui/src/fleet/ledger.rs:860-865 | crates/tui/src/fleet/ledger.rs:918-923 | crates/tui/src/fleet/ledger.rs:1034-1039 — 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 (6 lines × 4) crates/tui/src/tools/web_search.rs:888 — crates/tui/src/tools/web_search.rs:888-897 | crates/tui/src/tools/web_search.rs:1413-1420 | crates/tui/src/tools/web_search.rs:1520-1525 | crates/tui/src/tools/web_search.rs:1645-1652 — 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 (6 lines × 4) crates/tui/src/tools/git_history.rs:120 — crates/tui/src/tools/git_history.rs:120-125 | crates/tui/src/tools/git_history.rs:241-248 | crates/tui/src/tools/git_history.rs:380-387 | crates/tui/src/tools/git_history.rs:513-520 — 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.
X17 · Uncapped recursion over a caller-supplied document · Recursive walk over a caller-supplied document has no depth cap · ×5
  • Recursive walk over a caller-supplied document has no depth cap scripts/catalog_models_dev.py:164 — `strip_sensitive_fields` is public and takes `node: Any` from its caller, and it calls itself at line 164 (`strip_sensitive_fields`) with a piece of `node` (and at line 167) — and nowhere in `strip_sensitive_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 `strip_sensitive_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 scripts/catalog_models_dev.py:565 — `public_value` is public and takes `value: Any` from its caller, and it calls itself at line 565 (`public_value`) with a piece of `value` — and nowhere in `public_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 `public_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 scripts/catalog_models_dev.py:577 — `flatten` is public and takes `value: Any` from its caller, and it calls itself at line 577 (`flatten`) with a piece of `value` — and nowhere in `flatten` 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 `flatten` 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 pet/src/core/evidence.ts:143 — `canonicalJSON` is exported and takes `v: unknown` from its caller, and it calls itself at line 143 (`canonicalJSON`) with a piece of `v` (and at line 144) — and nowhere in `canonicalJSON` 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 `canonicalJSON` 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 pet/src/core/ingest.ts:106 — `decodeAnyValue` is exported and takes `v: unknown` from its caller, and it calls itself at line 106 (`decodeAnyValue`) with a piece of `v` — and nowhere in `decodeAnyValue` 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 `decodeAnyValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×5
  • Swallowed exception (caught, then discarded) scripts/review-eval.mjs:478 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) scripts/split/count_lines.py:122 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) pet/swift/PetHost.swift:93 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) pet/swift/PetHost.swift:186 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) pet/android/src/main/kotlin/codewhale/pet/PetViewModel.kt:195 — `catch (e: Exception)` 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.
D1 · Cyclomatic Complexity · ConfigToml · ×4
  • ConfigToml::resolve_runtime_options_with_secrets (cyclomatic 54) crates/config/src/lib.rs:3403 — ConfigToml::resolve_runtime_options_with_secrets has cyclomatic complexity 54 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • ConfigToml::set_value (cyclomatic 27) crates/config/src/lib.rs:3126 — ConfigToml::set_value has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: ProvidersToml::for_provider (cyclomatic 52) 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 function is counted neither in this dimension's figures nor in its score.
  • ConfigToml::unset_value (cyclomatic 21) crates/config/src/lib.rs:3243 — ConfigToml::unset_value has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: ProvidersToml::for_provider (cyclomatic 52) 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 function is counted neither in this dimension's figures nor in its score.
  • ConfigToml::list_values (cyclomatic 20) crates/config/src/lib.rs:3302 — ConfigToml::list_values has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: ProvidersToml::for_provider (cyclomatic 52) 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 function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · create · ×4
  • create::probe (cyclomatic 40) crates/tui/plugins/computer-use/src/backends/linux.mjs:561 — create::probe 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.
  • create::recordingStart (cyclomatic 20) crates/tui/plugins/computer-use/src/backends/linux.mjs:1160 — create::recordingStart 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.
  • create::kill_app (cyclomatic 19) crates/tui/plugins/computer-use/src/backends/linux.mjs:1071 — create::kill_app 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.
  • create::screenshot (cyclomatic 19) crates/tui/plugins/computer-use/src/backends/win32.mjs:409 — create::screenshot 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 · AutomationEditor · ×4
  • AutomationEditor::key (cyclomatic 37) crates/tui/src/tui/views/automations/editor.rs:761 — AutomationEditor::key 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.
  • AutomationEditor::render_field (cyclomatic 32) crates/tui/src/tui/views/automations/editor.rs:1079 — AutomationEditor::render_field has cyclomatic complexity 32 (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.
  • AutomationEditor::save (cyclomatic 16) crates/tui/src/tui/views/automations/editor.rs:618 — AutomationEditor::save 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.
  • AutomationEditor::mouse (cyclomatic 16) crates/tui/src/tui/views/automations/editor.rs:888 — AutomationEditor::mouse has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · TaskManager · ×4
  • TaskManager::run_task (cyclomatic 32) crates/tui/src/task_manager.rs:2710 — TaskManager::run_task 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.
  • TaskManager::admit_task_record (cyclomatic 18) crates/tui/src/task_manager.rs:2125 — TaskManager::admit_task_record 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.
  • TaskManager::worker_loop (cyclomatic 17) crates/tui/src/task_manager.rs:2610 — TaskManager::worker_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.
  • TaskManager::apply_event_to_task (cyclomatic 17) crates/tui/src/task_manager.rs:2986 — TaskManager::apply_event_to_task 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 · CoordinationLedger · ×4
  • CoordinationLedger::validate_replay (cyclomatic 31) crates/tui/src/tools/subagent/coord/ledger.rs:1100 — CoordinationLedger::validate_replay 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.
  • CoordinationLedger::register_claim_in_scope (cyclomatic 26) crates/tui/src/tools/subagent/coord/ledger.rs:653 — CoordinationLedger::register_claim_in_scope 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.
  • CoordinationLedger::reconcile (cyclomatic 18) crates/tui/src/tools/subagent/coord/ledger.rs:847 — CoordinationLedger::reconcile 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.
  • CoordinationLedger::record_decision_in_scope (cyclomatic 16) crates/tui/src/tools/subagent/coord/ledger.rs:448 — CoordinationLedger::record_decision_in_scope 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 · AcpServer · ×4
  • AcpServer::project_turn (cyclomatic 30) crates/tui/src/acp_server/runtime.rs:176 — AcpServer::project_turn 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.
  • AcpServer::replay_history (cyclomatic 24) crates/tui/src/acp_server.rs:523 — AcpServer::replay_history 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.
  • AcpServer::project_event (cyclomatic 23) crates/tui/src/acp_server/runtime.rs:282 — AcpServer::project_event 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.
  • AcpServer::serve (cyclomatic 18) crates/tui/src/acp_server.rs:197 — AcpServer::serve 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 · codewhale_commands · ×4
  • codewhale_commands::diagnostics_reports::receipts::action_phrase (cyclomatic 24) crates/commands/src/diagnostics_reports/receipts.rs:227 — codewhale_commands::diagnostics_reports::receipts::action_phrase has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • codewhale_commands::debug::undo::patch_result (cyclomatic 21) crates/commands/src/debug/undo.rs:259 — codewhale_commands::debug::undo::patch_result has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • codewhale_commands::diagnostics_reports::receipts::totals_line (cyclomatic 20) crates/commands/src/diagnostics_reports/receipts.rs:19 — codewhale_commands::diagnostics_reports::receipts::totals_line 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.
  • codewhale_commands::debug::cache_format::format_cache_stats (cyclomatic 17) crates/commands/src/debug/cache_format.rs:127 — codewhale_commands::debug::cache_format::format_cache_stats 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 · ExtensionHostManager · ×4
  • ExtensionHostManager::activate_owner (cyclomatic 23) crates/tui/src/extension_host/mod.rs:2321 — ExtensionHostManager::activate_owner 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.
  • ExtensionHostManager::reconcile_with_policy (cyclomatic 19) crates/tui/src/extension_host/mod.rs:1985 — ExtensionHostManager::reconcile_with_policy 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.
  • ExtensionHostManager::execute_launch_for_caller (cyclomatic 18) crates/tui/src/extension_host/execution.rs:1035 — ExtensionHostManager::execute_launch_for_caller 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.
  • ExtensionHostManager::ensure_host (cyclomatic 18) crates/tui/src/extension_host/mod.rs:2627 — ExtensionHostManager::ensure_host 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.
D2 · Cognitive Complexity · AcpServer · ×4
  • AcpServer::replay_history (cognitive 65) crates/tui/src/acp_server.rs:523 — AcpServer::replay_history has cognitive complexity 65 (threshold 15). Drivers by points: if/else 11 (44 pts), loops 4 (9 pts), match/switch 3 (9 pts), boolean chains 3 (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.
  • AcpServer::project_turn (cognitive 63) crates/tui/src/acp_server/runtime.rs:176 — AcpServer::project_turn has cognitive complexity 63 (threshold 15). Drivers by points: if/else 14 (44 pts), match/switch 5 (13 pts), boolean chains 5, loops 1 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AcpServer::serve (cognitive 37) crates/tui/src/acp_server.rs:197 — AcpServer::serve has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (23 pts), match/switch 5 (13 pts), loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AcpServer::project_event (cognitive 26) crates/tui/src/acp_server/runtime.rs:282 — AcpServer::project_event has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 4, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TaskManager · ×4
  • TaskManager::run_task (cognitive 64) crates/tui/src/task_manager.rs:2710 — TaskManager::run_task has cognitive complexity 64 (threshold 15). Drivers by points: if/else 16 (41 pts), match/switch 4 (11 pts), loops 5 (8 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.
  • TaskManager::worker_loop (cognitive 36) crates/tui/src/task_manager.rs:2610 — TaskManager::worker_loop has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (28 pts), match/switch 3 (6 pts), boolean chains 1, 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.
  • TaskManager::admit_task_record (cognitive 24) crates/tui/src/task_manager.rs:2125 — TaskManager::admit_task_record has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (21 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.
  • TaskManager::apply_event_to_task (cognitive 21) crates/tui/src/task_manager.rs:2986 — TaskManager::apply_event_to_task has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (19 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 · AutomationEditor · ×4
  • AutomationEditor::key (cognitive 48) crates/tui/src/tui/views/automations/editor.rs:761 — AutomationEditor::key has cognitive complexity 48 (threshold 15). Drivers by points: if/else 23 (41 pts), boolean chains 4, match/switch 2 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AutomationEditor::render_field (cognitive 25) crates/tui/src/tui/views/automations/editor.rs:1079 — AutomationEditor::render_field has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (5 pts), boolean chains 4, match/switch 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.
  • AutomationEditor::save (cognitive 23) crates/tui/src/tui/views/automations/editor.rs:618 — AutomationEditor::save has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 8 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AutomationEditor::render (cognitive 17) crates/tui/src/tui/views/automations/editor.rs:951 — AutomationEditor::render has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (14 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 · RemoteControlController · ×4
  • RemoteControlController::try_next_event (cognitive 42) crates/tui/src/remote_control.rs:1411 — RemoteControlController::try_next_event has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (34 pts), boolean chains 7, match/switch 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.
  • RemoteControlController::queue_runtime_envelope_inner (cognitive 33) crates/tui/src/remote_control.rs:2507 — RemoteControlController::queue_runtime_envelope_inner has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (27 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RemoteControlController::reconcile_runtime_cursor (cognitive 18) crates/tui/src/remote_control.rs:2868 — RemoteControlController::reconcile_runtime_cursor has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 2, 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.
  • RemoteControlController::start (cognitive 16) crates/tui/src/remote_control.rs:1089 — RemoteControlController::start has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 5, match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · FleetManager · ×4
  • FleetManager::drive_executor_tick (cognitive 40) crates/tui/src/fleet/manager.rs:957 — FleetManager::drive_executor_tick has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (30 pts), match/switch 2 (5 pts), loops 2 (3 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.
  • FleetManager::start_leased_workers (cognitive 33) crates/tui/src/fleet/manager.rs:1595 — FleetManager::start_leased_workers has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (22 pts), match/switch 3 (6 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FleetManager::run_to_completion (cognitive 28) crates/tui/src/fleet/manager.rs:831 — FleetManager::run_to_completion has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (22 pts), boolean chains 2, loops 2, match/switch 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FleetManager::status_from_state (cognitive 16) crates/tui/src/fleet/manager.rs:2264 — FleetManager::status_from_state has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 2 (4 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 · CoordinationLedger · ×4
  • CoordinationLedger::validate_replay (cognitive 40) crates/tui/src/tools/subagent/coord/ledger.rs:1100 — CoordinationLedger::validate_replay has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 9, loops 6 (7 pts), match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CoordinationLedger::register_claim_in_scope (cognitive 34) crates/tui/src/tools/subagent/coord/ledger.rs:653 — CoordinationLedger::register_claim_in_scope has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 9, loops 3 (5 pts), match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CoordinationLedger::record_decision_in_scope (cognitive 18) crates/tui/src/tools/subagent/coord/ledger.rs:448 — CoordinationLedger::record_decision_in_scope has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • CoordinationLedger::reconcile (cognitive 17) crates/tui/src/tools/subagent/coord/ledger.rs:847 — CoordinationLedger::reconcile has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, boolean chains 3. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D30 · Dependency Vulnerabilities · Medium advisory (unmaintained) · ×4
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×4
  • Duplicated block (20 lines × 2) crates/tui/src/task_manager.rs:3811 — crates/tui/src/task_manager.rs:3811-3830 | crates/tui/src/task_manager.rs:3843-3862 — both copies are in the same file, so extract the 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 (20 lines × 2) crates/tui/src/tui/app.rs:4384 — crates/tui/src/tui/app.rs:4384-4403 | crates/tui/src/tui/app.rs:5995-6014 — both copies are in the same file, so extract the 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 (20 lines × 2) crates/tui/src/tui/widgets/approval_band_legacy.rs:773 — crates/tui/src/tui/widgets/approval_band_legacy.rs:773-792 | crates/tui/src/tui/widgets/mod.rs:1964-1983 — before extracting anything, compare `crates/tui/src/tui/widgets/approval_band_legacy.rs` and `crates/tui/src/tui/widgets/mod.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (20 lines × 2) crates/tui/src/session_manager/test_cases_02.rs:24 — crates/tui/src/session_manager/test_cases_02.rs:24-43 | crates/tui/src/session_manager/test_cases_02.rs:68-87 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×4
  • Duplicated block (14–15 lines × 2) crates/tui/src/tui/session_picker.rs:1037 — crates/tui/src/tui/session_picker.rs:1037-1051 | crates/tui/src/tui/views/fleet_roster.rs:378-391 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14–15 lines × 2) crates/tui/src/tui/ui/event_loop.rs:2666 — crates/tui/src/tui/ui/event_loop.rs:2666-2680 | crates/tui/src/tui/ui/event_loop.rs:2776-2789 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14–15 lines × 2) crates/tui/src/tui/widgets/composer_legacy.rs:547 — crates/tui/src/tui/widgets/composer_legacy.rs:547-561 | crates/tui/src/tui/widgets/composer_legacy.rs:595-608 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14–15 lines × 2) crates/tui/src/client/test_cases_02.rs:346 — crates/tui/src/client/test_cases_02.rs:346-360 | crates/tui/src/client/test_cases_02.rs:379-392 — both copies are in the same file, so extract the 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 × 3) · ×4
  • Duplicated block (13 lines × 3) crates/secrets/src/lib.rs:210 — crates/secrets/src/lib.rs:210-222 | crates/secrets/src/lib.rs:246-258 | crates/secrets/src/lib.rs:311-323 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (13 lines × 3) crates/tui/src/plugins/install/tarball.rs:139 — crates/tui/src/plugins/install/tarball.rs:139-151 | crates/tui/src/skills/install.rs:1336-1348 | crates/tui/src/skills/install.rs:1520-1532 — before extracting anything, compare `crates/tui/src/plugins/install/tarball.rs` and `crates/tui/src/skills/install.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 3) crates/tui/src/plugins/marketplace/parsers/claude.rs:92 — crates/tui/src/plugins/marketplace/parsers/claude.rs:92-104 | crates/tui/src/plugins/marketplace/parsers/codewhale.rs:71-83 | crates/tui/src/plugins/marketplace/parsers/codex.rs:67-79 — before extracting anything, compare `crates/tui/src/plugins/marketplace/parsers/claude.rs` and `crates/tui/src/plugins/marketplace/parsers/codewhale.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 3) crates/tui/src/tui/widgets/composer_legacy.rs:527 — crates/tui/src/tui/widgets/composer_legacy.rs:527-539 | crates/tui/src/tui/widgets/composer_legacy.rs:574-586 | crates/tui/src/tui/widgets/composer_legacy.rs:621-633 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×4
  • Duplicated block (9–10 lines × 2) crates/app-server/src/lib.rs:144 — crates/app-server/src/lib.rs:144-153 | crates/app-server/src/lib.rs:177-185 — both copies are in the same file, so extract the 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–10 lines × 2) crates/runtime/src/hashing.rs:43 — crates/runtime/src/hashing.rs:43-51 | crates/tui/src/commands/groups/session/structcopy.rs:945-954 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9–10 lines × 2) crates/tui/src/fleet/worker_runtime.rs:168 — crates/tui/src/fleet/worker_runtime.rs:168-176 | crates/tui/src/tools/workflow/mod.rs:4953-4962 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9–10 lines × 2) crates/tui/src/tools/shell.rs:2524 — crates/tui/src/tools/shell.rs:2524-2533 | crates/tui/src/tools/shell.rs:2635-2643 — both copies are in the same file, so extract the 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 × 4) · ×4
  • Duplicated block (9 lines × 4) crates/tui/src/compaction.rs:2357 — crates/tui/src/compaction.rs:2357-2365 | crates/tui/src/compaction/last_round.rs:398-406 | crates/tui/src/remote_control.rs:3148-3156 | crates/tui/src/superfast.rs:244-252 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
  • Duplicated block (9 lines × 4) crates/tui/src/core/engine/turn_loop.rs:2788 — crates/tui/src/core/engine/turn_loop.rs:2788-2796 | crates/tui/src/core/engine/turn_loop.rs:2827-2835 | crates/tui/src/core/engine/turn_loop.rs:2876-2884 | crates/tui/src/core/engine/turn_loop.rs:2898-2906 — 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 (9 lines × 4) crates/cli/src/hashing.rs:8 — crates/cli/src/hashing.rs:8-16 | crates/runtime/src/hashing.rs:7-15 | crates/tui/src/skills/install.rs:1736-1744 | crates/tui/src/skills/package_digest.rs:179-187 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
  • Duplicated block (9 lines × 4) crates/tui/src/hooks/executor.rs:2563 — crates/tui/src/hooks/executor.rs:2563-2571 | crates/tui/src/hooks/executor.rs:2592-2600 | crates/tui/src/hooks/executor.rs:2618-2626 | crates/tui/src/hooks/executor.rs:2701-2712 — 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.
P7 · Outbound HTTP resilience · Outbound HTTP without resilience · ×4
  • Outbound HTTP without resilience crates/tui/src/runtime_web/app.mjs:529 — `fetch(` 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.
  • Outbound HTTP without resilience crates/tui/src/runtime_web/app.mjs:1099 — `fetch(` 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.
  • Outbound HTTP without resilience scripts/ci/cnb-github-checkrun.mjs:72 — `fetch(` 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.
  • Outbound HTTP without resilience scripts/opencode-chat2responses-proxy.mjs:154 — `fetch(` 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.
AC6 · Visual & motion safety · Focus outline removed in CSS without a · ×3
  • Focus outline removed in CSS without a :focus replacement crates/tui/src/runtime_web/styles.css:294 — `.search-field input` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
  • Focus outline removed in CSS without a :focus replacement crates/tui/src/runtime_web/styles.css:964 — `.other-answer` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
  • Focus outline removed in CSS without a :focus replacement crates/tui/src/runtime_web/styles.css:998 — `.composer textarea` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
D1 · Cyclomatic Complexity · PetEngineTelemetry.observe (cyclomatic 81) · ×3
  • PetEngineTelemetry.observe (cyclomatic 81) crates/tui/src/tui/pet_watch/pet-native.js:1909 — PetEngineTelemetry.observe has cyclomatic complexity 81 (threshold 15). Of this number, 74 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.
  • PetEngineTelemetry.observe (cyclomatic 81) pet/ios/Resources/pet-native.js:1909 — PetEngineTelemetry.observe has cyclomatic complexity 81 (threshold 15). Of this number, 74 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.
  • PetEngineTelemetry.observe (cyclomatic 81) pet/src/core/pet-engine.ts:239 — PetEngineTelemetry.observe has cyclomatic complexity 81 (threshold 15). Of this number, 74 points are the body's own statements and 7 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PetWorld.restore (cyclomatic 77) · ×3
  • PetWorld.restore (cyclomatic 77) crates/tui/src/tui/pet_watch/pet-native.js:391 — PetWorld.restore has cyclomatic complexity 77 (threshold 15). Of this number, 62 points are the body's own statements and 15 belong to 5 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.
  • PetWorld.restore (cyclomatic 77) pet/ios/Resources/pet-native.js:391 — PetWorld.restore has cyclomatic complexity 77 (threshold 15). Of this number, 62 points are the body's own statements and 15 belong to 5 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.
  • PetWorld.restore (cyclomatic 77) pet/src/core/pet-world.ts:211 — PetWorld.restore has cyclomatic complexity 77 (threshold 15). Of this number, 62 points are the body's own statements and 15 belong to 5 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 · Settings · ×3
  • Settings::set (cyclomatic 67) crates/tui/src/settings.rs:1493 — Settings::set has cyclomatic complexity 67 (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.
  • Settings::load_persisted_from_candidates_with_migration_unlocked (cyclomatic 20) crates/tui/src/settings.rs:857 — Settings::load_persisted_from_candidates_with_migration_unlocked has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Settings::canonical_key (cyclomatic 48) 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 function is counted neither in this dimension's figures nor in its score.
  • Settings::apply_env_overrides (cyclomatic 17) crates/tui/src/settings.rs:1216 — Settings::apply_env_overrides has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: Settings::canonical_key (cyclomatic 48) 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 function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · PetWorld.makeFrame (cyclomatic 54) · ×3
  • PetWorld.makeFrame (cyclomatic 54) crates/tui/src/tui/pet_watch/pet-native.js:540 — PetWorld.makeFrame has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • PetWorld.makeFrame (cyclomatic 54) pet/ios/Resources/pet-native.js:540 — PetWorld.makeFrame has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • PetWorld.makeFrame (cyclomatic 54) pet/src/core/pet-world.ts:338 — PetWorld.makeFrame has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SubAgentManager · ×3
  • SubAgentManager::spawn_background_with_assignment_options (cyclomatic 53) crates/tui/src/tools/subagent/mod.rs:8607 — SubAgentManager::spawn_background_with_assignment_options 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.
  • SubAgentManager::cleanup_inner (cyclomatic 22) crates/tui/src/tools/subagent/mod.rs:9696 — SubAgentManager::cleanup_inner 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.
  • SubAgentManager::followup_child (cyclomatic 17) crates/tui/src/tools/subagent/mod.rs:7518 — SubAgentManager::followup_child 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 · PetSim.restore (cyclomatic 40) · ×3
  • PetSim.restore (cyclomatic 40) crates/tui/src/tui/pet_watch/pet-native.js:984 — PetSim.restore has cyclomatic complexity 40 (threshold 15). Of this number, 31 points are the body's own statements and 9 belong to 5 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.
  • PetSim.restore (cyclomatic 40) pet/ios/Resources/pet-native.js:984 — PetSim.restore has cyclomatic complexity 40 (threshold 15). Of this number, 31 points are the body's own statements and 9 belong to 5 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.
  • PetSim.restore (cyclomatic 40) pet/src/core/pet-sim.ts:311 — PetSim.restore has cyclomatic complexity 40 (threshold 15). Of this number, 31 points are the body's own statements and 9 belong to 5 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 · PetEngineTelemetry.activity (cyclomatic 39) · ×3
  • PetEngineTelemetry.activity (cyclomatic 39) crates/tui/src/tui/pet_watch/pet-native.js:1757 — PetEngineTelemetry.activity has cyclomatic complexity 39 (threshold 15). Of this number, 35 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.
  • PetEngineTelemetry.activity (cyclomatic 39) pet/ios/Resources/pet-native.js:1757 — PetEngineTelemetry.activity has cyclomatic complexity 39 (threshold 15). Of this number, 35 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.
  • PetEngineTelemetry.activity (cyclomatic 39) pet/src/core/pet-engine.ts:92 — PetEngineTelemetry.activity has cyclomatic complexity 39 (threshold 15). Of this number, 35 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 · WorkflowPanel · ×3
  • WorkflowPanel::apply_event (cyclomatic 34) crates/tui/src/tui/widgets/workflow_panel.rs:1392 — WorkflowPanel::apply_event 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.
  • WorkflowPanel::from_run_json (cyclomatic 31) crates/tui/src/tui/widgets/workflow_panel.rs:735 — WorkflowPanel::from_run_json 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.
  • WorkflowPanel::history_expanded_lines (cyclomatic 20) crates/tui/src/tui/widgets/workflow_panel.rs:1084 — WorkflowPanel::history_expanded_lines 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 · RemoteControlController · ×3
  • RemoteControlController::try_next_event (cyclomatic 33) crates/tui/src/remote_control.rs:1411 — RemoteControlController::try_next_event 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.
  • RemoteControlController::queue_runtime_envelope_inner (cyclomatic 19) crates/tui/src/remote_control.rs:2507 — RemoteControlController::queue_runtime_envelope_inner 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.
  • RemoteControlController::observe_engine_event (cyclomatic 16) crates/tui/src/remote_control.rs:2296 — RemoteControlController::observe_engine_event 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 · PetWorld.fromRecording (cyclomatic 29) · ×3
  • PetWorld.fromRecording (cyclomatic 29) crates/tui/src/tui/pet_watch/pet-native.js:297 — PetWorld.fromRecording 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.
  • PetWorld.fromRecording (cyclomatic 29) pet/ios/Resources/pet-native.js:297 — PetWorld.fromRecording 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.
  • PetWorld.fromRecording (cyclomatic 29) pet/src/core/pet-world.ts:136 — PetWorld.fromRecording 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 · PetScore.voices (cyclomatic 25) · ×3
  • PetScore.voices (cyclomatic 25) crates/tui/src/tui/pet_watch/pet-native.js:1622 — PetScore.voices 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.
  • PetScore.voices (cyclomatic 25) pet/ios/Resources/pet-native.js:1622 — PetScore.voices 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.
  • PetScore.voices (cyclomatic 25) pet/src/core/pet-audio.ts:24 — PetScore.voices 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 · ApprovalWidget · ×3
  • ApprovalWidget::build_inline_parts (cyclomatic 23) crates/tui/src/tui/widgets/approval_band_legacy.rs:74 — ApprovalWidget::build_inline_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.
  • ApprovalWidget::body_facts (cyclomatic 21) crates/tui/src/tui/widgets/mod.rs:1605 — ApprovalWidget::body_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.
  • ApprovalWidget::render (cyclomatic 18) crates/tui/src/tui/widgets/approval_band_legacy.rs:370 — ApprovalWidget::render has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · app.startBrowserClient · ×3
  • app.startBrowserClient::loadNewThreadModels (cyclomatic 23) crates/tui/src/runtime_web/app.mjs:1999 — app.startBrowserClient::loadNewThreadModels 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. This shape REPEATS in the file: 2 other methods here (app.startBrowserClient::updateItemNode, app.startBrowserClient::renderUserInput) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
  • app.startBrowserClient::updateItemNode (cyclomatic 16) crates/tui/src/runtime_web/app.mjs:1605 — app.startBrowserClient::updateItemNode 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: 2 other methods here (app.startBrowserClient::renderUserInput, app.startBrowserClient::loadNewThreadModels) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
  • app.startBrowserClient::renderUserInput (cyclomatic 16) crates/tui/src/runtime_web/app.mjs:1815 — app.startBrowserClient::renderUserInput 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: 2 other methods here (app.startBrowserClient::updateItemNode, app.startBrowserClient::loadNewThreadModels) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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 · (anonymous) (cyclomatic 20) · ×3
  • (anonymous) (cyclomatic 20) workflows/operate_best_of_n.workflow.js:11 — (anonymous) has cyclomatic complexity 20 (threshold 15). Of this number, 16 points are the body's own statements and 4 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.
  • (anonymous) (cyclomatic 20) pet/ios/Resources/pet-native.js:632 — (anonymous) has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 8 function items inside it that branch (eventMatches, errorOnsetOf, stableHash, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest. This is NOT this file's highest cyclomatic complexity: (anonymous)::validatePetBucket (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
  • (anonymous) (cyclomatic 20) crates/tui/src/tui/pet_watch/pet-native.js:632 — (anonymous) has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 8 function items inside it that branch (eventMatches, errorOnsetOf, stableHash, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest. This is NOT this file's highest cyclomatic complexity: (anonymous)::validatePetBucket (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ChildAuthority · ×3
  • ChildAuthority::validate (cyclomatic 18) crates/tui/src/tools/subagent/engine.rs:350 — ChildAuthority::validate 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.
  • ChildAuthority::tools_for_model (cyclomatic 18) crates/tui/src/tools/subagent/engine.rs:860 — ChildAuthority::tools_for_model 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.
  • ChildAuthority::validate_claim (cyclomatic 16) crates/tui/src/tools/subagent/engine.rs:465 — ChildAuthority::validate_claim 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 · PetWorld.constructor (cyclomatic 18) · ×3
  • PetWorld.constructor (cyclomatic 18) crates/tui/src/tui/pet_watch/pet-native.js:250 — PetWorld.constructor 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.
  • PetWorld.constructor (cyclomatic 18) pet/ios/Resources/pet-native.js:250 — PetWorld.constructor 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.
  • PetWorld.constructor (cyclomatic 18) pet/src/core/pet-world.ts:90 — PetWorld.constructor 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 · PetSim.step (cyclomatic 18) · ×3
  • PetSim.step (cyclomatic 18) crates/tui/src/tui/pet_watch/pet-native.js:1008 — PetSim.step 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.
  • PetSim.step (cyclomatic 18) pet/ios/Resources/pet-native.js:1008 — PetSim.step 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.
  • PetSim.step (cyclomatic 18) pet/src/core/pet-sim.ts:331 — PetSim.step 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.
D2 · Cognitive Complexity · BashTool · ×3
  • BashTool::execute (cognitive 188) crates/tui/src/tools/shell.rs:5889 — BashTool::execute has cognitive complexity 188 (threshold 15). Drivers by points: if/else 95 (138 pts), boolean chains 31, match/switch 10 (15 pts), loops 2 (4 pts) (nesting depth added 50). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BashTool::execute_wait_many (cognitive 27) crates/tui/src/tools/shell.rs:6858 — BashTool::execute_wait_many has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (21 pts), match/switch 3, 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.
  • BashTool::execute_wait (cognitive 16) crates/tui/src/tools/shell.rs:6771 — BashTool::execute_wait has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, match/switch 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 · Expander · ×3
  • Expander::expand (cognitive 181) crates/execpolicy/src/shell_expand.rs:972 — Expander::expand has cognitive complexity 181 (threshold 15). Drivers by points: if/else 29 (93 pts), loops 15 (51 pts), boolean chains 28, match/switch 3 (9 pts) (nesting depth added 106). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Expander::record (cognitive 36) crates/execpolicy/src/shell_expand.rs:1316 — Expander::record has cognitive complexity 36 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 5 (12 pts), match/switch 3 (8 pts), boolean chains 4 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Expander::record_powershell (cognitive 20) crates/execpolicy/src/shell_expand.rs:1445 — Expander::record_powershell has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (17 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 · PluginManifest · ×3
  • PluginManifest::validate_mcp_servers (cognitive 98) crates/tui/src/plugins/manifest.rs:686 — PluginManifest::validate_mcp_servers has cognitive complexity 98 (threshold 15). Drivers by points: if/else 30 (68 pts), boolean chains 14, loops 6 (14 pts), match/switch 1 (2 pts) (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.
  • PluginManifest::validate_metadata (cognitive 28) crates/tui/src/plugins/manifest.rs:576 — PluginManifest::validate_metadata has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 2 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PluginManifest::inventory (cognitive 16) crates/tui/src/plugins/manifest.rs:908 — PluginManifest::inventory has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 3 (5 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 · PetEngineTelemetry.observe (cognitive 73) · ×3
  • PetEngineTelemetry.observe (cognitive 73) crates/tui/src/tui/pet_watch/pet-native.js:1909 — PetEngineTelemetry.observe has cognitive complexity 73 (threshold 15). Drivers by points: if/else 22 (39 pts), boolean chains 19, ternaries 5 (12 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 25). Of this number, 69 points are the body's own statements and 4 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.
  • PetEngineTelemetry.observe (cognitive 73) pet/ios/Resources/pet-native.js:1909 — PetEngineTelemetry.observe has cognitive complexity 73 (threshold 15). Drivers by points: if/else 22 (39 pts), boolean chains 19, ternaries 5 (12 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 25). Of this number, 69 points are the body's own statements and 4 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.
  • PetEngineTelemetry.observe (cognitive 73) pet/src/core/pet-engine.ts:239 — PetEngineTelemetry.observe has cognitive complexity 73 (threshold 15). Drivers by points: if/else 22 (39 pts), boolean chains 19, ternaries 5 (12 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 25). Of this number, 69 points are the body's own statements and 4 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 · ConfigToml · ×3
  • ConfigToml::resolve_runtime_options_with_secrets (cognitive 68) crates/config/src/lib.rs:3403 — ConfigToml::resolve_runtime_options_with_secrets has cognitive complexity 68 (threshold 15). Drivers by points: if/else 43 (44 pts), boolean chains 15, match/switch 5 (9 pts) (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • ConfigToml::list_values (cognitive 29) crates/config/src/lib.rs:3302 — ConfigToml::list_values has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17 (22 pts), loops 3 (6 pts), boolean chains 1 (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.
  • ConfigToml::set_value (cognitive 19) crates/config/src/lib.rs:3126 — ConfigToml::set_value has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatWidget · ×3
  • ChatWidget::new_with_ocean_elapsed (cognitive 67) crates/tui/src/tui/widgets/mod.rs:179 — ChatWidget::new_with_ocean_elapsed has cognitive complexity 67 (threshold 15). Drivers by points: if/else 30 (42 pts), boolean chains 16, loops 4 (9 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.
  • ChatWidget::new_with_ocean_elapsed (cognitive 66) crates/tui/src/tui/widgets/transcript_legacy.rs:130 — ChatWidget::new_with_ocean_elapsed has cognitive complexity 66 (threshold 15). Drivers by points: if/else 30 (42 pts), boolean chains 15, loops 4 (9 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.
  • ChatWidget::render_underwater_field (cognitive 16) crates/tui/src/tui/widgets/transcript_legacy.rs:922 — ChatWidget::render_underwater_field has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PetWorld.makeFrame (cognitive 57) · ×3
  • PetWorld.makeFrame (cognitive 57) crates/tui/src/tui/pet_watch/pet-native.js:540 — PetWorld.makeFrame has cognitive complexity 57 (threshold 15). Drivers by points: if/else 14 (23 pts), ternaries 12 (18 pts), boolean chains 12, loops 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.
  • PetWorld.makeFrame (cognitive 57) pet/ios/Resources/pet-native.js:540 — PetWorld.makeFrame has cognitive complexity 57 (threshold 15). Drivers by points: if/else 14 (23 pts), ternaries 12 (18 pts), boolean chains 12, loops 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.
  • PetWorld.makeFrame (cognitive 57) pet/src/core/pet-world.ts:338 — PetWorld.makeFrame has cognitive complexity 57 (threshold 15). Drivers by points: if/else 14 (23 pts), ternaries 12 (18 pts), boolean chains 12, loops 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 · WorkflowPanel · ×3
  • WorkflowPanel::apply_event (cognitive 54) crates/tui/src/tui/widgets/workflow_panel.rs:1392 — WorkflowPanel::apply_event has cognitive complexity 54 (threshold 15). Drivers by points: if/else 23 (50 pts), boolean chains 3, match/switch 1 (nesting depth added 27). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • WorkflowPanel::from_run_json (cognitive 50) crates/tui/src/tui/widgets/workflow_panel.rs:735 — WorkflowPanel::from_run_json has cognitive complexity 50 (threshold 15). Drivers by points: if/else 22 (32 pts), loops 5 (13 pts), match/switch 1 (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.
  • WorkflowPanel::history_expanded_lines (cognitive 24) crates/tui/src/tui/widgets/workflow_panel.rs:1084 — WorkflowPanel::history_expanded_lines has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (19 pts), loops 3 (4 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.
D2 · Cognitive Complexity · codewhale_workflow_js · ×3
  • codewhale_workflow_js::vm::line_leading_export_default (cognitive 49) crates/workflow-js/src/vm.rs:481 — codewhale_workflow_js::vm::line_leading_export_default has cognitive complexity 49 (threshold 15). Drivers by points: if/else 20 (43 pts), boolean chains 5, 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.
  • codewhale_workflow_js::vm::task_host_inner (cognitive 19) crates/workflow-js/src/vm.rs:1006 — codewhale_workflow_js::vm::task_host_inner has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 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.
  • codewhale_workflow_js::vm::normalize_task_paths (cognitive 16) crates/workflow-js/src/vm.rs:1483 — codewhale_workflow_js::vm::normalize_task_paths has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 2 (3 pts), match/switch 1 (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 · ApprovalWidget · ×3
  • ApprovalWidget::build_inline_parts (cognitive 48) crates/tui/src/tui/widgets/approval_band_legacy.rs:74 — ApprovalWidget::build_inline_parts has cognitive complexity 48 (threshold 15). Drivers by points: if/else 23 (39 pts), loops 3 (7 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.
  • ApprovalWidget::body_facts (cognitive 46) crates/tui/src/tui/widgets/mod.rs:1605 — ApprovalWidget::body_facts has cognitive complexity 46 (threshold 15). Drivers by points: if/else 21 (37 pts), loops 3 (7 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.
  • ApprovalWidget::render (cognitive 28) crates/tui/src/tui/widgets/approval_band_legacy.rs:370 — ApprovalWidget::render has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 4, 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 · RouteResolver · ×3
  • RouteResolver::scope_selector (cognitive 47) crates/config/src/route/resolver.rs:588 — RouteResolver::scope_selector has cognitive complexity 47 (threshold 15). Drivers by points: if/else 20 (32 pts), boolean chains 10, match/switch 2 (4 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RouteResolver::resolve_scoped (cognitive 30) crates/config/src/route/resolver.rs:303 — RouteResolver::resolve_scoped has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (16 pts), match/switch 4 (6 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • RouteResolver::with_configured_models (cognitive 22) crates/config/src/route/resolver.rs:175 — RouteResolver::with_configured_models has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (19 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 · codewhale_sanitize · ×3
  • codewhale_sanitize::sanitize::strip_ansi_impl (cognitive 46) crates/sanitize/src/sanitize.rs:133 — codewhale_sanitize::sanitize::strip_ansi_impl has cognitive complexity 46 (threshold 15). Drivers by points: if/else 9 (30 pts), loops 3 (9 pts), boolean chains 4, match/switch 1 (3 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.
  • codewhale_sanitize::redact::redact_line (cognitive 25) crates/sanitize/src/redact.rs:194 — codewhale_sanitize::redact::redact_line has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_sanitize::sanitize::hidden_chars (cognitive 21) crates/sanitize/src/sanitize.rs:50 — codewhale_sanitize::sanitize::hidden_chars has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 7, 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 · PetScore.voices (cognitive 45) · ×3
  • PetScore.voices (cognitive 45) crates/tui/src/tui/pet_watch/pet-native.js:1622 — PetScore.voices has cognitive complexity 45 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 9, ternaries 2 (9 pts), loops 3 (8 pts) (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • PetScore.voices (cognitive 45) pet/ios/Resources/pet-native.js:1622 — PetScore.voices has cognitive complexity 45 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 9, ternaries 2 (9 pts), loops 3 (8 pts) (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • PetScore.voices (cognitive 45) pet/src/core/pet-audio.ts:24 — PetScore.voices has cognitive complexity 45 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 9, ternaries 2 (9 pts), loops 3 (8 pts) (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Settings · ×3
  • Settings::set (cognitive 34) crates/tui/src/settings.rs:1493 — Settings::set has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (29 pts), match/switch 3 (5 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.
  • Settings::load_persisted_from_candidates_with_migration_unlocked (cognitive 33) crates/tui/src/settings.rs:857 — Settings::load_persisted_from_candidates_with_migration_unlocked has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Settings::apply_env_overrides (cognitive 18) crates/tui/src/settings.rs:1216 — Settings::apply_env_overrides has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 6 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PetEngineTelemetry.activity (cognitive 30) · ×3
  • PetEngineTelemetry.activity (cognitive 30) crates/tui/src/tui/pet_watch/pet-native.js:1757 — PetEngineTelemetry.activity has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 12 (15 pts), boolean chains 9, if/else 5 (6 pts) (nesting depth added 4). Of this number, 27 points are the body's own statements and 3 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.
  • PetEngineTelemetry.activity (cognitive 30) pet/ios/Resources/pet-native.js:1757 — PetEngineTelemetry.activity has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 12 (15 pts), boolean chains 9, if/else 5 (6 pts) (nesting depth added 4). Of this number, 27 points are the body's own statements and 3 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.
  • PetEngineTelemetry.activity (cognitive 30) pet/src/core/pet-engine.ts:92 — PetEngineTelemetry.activity has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 12 (15 pts), boolean chains 9, if/else 5 (6 pts) (nesting depth added 4). Of this number, 27 points are the body's own statements and 3 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 · McpHttpClient · ×3
  • McpHttpClient::execute_inner (cognitive 29) crates/tui/src/mcp/http_client.rs:391 — McpHttpClient::execute_inner has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 5, 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.
  • McpHttpClient::send_mcp_request (cognitive 19) crates/tui/src/mcp/http_client.rs:234 — McpHttpClient::send_mcp_request has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 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.
  • McpHttpClient::client_for_target (cognitive 16) crates/tui/src/mcp/http_client.rs:464 — McpHttpClient::client_for_target has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 8. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · Store · ×3
  • Store::recall_impl (cognitive 27) crates/memory/src/store.rs:978 — Store::recall_impl has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (19 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.
  • Store::capture (cognitive 21) crates/memory/src/store.rs:565 — Store::capture has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Store::advance_context (cognitive 19) crates/memory/src/lens.rs:477 — Store::advance_context has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (16 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, 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 · codewhale_runtime · ×3
  • codewhale_runtime::tool_history_repair::repair_tool_call_pairs_inner (cognitive 26) crates/runtime/src/tool_history_repair.rs:68 — codewhale_runtime::tool_history_repair::repair_tool_call_pairs_inner has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_runtime::external_credentials::open_secure_regular_file (cognitive 20) crates/runtime/src/external_credentials.rs:141 — codewhale_runtime::external_credentials::open_secure_regular_file has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 1, loops 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codewhale_runtime::process_tree::contained_run_with_limits (cognitive 18) crates/runtime/src/process_tree.rs:354 — codewhale_runtime::process_tree::contained_run_with_limits has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (14 pts), match/switch 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 · AutomationManager · ×3
  • AutomationManager::update_automation_unlocked (cognitive 26) crates/tui/src/automation_manager.rs:1368 — AutomationManager::update_automation_unlocked has cognitive complexity 26 (threshold 15). Drivers by points: if/else 20 (23 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, 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.
  • AutomationManager::list_runs_with_visibility (cognitive 17) crates/tui/src/automation_manager.rs:1667 — AutomationManager::list_runs_with_visibility has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 3, 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.
  • AutomationManager::get_runs_by_ids (cognitive 17) crates/tui/src/automation_manager.rs:1755 — AutomationManager::get_runs_by_ids has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PetWorld.fromRecording (cognitive 26) · ×3
  • PetWorld.fromRecording (cognitive 26) crates/tui/src/tui/pet_watch/pet-native.js:297 — PetWorld.fromRecording has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 13, if/else 8 (10 pts), ternaries 2, 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.
  • PetWorld.fromRecording (cognitive 26) pet/ios/Resources/pet-native.js:297 — PetWorld.fromRecording has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 13, if/else 8 (10 pts), ternaries 2, 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.
  • PetWorld.fromRecording (cognitive 26) pet/src/core/pet-world.ts:136 — PetWorld.fromRecording has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 13, if/else 8 (10 pts), ternaries 2, 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 · codewhale_memory · ×3
  • codewhale_memory::policy::validate_draft (cognitive 23) crates/memory/src/policy.rs:51 — codewhale_memory::policy::validate_draft has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 6, loops 5 (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.
  • codewhale_memory::workspace::snapshot (cognitive 22) crates/memory/src/workspace.rs:28 — codewhale_memory::workspace::snapshot has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (19 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.
  • codewhale_memory::import::parse_markdown (cognitive 17) crates/memory/src/import.rs:23 — codewhale_memory::import::parse_markdown has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RuntimeThreadStore · ×3
  • RuntimeThreadStore::newest_message_text_by_turn (cognitive 22) crates/tui/src/runtime_threads.rs:4134 — RuntimeThreadStore::newest_message_text_by_turn has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 2 (3 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.
  • RuntimeThreadStore::newest_message_text_by_thread (cognitive 19) crates/tui/src/runtime_threads.rs:3995 — RuntimeThreadStore::newest_message_text_by_thread has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 4 (9 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.
  • RuntimeThreadStore::seed_complete_beneath_later_turn (cognitive 17) crates/tui/src/runtime_threads.rs:3516 — RuntimeThreadStore::seed_complete_beneath_later_turn has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), match/switch 3 (5 pts), boolean chains 3, 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 · ChildAuthority · ×3
  • ChildAuthority::tools_for_model (cognitive 22) crates/tui/src/tools/subagent/engine.rs:860 — ChildAuthority::tools_for_model has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 8, loops 2, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChildAuthority::validate (cognitive 21) crates/tui/src/tools/subagent/engine.rs:350 — ChildAuthority::validate has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 4, match/switch 1 (3 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.
  • ChildAuthority::validate_claim (cognitive 20) crates/tui/src/tools/subagent/engine.rs:465 — ChildAuthority::validate_claim has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 9 (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 · PetWorld.restore (cognitive 22) · ×3
  • PetWorld.restore (cognitive 22) crates/tui/src/tui/pet_watch/pet-native.js:391 — PetWorld.restore has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 17, if/else 4, ternaries 1. Of this number, 20 points are the body's own statements and 2 belong to 5 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.
  • PetWorld.restore (cognitive 22) pet/ios/Resources/pet-native.js:391 — PetWorld.restore has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 17, if/else 4, ternaries 1. Of this number, 20 points are the body's own statements and 2 belong to 5 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.
  • PetWorld.restore (cognitive 22) pet/src/core/pet-world.ts:211 — PetWorld.restore has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 17, if/else 4, ternaries 1. Of this number, 20 points are the body's own statements and 2 belong to 5 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 · SnapshotRepo · ×3
  • SnapshotRepo::restore_path_plan_locked (cognitive 21) crates/tui/src/snapshot/repo.rs:1302 — SnapshotRepo::restore_path_plan_locked has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 5, boolean chains 3, match/switch 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.
  • SnapshotRepo::diff_snapshots (cognitive 18) crates/tui/src/snapshot/delta.rs:142 — SnapshotRepo::diff_snapshots has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), match/switch 3 (7 pts), loops 2, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SnapshotRepo::newest_reflog_commit (cognitive 17) crates/tui/src/snapshot/repo.rs:752 — SnapshotRepo::newest_reflog_commit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PetNative.presentation (cognitive 17) · ×3
  • PetNative.presentation (cognitive 17) crates/tui/src/tui/pet_watch/pet-native.js:51 — PetNative.presentation has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (10 pts), boolean chains 4, if/else 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • PetNative.presentation (cognitive 17) pet/ios/Resources/pet-native.js:51 — PetNative.presentation has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (10 pts), boolean chains 4, if/else 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • PetNative.presentation (cognitive 17) pet/src/core/pet-native.ts:43 — PetNative.presentation has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (10 pts), boolean chains 4, if/else 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PetSim.step (cognitive 16) · ×3
  • PetSim.step (cognitive 16) crates/tui/src/tui/pet_watch/pet-native.js:1008 — PetSim.step has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 6, loops 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • PetSim.step (cognitive 16) pet/ios/Resources/pet-native.js:1008 — PetSim.step has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 6, loops 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • PetSim.step (cognitive 16) pet/src/core/pet-sim.ts:331 — PetSim.step has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 6, loops 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D29 · Static Analysis (SAST) · REDACTED · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (29 lines × 2) · ×3
  • Duplicated block (29 lines × 2) crates/config/src/config_document.rs:521 — crates/config/src/config_document.rs:521-549 | crates/tui/src/config_persistence.rs:428-456 — before extracting anything, compare `crates/config/src/config_document.rs` and `crates/tui/src/config_persistence.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (29 lines × 2) crates/config/src/windows_identity.rs:37 — crates/config/src/windows_identity.rs:37-65 | crates/tui/src/tools/github/report.rs:1317-1345 — before extracting anything, compare `crates/config/src/windows_identity.rs` and `crates/tui/src/tools/github/report.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (29 lines × 2) crates/tui/src/tui/widgets/mod.rs:703 — crates/tui/src/tui/widgets/mod.rs:703-731 | crates/tui/src/tui/widgets/transcript_legacy.rs:610-638 — before extracting anything, compare `crates/tui/src/tui/widgets/mod.rs` and `crates/tui/src/tui/widgets/transcript_legacy.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 778 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (27 lines × 2) · ×3
  • Duplicated block (27 lines × 2) crates/tui/src/runtime_threads.rs:19615 — crates/tui/src/runtime_threads.rs:19615-19641 | crates/tui/src/runtime_threads.rs:19643-19669 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (27 lines × 2) crates/tui/src/tui/widgets/approval_band_legacy.rs:859 — crates/tui/src/tui/widgets/approval_band_legacy.rs:859-885 | crates/tui/src/tui/widgets/mod.rs:2050-2076 — before extracting anything, compare `crates/tui/src/tui/widgets/approval_band_legacy.rs` and `crates/tui/src/tui/widgets/mod.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (27 lines × 2) crates/tui/src/tui/widgets/mod.rs:90 — crates/tui/src/tui/widgets/mod.rs:90-116 | crates/tui/src/tui/widgets/transcript_legacy.rs:53-79 — before extracting anything, compare `crates/tui/src/tui/widgets/mod.rs` and `crates/tui/src/tui/widgets/transcript_legacy.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 778 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (24 lines × 2) · ×3
  • Duplicated block (24 lines × 2) crates/tui/src/plugins/registry.rs:1629 — crates/tui/src/plugins/registry.rs:1629-1652 | crates/tui/src/plugins/registry.rs:1879-1902 — both copies are in the same file, so extract the 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) crates/tui/src/tui/ui/event_loop.rs:5492 — crates/tui/src/tui/ui/event_loop.rs:5492-5515 | crates/tui/src/tui/ui/event_loop.rs:6279-6302 — both copies are in the same file, so extract the 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) crates/tui/src/tui/widgets/mod.rs:2857 — crates/tui/src/tui/widgets/mod.rs:2857-2880 | crates/tui/src/tui/widgets/transcript_legacy.rs:1111-1134 — before extracting anything, compare `crates/tui/src/tui/widgets/mod.rs` and `crates/tui/src/tui/widgets/transcript_legacy.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 778 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (22–23 lines × 2) · ×3
  • Duplicated block (22–23 lines × 2) crates/tui/src/core/engine/compaction.rs:421 — crates/tui/src/core/engine/compaction.rs:421-442 | crates/tui/src/core/engine/compaction.rs:451-473 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (22–23 lines × 2) crates/tui/src/runtime_api/mobile.rs:100 — crates/tui/src/runtime_api/mobile.rs:100-121 | crates/tui/src/runtime_api/web.rs:84-106 — before extracting anything, compare `crates/tui/src/runtime_api/mobile.rs` and `crates/tui/src/runtime_api/web.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (22–23 lines × 2) crates/tui/src/tui/widgets/mod.rs:252 — crates/tui/src/tui/widgets/mod.rs:252-273 | crates/tui/src/tui/widgets/transcript_legacy.rs:201-223 — before extracting anything, compare `crates/tui/src/tui/widgets/mod.rs` and `crates/tui/src/tui/widgets/transcript_legacy.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 778 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (16–17 lines × 2) · ×3
  • Duplicated block (16–17 lines × 2) crates/tui/src/commands/contract.rs:3407 — crates/tui/src/commands/contract.rs:3407-3423 | crates/tui/src/commands/contract.rs:4421-4436 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16–17 lines × 2) crates/tui/src/extension_host/execution.rs:1144 — crates/tui/src/extension_host/execution.rs:1144-1159 | crates/tui/src/extension_host/execution.rs:1302-1318 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16–17 lines × 2) crates/tui/src/tui/provider_picker.rs:4175 — crates/tui/src/tui/provider_picker.rs:4175-4190 | crates/tui/src/tui/provider_picker.rs:4214-4230 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×3
  • Duplicated block (14 lines × 3) crates/tui/src/core/engine/turn_loop.rs:2782 — crates/tui/src/core/engine/turn_loop.rs:2782-2795 | crates/tui/src/core/engine/turn_loop.rs:2821-2834 | crates/tui/src/core/engine/turn_loop.rs:2870-2883 — 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 (14 lines × 3) crates/tui/src/plugins/marketplace/parsers/claude.rs:214 — crates/tui/src/plugins/marketplace/parsers/claude.rs:214-227 | crates/tui/src/plugins/marketplace/parsers/codewhale.rs:154-167 | crates/tui/src/plugins/marketplace/parsers/codex.rs:166-179 — before extracting anything, compare `crates/tui/src/plugins/marketplace/parsers/claude.rs` and `crates/tui/src/plugins/marketplace/parsers/codewhale.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 3) crates/tui/src/task_manager.rs:3903 — crates/tui/src/task_manager.rs:3903-3916 | crates/tui/src/tools/github/shape.rs:178-191 | crates/tui/src/tools/tasks.rs:1369-1382 — before extracting anything, compare `crates/tui/src/tools/github/shape.rs` and `crates/tui/src/tools/tasks.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (12–14 lines × 2) · ×3
  • Duplicated block (12–14 lines × 2) crates/cli/src/metrics.rs:491 — crates/cli/src/metrics.rs:491-502 | crates/cli/src/metrics.rs:920-933 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–14 lines × 2) crates/tui/src/plugins/marketplace/parsers/claude.rs:229 — crates/tui/src/plugins/marketplace/parsers/claude.rs:229-240 | crates/tui/src/plugins/marketplace/parsers/kimi.rs:139-152 — before extracting anything, compare `crates/tui/src/plugins/marketplace/parsers/claude.rs` and `crates/tui/src/plugins/marketplace/parsers/kimi.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12–14 lines × 2) crates/tui/src/tui/model_picker.rs:4557 — crates/tui/src/tui/model_picker.rs:4557-4568 | crates/tui/src/tui/provider_picker.rs:2969-2982 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (13–14 lines × 2) · ×3
  • Duplicated block (13–14 lines × 2) crates/tui/src/plugins/marketplace/parsers/claude.rs:98 — crates/tui/src/plugins/marketplace/parsers/claude.rs:98-111 | crates/tui/src/plugins/marketplace/parsers/codewhale.rs:77-89 — before extracting anything, compare `crates/tui/src/plugins/marketplace/parsers/claude.rs` and `crates/tui/src/plugins/marketplace/parsers/codewhale.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13–14 lines × 2) crates/tui/src/plugins/marketplace/parsers/claude.rs:142 — crates/tui/src/plugins/marketplace/parsers/claude.rs:142-155 | crates/tui/src/plugins/marketplace/parsers/codewhale.rs:103-115 — before extracting anything, compare `crates/tui/src/plugins/marketplace/parsers/claude.rs` and `crates/tui/src/plugins/marketplace/parsers/codewhale.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13–14 lines × 2) crates/tui/src/tools/web_search.rs:596 — crates/tui/src/tools/web_search.rs:596-608 | crates/tui/src/tools/web_tool.rs:97-110 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (11–13 lines × 2) · ×3
  • Duplicated block (11–13 lines × 2) crates/config/src/lib.rs:4189 — crates/config/src/lib.rs:4189-4199 | crates/tui/src/config.rs:253-265 — before extracting anything, compare `crates/config/src/lib.rs` and `crates/tui/src/config.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 171 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 (11–13 lines × 2) crates/core/src/tool_parser.rs:431 — crates/core/src/tool_parser.rs:431-443 | crates/core/src/tool_parser.rs:453-463 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11–13 lines × 2) crates/tui/src/tools/subagent/mod.rs:5478 — crates/tui/src/tools/subagent/mod.rs:5478-5490 | crates/tui/src/tools/subagent/mod.rs:6666-6676 — both copies are in the same file, so extract the 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–12 lines × 2) · ×3
  • Duplicated block (11–12 lines × 2) crates/app-server/src/daemon_socket.rs:1169 — crates/app-server/src/daemon_socket.rs:1169-1180 | crates/app-server/src/daemon_windows.rs:269-279 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (11–12 lines × 2) crates/tui/src/client/chat.rs:4182 — crates/tui/src/client/chat.rs:4182-4192 | crates/tui/src/client/chat.rs:4196-4207 — both copies are in the same file, so extract the 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–12 lines × 2) crates/tui/src/extension_host/hooks.rs:46 — crates/tui/src/extension_host/hooks.rs:46-56 | crates/tui/src/extension_host/hooks.rs:77-88 — both copies are in the same file, so extract the 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 (10–12 lines × 2) · ×3
  • Duplicated block (10–12 lines × 2) crates/execpolicy/src/bash_arity.rs:326 — crates/execpolicy/src/bash_arity.rs:326-335 | crates/execpolicy/src/command_safety.rs:280-291 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (10–12 lines × 2) crates/tui/src/tools/web_run.rs:1708 — crates/tui/src/tools/web_run.rs:1708-1717 | crates/tui/src/tools/web_run.rs:1757-1768 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10–12 lines × 2) crates/tui/src/tui/provider_picker.rs:4966 — crates/tui/src/tui/provider_picker.rs:4966-4977 | crates/tui/src/tui/provider_picker.rs:5060-5069 — both copies are in the same file, so extract the 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 lines × 4) · ×3
  • Duplicated block (11 lines × 4) crates/tui/src/tools/web_search.rs:1016 — crates/tui/src/tools/web_search.rs:1016-1026 | crates/tui/src/tools/web_search.rs:1111-1121 | crates/tui/src/tools/web_search.rs:1255-1265 | crates/tui/src/tools/web_search.rs:1460-1470 — 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 (11 lines × 4) crates/tui/src/tools/web_search.rs:968 — crates/tui/src/tools/web_search.rs:968-978 | crates/tui/src/tools/web_search.rs:1061-1071 | crates/tui/src/tools/web_search.rs:1149-1159 | crates/tui/src/tools/web_search.rs:1301-1311 — 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 (11 lines × 4) crates/tui/src/client/test_cases_01.rs:427 — crates/tui/src/client/test_cases_01.rs:427-437 | crates/tui/src/client/test_cases_01.rs:452-462 | crates/tui/src/client/test_cases_01.rs:477-487 | crates/tui/src/client/test_cases_01.rs:1604-1614 — 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 (10 lines × 4) · ×3
  • Duplicated block (10 lines × 4) crates/tui/src/remote_control.rs:365 — crates/tui/src/remote_control.rs:365-374 | crates/tui/src/runtime_chat_relay.rs:1700-1709 | crates/tui/src/runtime_threads.rs:7507-7516 | crates/tui/src/session_manager.rs:1586-1595 — before extracting anything, compare `crates/tui/src/remote_control.rs` and `crates/tui/src/runtime_chat_relay.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 4) crates/tui/src/tui/context_menu.rs:674 — crates/tui/src/tui/context_menu.rs:674-683 | crates/tui/src/tui/context_menu.rs:688-697 | crates/tui/src/tui/widgets/mod.rs:926-935 | crates/tui/src/tui/widgets/transcript_legacy.rs:796-805 — before extracting anything, compare `crates/tui/src/tui/widgets/mod.rs` and `crates/tui/src/tui/widgets/transcript_legacy.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 778 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 4) crates/tui/src/tools/git_history.rs:242 — crates/tui/src/tools/git_history.rs:242-251 | crates/tui/src/tools/git_history.rs:381-390 | crates/tui/src/tools/git_history.rs:514-523 | crates/tui/src/tools/git_history.rs:633-642 — 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 (8–10 lines × 2) · ×3
  • Duplicated block (8–10 lines × 2) crates/tui/src/core/engine/tool_execution.rs:875 — crates/tui/src/core/engine/tool_execution.rs:875-882 | crates/tui/src/lib.rs:14333-14342 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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–10 lines × 2) crates/tui/src/extension_host/avatars.rs:137 — crates/tui/src/extension_host/avatars.rs:137-144 | crates/tui/src/extension_host/skills.rs:126-135 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8–10 lines × 2) crates/tui/src/tui/ui/apply.rs:3748 — crates/tui/src/tui/ui/apply.rs:3748-3755 | crates/tui/src/tui/ui/apply.rs:3851-3860 — both copies are in the same file, so extract the 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 lines × 5) · ×3
  • Duplicated block (8 lines × 5) crates/cloud-facts/src/lib.rs:312 — crates/cloud-facts/src/lib.rs:312-319 | crates/tui/src/plugins/registry.rs:1163-1171 | crates/tui/src/provider_catalog_live.rs:784-791 | crates/tui/src/runtime_api/diagnostics.rs:180-187 | crates/tui/src/session_manager.rs:222-229 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times.
  • Duplicated block (8 lines × 5) crates/tui/src/plugins/marketplace/parsers/claude.rs:106 — crates/tui/src/plugins/marketplace/parsers/claude.rs:106-113 | crates/tui/src/plugins/marketplace/parsers/claude.rs:276-283 | crates/tui/src/plugins/marketplace/parsers/codewhale.rs:84-91 | crates/tui/src/plugins/marketplace/parsers/codewhale.rs:234-241 | crates/tui/src/plugins/marketplace/parsers/kimi.rs:194-201 — before extracting anything, compare `crates/tui/src/plugins/marketplace/parsers/claude.rs` and `crates/tui/src/plugins/marketplace/parsers/codewhale.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 5) crates/tui/src/config.rs:8365 — crates/tui/src/config.rs:8365-8372 | crates/tui/src/config.rs:8374-8383 | crates/tui/src/config.rs:8385-8392 | crates/tui/src/config.rs:8394-8401 | crates/tui/src/config.rs:8420-8427 — 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.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×3
  • Duplicated block (8 lines × 4) crates/tui/src/core/engine/context.rs:82 — crates/tui/src/core/engine/context.rs:82-89 | crates/tui/src/notify/payload.rs:280-287 | crates/tui/src/purge.rs:267-274 | crates/tui/src/rlm/session.rs:416-423 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
  • Duplicated block (8 lines × 4) crates/tui/src/tools/git.rs:133 — crates/tui/src/tools/git.rs:133-140 | crates/tui/src/tools/git.rs:238-245 | crates/tui/src/tools/git_history.rs:246-254 | crates/tui/src/tools/git_history.rs:385-393 — before extracting anything, compare `crates/tui/src/tools/git.rs` and `crates/tui/src/tools/git_history.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 4) crates/commands/src/diagnostics_reports/receipts.rs:6 — crates/commands/src/diagnostics_reports/receipts.rs:6-13 | crates/lane/src/control.rs:2198-2205 | crates/tui/src/commands/groups/core/workflow.rs:54-62 | crates/tui/src/tools/session.rs:25-32 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×3
  • Duplicated block (7 lines × 4) crates/tui/src/commands/contract.rs:4202 — crates/tui/src/commands/contract.rs:4202-4208 | crates/tui/src/commands/contract.rs:4241-4247 | crates/tui/src/commands/contract.rs:4277-4283 | crates/tui/src/commands/contract.rs:4453-4459 — 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) crates/tui/src/tools/web_search.rs:764 — crates/tui/src/tools/web_search.rs:764-770 | crates/tui/src/tools/web_search.rs:1397-1404 | crates/tui/src/tools/web_search.rs:1504-1511 | crates/tui/src/tools/web_search.rs:1627-1636 — 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) REDACTED:4848 — REDACTED:4848-4854 | REDACTED:4873-4879 | REDACTED:4882-4888 | REDACTED:4891-4897 — 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.
R2 · Cyclomatic Complexity · Complex function observe (cyclomatic 72, cognitive 81) · ×3
  • Complex function observe (cyclomatic 72, cognitive 81) crates/tui/src/tui/pet_watch/pet-native.js:1909 — observe has cyclomatic complexity 72 and cognitive complexity 81; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
  • Complex function observe (cyclomatic 72, cognitive 81) pet/ios/Resources/pet-native.js:1909 — observe has cyclomatic complexity 72 and cognitive complexity 81; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
  • Complex function observe (cyclomatic 72, cognitive 81) pet/src/core/pet-engine.ts:239 — observe has cyclomatic complexity 72 and cognitive complexity 81; 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 compilePetTelemetry (cyclomatic 61, cognitive 87) · ×3
  • Complex function compilePetTelemetry (cyclomatic 61, cognitive 87) crates/tui/src/tui/pet_watch/pet-native.js:1219 — compilePetTelemetry has cyclomatic complexity 61 and cognitive complexity 87; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
  • Complex function compilePetTelemetry (cyclomatic 61, cognitive 87) pet/ios/Resources/pet-native.js:1219 — compilePetTelemetry has cyclomatic complexity 61 and cognitive complexity 87; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
  • Complex function compilePetTelemetry (cyclomatic 61, cognitive 87) pet/src/core/pet-telemetry.ts:70 — compilePetTelemetry has cyclomatic complexity 61 and cognitive complexity 87; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function makeFrame (cyclomatic 60, cognitive 71) · ×3
  • Complex function makeFrame (cyclomatic 60, cognitive 71) crates/tui/src/tui/pet_watch/pet-native.js:540 — makeFrame has cyclomatic complexity 60 and cognitive complexity 71; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
  • Complex function makeFrame (cyclomatic 60, cognitive 71) pet/ios/Resources/pet-native.js:540 — makeFrame has cyclomatic complexity 60 and cognitive complexity 71; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
  • Complex function makeFrame (cyclomatic 60, cognitive 71) pet/src/core/pet-world.ts:338 — makeFrame has cyclomatic complexity 60 and cognitive complexity 71; 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 restore (cyclomatic 60, cognitive 48) · ×3
  • Complex function restore (cyclomatic 60, cognitive 48) crates/tui/src/tui/pet_watch/pet-native.js:391 — restore has cyclomatic complexity 60 and cognitive complexity 48; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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.
  • Complex function restore (cyclomatic 60, cognitive 48) pet/ios/Resources/pet-native.js:391 — restore has cyclomatic complexity 60 and cognitive complexity 48; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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.
  • Complex function restore (cyclomatic 60, cognitive 48) pet/src/core/pet-world.ts:211 — restore has cyclomatic complexity 60 and cognitive complexity 48; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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.
X2 · Cancellation propagation · Async function without AbortSignal · ×3
  • Async function without AbortSignal: fetchReceipt web/scripts/compare-deployed-facts.mjs:55 — `fetchReceipt` 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: githubApi scripts/ci/cnb-github-checkrun.mjs:71 — `githubApi` 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: runtimeJson integrations/bridge-core/src/lib.mjs:644 — `runtimeJson` 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 })`.
AC2 · Forms & labels · <fieldset> without a <legend> · ×2
  • <fieldset> without a <legend> web/components/merch-interest.tsx:67 — A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one.
  • <fieldset> without a <legend> web/components/merch-storefront.tsx:95 — A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one.
D1 · Cyclomatic Complexity · BashTool · ×2
  • BashTool::execute (cyclomatic 125) crates/tui/src/tools/shell.rs:5889 — BashTool::execute has cyclomatic complexity 125 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • BashTool::execute_wait_many (cyclomatic 19) crates/tui/src/tools/shell.rs:6858 — BashTool::execute_wait_many 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 · Expander · ×2
  • Expander::expand (cyclomatic 89) crates/execpolicy/src/shell_expand.rs:972 — Expander::expand has cyclomatic complexity 89 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Expander::record (cyclomatic 31) crates/execpolicy/src/shell_expand.rs:1316 — Expander::record has cyclomatic complexity 31 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · App · ×2
  • App::new_with_plugin_registry (cyclomatic 73) crates/tui/src/tui/app/init.rs:27 — App::new_with_plugin_registry has cyclomatic complexity 73 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • App::announce_settled_workflows (cyclomatic 25) crates/tui/src/tui/app.rs:6231 — App::announce_settled_workflows 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 · CatalogOffering · ×2
  • CatalogOffering::complete_facts_from (cyclomatic 63) crates/config/src/catalog.rs:354 — CatalogOffering::complete_facts_from has cyclomatic complexity 63 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • CatalogOffering::retain_fact_sources (cyclomatic 30) crates/config/src/catalog.rs:229 — CatalogOffering::retain_fact_sources has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ComposerWidget · ×2
  • ComposerWidget::render (cyclomatic 62) crates/tui/src/tui/widgets/composer_legacy.rs:253 — ComposerWidget::render 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.
  • ComposerWidget::frame (cyclomatic 18) crates/tui/src/tui/widgets/mod.rs:1264 — ComposerWidget::frame 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 · PluginManifest · ×2
  • PluginManifest::validate_mcp_servers (cyclomatic 53) crates/tui/src/plugins/manifest.rs:686 — PluginManifest::validate_mcp_servers 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.
  • PluginManifest::validate_metadata (cyclomatic 16) crates/tui/src/plugins/manifest.rs:576 — PluginManifest::validate_metadata 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 · ChatWidget · ×2
  • ChatWidget::new_with_ocean_elapsed (cyclomatic 42) crates/tui/src/tui/widgets/mod.rs:179 — ChatWidget::new_with_ocean_elapsed 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.
  • ChatWidget::new_with_ocean_elapsed (cyclomatic 41) crates/tui/src/tui/widgets/transcript_legacy.rs:130 — ChatWidget::new_with_ocean_elapsed 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 · PagerView · ×2
  • PagerView::handle_key (cyclomatic 41) crates/tui/src/tui/pager.rs:591 — PagerView::handle_key has cyclomatic complexity 41 (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.
  • PagerView::render (cyclomatic 25) crates/tui/src/tui/pager.rs:842 — PagerView::render 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 · ExtensionsView · ×2
  • ExtensionsView::render (cyclomatic 41) crates/tui/src/tui/views/extensions.rs:2230 — ExtensionsView::render 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.
  • ExtensionsView::handle_key (cyclomatic 26) crates/tui/src/tui/views/extensions.rs:2029 — ExtensionsView::handle_key has cyclomatic complexity 26 (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 · GenericToolCell · ×2
  • GenericToolCell::lines_with_mode_and_locale (cyclomatic 34) crates/tui/src/tui/history.rs:2118 — GenericToolCell::lines_with_mode_and_locale 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.
  • GenericToolCell::try_render_as_workflow (cyclomatic 21) crates/tui/src/tui/history.rs:2380 — GenericToolCell::try_render_as_workflow 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 · RouteResolver · ×2
  • RouteResolver::scope_selector (cyclomatic 33) crates/config/src/route/resolver.rs:588 — RouteResolver::scope_selector 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.
  • RouteResolver::resolve_scoped (cyclomatic 27) crates/config/src/route/resolver.rs:303 — RouteResolver::resolve_scoped 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 · codewhale_memory · ×2
  • codewhale_memory::run (cyclomatic 33) crates/memory/src/main.rs:191 — codewhale_memory::run has cyclomatic complexity 33 (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.
  • codewhale_memory::policy::validate_draft (cyclomatic 21) crates/memory/src/policy.rs:51 — codewhale_memory::policy::validate_draft 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 · FleetDetailView · ×2
  • FleetDetailView::handle_key (cyclomatic 31) crates/tui/src/tui/views/fleet_detail.rs:781 — FleetDetailView::handle_key has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • FleetDetailView::render_overview (cyclomatic 26) crates/tui/src/tui/views/fleet_detail.rs:1049 — FleetDetailView::render_overview 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 · Components · ×2
  • Components::walk (cyclomatic 28) crates/tui/src/plugins/install/dsh.rs:1238 — Components::walk 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.
  • Components::mcp_row (cyclomatic 17) crates/tui/src/plugins/install/dsh.rs:1141 — Components::mcp_row 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 · ExecCell · ×2
  • ExecCell::render_with_locale (cyclomatic 26) crates/tui/src/tui/history.rs:1079 — ExecCell::render_with_locale 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.
  • ExecCell::render_calm (cyclomatic 16) crates/tui/src/tui/history.rs:1237 — ExecCell::render_calm 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 · AutomationSchedule · ×2
  • AutomationSchedule::next_after_in_timezone (cyclomatic 24) crates/tui/src/automation_manager.rs:533 — AutomationSchedule::next_after_in_timezone 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.
  • AutomationSchedule::parse_rrule (cyclomatic 22) crates/tui/src/automation_manager.rs:405 — AutomationSchedule::parse_rrule 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 · FleetListView · ×2
  • FleetListView::render_rows (cyclomatic 23) crates/tui/src/tui/views/fleet_list.rs:435 — FleetListView::render_rows 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.
  • FleetListView::handle_key (cyclomatic 20) crates/tui/src/tui/views/fleet_list.rs:240 — FleetListView::handle_key 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 · codewhale_core · ×2
  • codewhale_core::fragments::collect_candidate_files (cyclomatic 18) crates/core/src/fragments.rs:320 — codewhale_core::fragments::collect_candidate_files 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.
  • codewhale_core::prefix_cache::context_update_message (cyclomatic 18) crates/core/src/prefix_cache.rs:748 — codewhale_core::prefix_cache::context_update_message 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 · OwnerRegistry · ×2
  • OwnerRegistry::register_shell_hook (cyclomatic 18) crates/tui/src/extension_host/registry.rs:978 — OwnerRegistry::register_shell_hook 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.
  • OwnerRegistry::register_command (cyclomatic 16) crates/tui/src/extension_host/registry.rs:1125 — OwnerRegistry::register_command 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 · FleetManager · ×2
  • FleetManager::drive_executor_tick (cyclomatic 18) crates/tui/src/fleet/manager.rs:957 — FleetManager::drive_executor_tick 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.
  • FleetManager::start_leased_workers (cyclomatic 16) crates/tui/src/fleet/manager.rs:1595 — FleetManager::start_leased_workers 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 · McpHttpClient · ×2
  • McpHttpClient::execute_inner (cyclomatic 17) crates/tui/src/mcp/http_client.rs:391 — McpHttpClient::execute_inner 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.
  • McpHttpClient::client_for_target (cyclomatic 16) crates/tui/src/mcp/http_client.rs:464 — McpHttpClient::client_for_target 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 · RuntimeThreadStore · ×2
  • RuntimeThreadStore::seed_complete_beneath_later_turn (cyclomatic 17) crates/tui/src/runtime_threads.rs:3516 — RuntimeThreadStore::seed_complete_beneath_later_turn 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.
  • RuntimeThreadStore::newest_message_text_by_turn (cyclomatic 17) crates/tui/src/runtime_threads.rs:4134 — RuntimeThreadStore::newest_message_text_by_turn 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.
D2 · Cognitive Complexity · ComposerWidget · ×2
  • ComposerWidget::render (cognitive 142) crates/tui/src/tui/widgets/composer_legacy.rs:253 — ComposerWidget::render has cognitive complexity 142 (threshold 15). Drivers by points: if/else 68 (118 pts), loops 7 (15 pts), boolean chains 9 (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.
  • ComposerWidget::frame (cognitive 34) crates/tui/src/tui/widgets/mod.rs:1264 — ComposerWidget::frame has cognitive complexity 34 (threshold 15). Drivers by points: if/else 27 (32 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · CatalogOffering · ×2
  • CatalogOffering::complete_facts_from (cognitive 66) crates/config/src/catalog.rs:354 — CatalogOffering::complete_facts_from has cognitive complexity 66 (threshold 15). Drivers by points: if/else 30 (33 pts), boolean chains 31, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • CatalogOffering::retain_fact_sources (cognitive 32) crates/config/src/catalog.rs:229 — CatalogOffering::retain_fact_sources has cognitive complexity 32 (threshold 15). Drivers by points: if/else 27 (29 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Components · ×2
  • Components::walk (cognitive 63) crates/tui/src/plugins/install/dsh.rs:1238 — Components::walk has cognitive complexity 63 (threshold 15). Drivers by points: if/else 17 (43 pts), match/switch 5 (13 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Components::mcp_row (cognitive 30) crates/tui/src/plugins/install/dsh.rs:1141 — Components::mcp_row has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (26 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Broker · ×2
  • Broker::authorize_frame (cognitive 62) crates/tui/src/extension_host/mcp.rs:438 — Broker::authorize_frame has cognitive complexity 62 (threshold 15). Drivers by points: if/else 23 (51 pts), boolean chains 10, match/switch 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.
  • Broker::launch (cognitive 18) crates/tui/src/extension_host/mcp.rs:279 — Broker::launch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), match/switch 3 (6 pts), 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 · GenericToolCell · ×2
  • GenericToolCell::lines_with_mode_and_locale (cognitive 62) crates/tui/src/tui/history.rs:2118 — GenericToolCell::lines_with_mode_and_locale has cognitive complexity 62 (threshold 15). Drivers by points: if/else 28 (49 pts), boolean chains 11, loops 1 (2 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • GenericToolCell::try_render_as_workflow (cognitive 29) crates/tui/src/tui/history.rs:2380 — GenericToolCell::try_render_as_workflow has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (20 pts), loops 2 (5 pts), boolean chains 3, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExtensionsView · ×2
  • ExtensionsView::render (cognitive 61) crates/tui/src/tui/views/extensions.rs:2230 — ExtensionsView::render has cognitive complexity 61 (threshold 15). Drivers by points: if/else 34 (43 pts), match/switch 4 (10 pts), boolean chains 6, loops 2 (nesting depth added 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • ExtensionsView::handle_key (cognitive 18) crates/tui/src/tui/views/extensions.rs:2029 — ExtensionsView::handle_key has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 3 (5 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AutomationSchedule · ×2
  • AutomationSchedule::next_after_in_timezone (cognitive 55) crates/tui/src/automation_manager.rs:533 — AutomationSchedule::next_after_in_timezone has cognitive complexity 55 (threshold 15). Drivers by points: if/else 14 (40 pts), loops 4 (10 pts), boolean chains 4, match/switch 1 (nesting depth added 32). 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.
  • AutomationSchedule::parse_rrule (cognitive 31) crates/tui/src/automation_manager.rs:405 — AutomationSchedule::parse_rrule has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 3 (5 pts), boolean chains 2, match/switch 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 · FleetDetailView · ×2
  • FleetDetailView::render_overview (cognitive 50) crates/tui/src/tui/views/fleet_detail.rs:1049 — FleetDetailView::render_overview has cognitive complexity 50 (threshold 15). Drivers by points: if/else 19 (31 pts), match/switch 3 (8 pts), boolean chains 6, loops 3 (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.
  • FleetDetailView::handle_key (cognitive 18) crates/tui/src/tui/views/fleet_detail.rs:781 — FleetDetailView::handle_key has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 5 (11 pts), if/else 3 (7 pts) (nesting depth added 10). 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 · PagerView · ×2
  • PagerView::render (cognitive 46) crates/tui/src/tui/pager.rs:842 — PagerView::render has cognitive complexity 46 (threshold 15). Drivers by points: if/else 28 (39 pts), loops 2 (5 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.
  • PagerView::handle_key (cognitive 23) crates/tui/src/tui/pager.rs:591 — PagerView::handle_key has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 5, match/switch 3 (5 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · lib.validateBridgeConfig (cognitive 46) · ×2
  • lib.validateBridgeConfig (cognitive 46) integrations/feishu-bridge/src/lib.mjs:94 — lib.validateBridgeConfig has cognitive complexity 46 (threshold 15). Drivers by points: if/else 22 (26 pts), boolean chains 18, 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.
  • lib.validateBridgeConfig (cognitive 46) REDACTED:437 — lib.validateBridgeConfig has cognitive complexity 46 (threshold 15). Drivers by points: if/else 23 (26 pts), boolean chains 19, 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 · FleetListView · ×2
  • FleetListView::render_rows (cognitive 38) crates/tui/src/tui/views/fleet_list.rs:435 — FleetListView::render_rows has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 6, loops 3 (5 pts), match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FleetListView::handle_key (cognitive 28) crates/tui/src/tui/views/fleet_list.rs:240 — FleetListView::handle_key has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 4 (9 pts), loops 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 · LspManager · ×2
  • LspManager::semantic_locations (cognitive 36) crates/tui/src/lsp/mod.rs:677 — LspManager::semantic_locations has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (23 pts), match/switch 4 (8 pts), boolean chains 4, 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.
  • LspManager::intelligence_at_revision (cognitive 29) crates/tui/src/lsp/mod.rs:540 — LspManager::intelligence_at_revision has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (26 pts), match/switch 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 · ExecCell · ×2
  • ExecCell::render_with_locale (cognitive 30) crates/tui/src/tui/history.rs:1079 — ExecCell::render_with_locale has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 11 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • ExecCell::render_calm (cognitive 20) crates/tui/src/tui/history.rs:1237 — ExecCell::render_calm has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HelpView · ×2
  • HelpView::render (cognitive 30) crates/tui/src/tui/views/help.rs:1143 — HelpView::render has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (25 pts), match/switch 1 (3 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.
  • HelpView::handle_key (cognitive 17) crates/tui/src/tui/views/help.rs:1048 — HelpView::handle_key has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 2 (4 pts), boolean chains 3 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · WebSearchTool · ×2
  • WebSearchTool::run_volcengine_search (cognitive 29) crates/tui/src/tools/web_search.rs:1548 — WebSearchTool::run_volcengine_search has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (20 pts), match/switch 2 (6 pts), boolean chains 2, 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.
  • WebSearchTool::run_firecrawl_search_at_for_context (cognitive 16) crates/tui/src/tools/web_search.rs:713 — WebSearchTool::run_firecrawl_search_at_for_context has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (14 pts), match/switch 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 · SubAgentWorkflowDriver · ×2
  • SubAgentWorkflowDriver::spawn_task_admitted (cognitive 28) crates/tui/src/tools/workflow/mod.rs:4707 — SubAgentWorkflowDriver::spawn_task_admitted has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 5 (7 pts), loops 2, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SubAgentWorkflowDriver::evaluate_gates_for_completed_role (cognitive 24) crates/tui/src/tools/workflow/mod.rs:4263 — SubAgentWorkflowDriver::evaluate_gates_for_completed_role has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 2 (7 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 · RuntimeBridge · ×2
  • RuntimeBridge::stream_turn_events (cognitive 27) crates/app-server/src/lib.rs:2650 — RuntimeBridge::stream_turn_events has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (20 pts), loops 2 (3 pts), match/switch 1 (3 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.
  • RuntimeBridge::message_thread (cognitive 18) crates/app-server/src/lib.rs:2455 — RuntimeBridge::message_thread has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (17 pts), match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ExactFleet · ×2
  • ExactFleet::from_toml (cognitive 26) crates/workflow/src/fleet_exact.rs:573 — ExactFleet::from_toml has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 5 (12 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.
  • ExactFleet::validate (cognitive 19) crates/workflow/src/fleet_exact.rs:499 — ExactFleet::validate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (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 · startBrowserClient · ×2
  • startBrowserClient::renderUserInput (cognitive 24) crates/tui/src/runtime_web/app.mjs:1815 — startBrowserClient::renderUserInput has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 3 (7 pts), boolean chains 6, loops 3 (6 pts), if/else 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.
  • startBrowserClient::updateItemNode (cognitive 19) crates/tui/src/runtime_web/app.mjs:1605 — startBrowserClient::updateItemNode has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 6 (7 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TextField · ×2
  • TextField::key (cognitive 21) crates/tui/src/tui/views/automations/editor.rs:165 — TextField::key has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (19 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.
  • TextField::render (cognitive 21) crates/tui/src/tui/views/automations/editor.rs:268 — TextField::render has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 5, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OfferingPricing · ×2
  • OfferingPricing::quote_cost (cognitive 20) crates/config/src/pricing.rs:667 — OfferingPricing::quote_cost has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 4 (8 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.
  • OfferingPricing::rates_and_usage (cognitive 16) crates/config/src/pricing.rs:572 — OfferingPricing::rates_and_usage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 5, 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 · (anonymous) (cognitive 19) · ×2
  • (anonymous) (cognitive 19) pet/ios/Resources/pet-native.js:632 — (anonymous) has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 6, loops 1, ternaries 1 (nesting depth added 1). None of this is in the body itself: all 19 points belong to 8 function items inside it that branch (eventMatches, errorOnsetOf, stableHash, …). 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.
  • (anonymous) (cognitive 19) crates/tui/src/tui/pet_watch/pet-native.js:632 — (anonymous) has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 6, loops 1, ternaries 1 (nesting depth added 1). None of this is in the body itself: all 19 points belong to 8 function items inside it that branch (eventMatches, errorOnsetOf, stableHash, …). 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 · OwnerRegistry · ×2
  • OwnerRegistry::register_command (cognitive 16) crates/tui/src/extension_host/registry.rs:1125 — OwnerRegistry::register_command has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14 (15 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.
  • OwnerRegistry::unregister (cognitive 16) crates/tui/src/extension_host/registry.rs:1372 — OwnerRegistry::unregister has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D35 · Change Coupling · Change-coupling hub · ×2
  • Change-coupling hub: provider_defaults.rs → REDACTED, provider.rs, provider_kind.rs, REDACTED, client.rs, config.rs, config_persistence.rs crates/config/src/provider_defaults.rs — `crates/config/src/provider_defaults.rs` changes together with 7 other files — `crates/agent/src/lib.rs`, `crates/config/src/provider.rs`, `crates/config/src/provider_kind.rs`, `REDACTED`, `crates/tui/src/client.rs`, `crates/tui/src/config.rs`, `crates/tui/src/config_persistence.rs` — none of which declares a dependency on it: one file is the hub of 7 separate couplings, not 7 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 7.
  • Change-coupling hub: REDACTED → authority.rs, dispatch.rs, handle.rs, REDACTED, tool_catalog.rs, tool_execution.rs, ops.rs, repo_law.rs, tool_inspection.rs crates/tui/src/core/engine/tests.rs — `crates/tui/src/core/engine/tests.rs` changes together with 9 other files — `crates/tui/src/core/authority.rs`, `crates/tui/src/core/engine/dispatch.rs`, `crates/tui/src/core/engine/handle.rs`, `crates/tui/src/core/engine/preview/tests.rs`, `crates/tui/src/core/engine/tool_catalog.rs`, `crates/tui/src/core/engine/tool_execution.rs`, `crates/tui/src/core/ops.rs`, `crates/tui/src/repo_law.rs`, `crates/tui/src/tool_inspection.rs` — none of which declares a dependency on it: one file is the hub of 9 separate couplings, not 9 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 9.
D36 · Supply-chain Provenance & Signing · REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Near-duplicate member pair (57 shared lines) · ×2
  • Near-duplicate member pair (57 shared lines) crates/tui/src/plugins/marketplace/parsers/claude.rs:205 — crates/tui/src/plugins/marketplace/parsers/claude.rs:205-362 | crates/tui/src/plugins/marketplace/parsers/kimi.rs:115-257 — These two members are variants of one another: 57 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (57 shared lines) crates/tui/src/fleet/control.rs:93 — crates/tui/src/fleet/control.rs:93-153 | crates/tui/src/runtime_api.rs:5046-5116 — These two members are variants of one another: 57 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (38 shared lines) · ×2
  • Near-duplicate member pair (38 shared lines) crates/tui/src/tools/subagent/coord.rs:772 — crates/tui/src/tools/subagent/coord.rs:772-893 | crates/tui/src/tools/subagent/mod.rs:12417-12529 — These two members are variants of one another: 38 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (38 shared lines) crates/tui/src/runtime_api.rs:9351 — crates/tui/src/runtime_api.rs:9351-9391 | crates/tui/src/runtime_api.rs:9398-9440 — These two members are variants of one another: 38 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (5 members, 50+ identical tokens) crates/cloud-facts/src/lib.rs:309 — crates/cloud-facts/src/lib.rs:309-366 | crates/tui/src/plugins/registry.rs:1157-1179 | crates/tui/src/provider_catalog_live.rs:781-900 | crates/tui/src/runtime_api/diagnostics.rs:177-192 | crates/tui/src/session_manager.rs:219-236 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) crates/commands/src/debug/change.rs:173 — crates/commands/src/debug/change.rs:173-209 | crates/commands/src/debug/change.rs:215-247 | crates/commands/src/debug/change.rs:255-278 | crates/commands/src/debug/change.rs:340-358 | crates/commands/src/debug/change.rs:360-384 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Duplicated block (30 lines × 2) · ×2
  • Duplicated block (30 lines × 2) crates/config/src/lib.rs:4920 — crates/config/src/lib.rs:4920-4949 | crates/tui/src/config.rs:9214-9243 — before extracting anything, compare `crates/config/src/lib.rs` and `crates/tui/src/config.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 171 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 (30 lines × 2) crates/tui/src/tui/widgets/mod.rs:2807 — crates/tui/src/tui/widgets/mod.rs:2807-2836 | crates/tui/src/tui/widgets/transcript_legacy.rs:1067-1096 — before extracting anything, compare `crates/tui/src/tui/widgets/mod.rs` and `crates/tui/src/tui/widgets/transcript_legacy.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 778 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (23–26 lines × 2) · ×2
  • Duplicated block (23–26 lines × 2) crates/tui/src/commands/config_main_host.rs:1117 — crates/tui/src/commands/config_main_host.rs:1117-1142 | crates/tui/src/commands/config_main_host.rs:2268-2290 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (23–26 lines × 2) crates/tui/src/tui/widgets/mod.rs:3334 — crates/tui/src/tui/widgets/mod.rs:3334-3356 | crates/tui/src/tui/widgets/mod.rs:3381-3406 — both copies are in the same file, so extract the 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 (21–23 lines × 2) · ×2
  • Duplicated block (21–23 lines × 2) crates/config/src/lib.rs:4206 — crates/config/src/lib.rs:4206-4226 | crates/tui/src/config.rs:9008-9030 — before extracting anything, compare `crates/config/src/lib.rs` and `crates/tui/src/config.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 171 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 (21–23 lines × 2) crates/tui/src/tui/ui/event_loop.rs:5450 — crates/tui/src/tui/ui/event_loop.rs:5450-5470 | crates/tui/src/tui/ui/event_loop.rs:6127-6149 — both copies are in the same file, so extract the 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 lines × 2) · ×2
  • Duplicated block (23 lines × 2) crates/tui/src/tui/widgets/approval_band_legacy.rs:1310 — crates/tui/src/tui/widgets/approval_band_legacy.rs:1310-1332 | crates/tui/src/tui/widgets/mod.rs:2439-2461 — before extracting anything, compare `crates/tui/src/tui/widgets/approval_band_legacy.rs` and `crates/tui/src/tui/widgets/mod.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (23 lines × 2) crates/tui/src/tui/widgets/mod.rs:141 — crates/tui/src/tui/widgets/mod.rs:141-163 | crates/tui/src/tui/widgets/transcript_legacy.rs:104-126 — before extracting anything, compare `crates/tui/src/tui/widgets/mod.rs` and `crates/tui/src/tui/widgets/transcript_legacy.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 778 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (20–21 lines × 2) · ×2
  • Duplicated block (20–21 lines × 2) crates/core/src/fragments.rs:529 — crates/core/src/fragments.rs:529-548 | crates/runtime/src/model_context/fragment.rs:219-239 — before extracting anything, compare `crates/core/src/fragments.rs` and `crates/runtime/src/model_context/fragment.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 68 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (20–21 lines × 2) crates/tui/src/commands/config_main_host.rs:966 — crates/tui/src/commands/config_main_host.rs:966-986 | crates/tui/src/commands/config_main_host.rs:1025-1044 — both copies are in the same file, so extract the 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 (19 lines × 2) · ×2
  • Duplicated block (19 lines × 2) crates/tui/src/remote_control.rs:1458 — crates/tui/src/remote_control.rs:1458-1476 | crates/tui/src/remote_control.rs:1494-1512 — both copies are in the same file, so extract the 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 (19 lines × 2) crates/tui/src/tui/diff_render.rs:144 — crates/tui/src/tui/diff_render.rs:144-162 | crates/tui/src/tui/diff_render.rs:176-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.
D4 · Code Duplication · Duplicated block (16–18 lines × 2) · ×2
  • Duplicated block (16–18 lines × 2) crates/tui/src/plugins/install/tarball.rs:187 — crates/tui/src/plugins/install/tarball.rs:187-202 | crates/tui/src/skills/install.rs:1570-1587 — before extracting anything, compare `crates/tui/src/plugins/install/tarball.rs` and `crates/tui/src/skills/install.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (16–18 lines × 2) crates/tui/src/runtime_handoff.rs:1053 — crates/tui/src/runtime_handoff.rs:1053-1068 | crates/tui/src/runtime_handoff.rs:1372-1389 — both copies are in the same file, so extract the 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 (17 lines × 3) · ×2
  • Duplicated block (17 lines × 3) crates/config/src/lib.rs:7338 — crates/config/src/lib.rs:7338-7354 | crates/tui/src/runtime_threads.rs:20750-20766 | crates/tui/src/tools/subagent/mod.rs:10920-10936 — 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 (17 lines × 3) crates/tui/src/client/test_cases_01.rs:949 — crates/tui/src/client/test_cases_01.rs:949-965 | crates/tui/src/client/test_cases_01.rs:1484-1500 | crates/tui/src/client/test_cases_01.rs:1540-1556 — 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 (11–15 lines × 2) · ×2
  • Duplicated block (11–15 lines × 2) crates/tui/src/fleet/worker_runtime.rs:696 — crates/tui/src/fleet/worker_runtime.rs:696-710 | crates/tui/src/fleet/worker_runtime.rs:809-819 — both copies are in the same file, so extract the 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–15 lines × 2) crates/tui/src/hooks/executor.rs:2104 — crates/tui/src/hooks/executor.rs:2104-2118 | crates/tui/src/hooks/executor.rs:2167-2177 — both copies are in the same file, so extract the 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–14 lines × 3) · ×2
  • Duplicated block (13–14 lines × 3) crates/config/src/config_document.rs:340 — crates/config/src/config_document.rs:340-352 | crates/tui/src/runtime_chat_relay.rs:1615-1627 | crates/tui/src/settings.rs:2311-2324 — 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 (13–14 lines × 3) crates/config/src/windows_identity.rs:42 — crates/config/src/windows_identity.rs:42-54 | crates/runtime/src/external_credentials.rs:544-557 | crates/tui/src/tools/github/report.rs:1322-1334 — before extracting anything, compare `crates/config/src/windows_identity.rs` and `crates/tui/src/tools/github/report.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (12 lines × 4) · ×2
  • Duplicated block (12 lines × 4) crates/tui/src/runtime_threads.rs:17989 — crates/tui/src/runtime_threads.rs:17989-18000 | crates/tui/src/runtime_threads.rs:18067-18078 | crates/tui/src/runtime_threads.rs:18178-18189 | crates/tui/src/runtime_threads.rs:18550-18561 — 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 (12 lines × 4) crates/core/src/fragments.rs:35 — crates/core/src/fragments.rs:35-46 | crates/core/src/fragments.rs:102-113 | crates/runtime/src/model_context/fragment.rs:34-45 | crates/runtime/src/model_context/fragment.rs:114-125 — before extracting anything, compare `crates/core/src/fragments.rs` and `crates/runtime/src/model_context/fragment.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 68 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (11 lines × 5) · ×2
  • Duplicated block (11 lines × 5) crates/tui/src/runtime_threads.rs:18664 — crates/tui/src/runtime_threads.rs:18664-18674 | crates/tui/src/runtime_threads.rs:19329-19339 | crates/tui/src/runtime_threads.rs:19371-19381 | crates/tui/src/runtime_threads.rs:19400-19410 | crates/tui/src/runtime_threads.rs:19683-19693 — 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.
  • Duplicated block (11 lines × 5) crates/tui/src/tools/web_search.rs:929 — crates/tui/src/tools/web_search.rs:929-939 | crates/tui/src/tools/web_search.rs:1013-1023 | crates/tui/src/tools/web_search.rs:1252-1262 | crates/tui/src/tools/web_search.rs:1351-1361 | crates/tui/src/tools/web_search.rs:1457-1467 — 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.
D4 · Code Duplication · Duplicated block (6–8 lines × 2) · ×2
  • Duplicated block (6–8 lines × 2) crates/tui/src/commands/groups/project/init.rs:317 — crates/tui/src/commands/groups/project/init.rs:317-322 | crates/tui/src/commands/groups/project/init.rs:331-338 — both copies are in the same file, so extract the 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–8 lines × 2) crates/tui/src/tui/hotbar/actions.rs:1045 — crates/tui/src/tui/hotbar/actions.rs:1045-1052 | crates/tui/src/tui/ui/apply.rs:157-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.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×2
  • Duplicated block (5 lines × 4) crates/tui/src/tui/feedback_picker.rs:143 — crates/tui/src/tui/feedback_picker.rs:143-148 | crates/tui/src/tui/live_transcript.rs:654-658 | crates/tui/src/tui/views/mode_picker.rs:150-155 | crates/tui/src/tui/views/router_setup.rs:705-709 — before extracting anything, compare `crates/tui/src/tui/feedback_picker.rs` and `crates/tui/src/tui/views/mode_picker.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 4) crates/tui/src/commands/groups/project/init.rs:247 — crates/tui/src/commands/groups/project/init.rs:247-251 | crates/tui/src/commands/groups/project/init.rs:256-260 | crates/tui/src/commands/groups/project/init.rs:269-276 | crates/tui/src/commands/groups/project/init.rs:309-313 — 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 (5 lines × 5) · ×2
  • Duplicated block (5 lines × 5) crates/tui/src/automation_manager.rs:3127 — crates/tui/src/automation_manager.rs:3127-3131 | crates/tui/src/runtime_api/auth.rs:54-58 | crates/tui/src/tools/plan.rs:347-351 | crates/tui/src/tools/review.rs:2128-2132 | crates/tui/src/tools/verify.rs:831-835 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times.
  • Duplicated block (5 lines × 5) crates/tui/src/commands/groups/project/init.rs:247 — crates/tui/src/commands/groups/project/init.rs:247-251 | crates/tui/src/commands/groups/project/init.rs:256-260 | crates/tui/src/commands/groups/project/init.rs:269-276 | crates/tui/src/commands/groups/project/init.rs:281-285 | crates/tui/src/commands/groups/project/init.rs:309-313 — 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.
D4 · Code Duplication · Duplicated block (7 lines × 5) · ×2
  • Duplicated block (7 lines × 5) crates/tui/src/commands/groups/session/relay.rs:46 — crates/tui/src/commands/groups/session/relay.rs:46-52 | crates/tui/src/commands/groups/session/remote_control.rs:47-53 | crates/tui/src/commands/groups/session/rename.rs:39-45 | crates/tui/src/commands/groups/session/resume.rs:39-45 | crates/tui/src/commands/groups/session/title.rs:40-46 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once.
  • Duplicated block (7 lines × 5) crates/tui/src/config.rs:8432 — crates/tui/src/config.rs:8432-8438 | crates/tui/src/config.rs:8451-8457 | crates/tui/src/config.rs:8480-8488 | crates/tui/src/config.rs:8509-8515 | crates/tui/src/config.rs:8528-8534 — 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.
R10 · Code Duplication · Duplicated block (50 lines × 2 locations) · ×2
  • Duplicated block (50 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:1256 — crates/tui/src/tui/pet_watch/pet-native.js:1256 · pet/ios/Resources/pet-native.js:1256 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
  • Duplicated block (50 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:1587 — crates/tui/src/tui/pet_watch/pet-native.js:1587 · pet/ios/Resources/pet-native.js:1587 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
R10 · Code Duplication · Duplicated block (38 lines × 2 locations) · ×2
  • Duplicated block (38 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:2315 — crates/tui/src/tui/pet_watch/pet-native.js:2315 · pet/ios/Resources/pet-native.js:2315 — the 2 copies are spread across 2 files, 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 (38 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:5114 — crates/tui/src/tui/pet_watch/pet-native.js:5114 · pet/ios/Resources/pet-native.js:5114 — 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 (31 lines × 2 locations) · ×2
  • Duplicated block (31 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:36 — crates/tui/src/tui/pet_watch/pet-native.js:36 · pet/ios/Resources/pet-native.js:36 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
  • Duplicated block (31 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:71 — crates/tui/src/tui/pet_watch/pet-native.js:71 · pet/ios/Resources/pet-native.js:71 — 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 (27 lines × 2 locations) · ×2
  • Duplicated block (27 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:1062 — crates/tui/src/tui/pet_watch/pet-native.js:1062 · pet/ios/Resources/pet-native.js:1062 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
  • Duplicated block (27 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:1652 — crates/tui/src/tui/pet_watch/pet-native.js:1652 · pet/ios/Resources/pet-native.js:1652 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (24 lines × 2 locations) · ×2
  • Duplicated block (24 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:601 — crates/tui/src/tui/pet_watch/pet-native.js:601 · pet/ios/Resources/pet-native.js:601 — 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 (24 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:797 — crates/tui/src/tui/pet_watch/pet-native.js:797 · pet/ios/Resources/pet-native.js:797 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
AC1 · Text alternatives · <canvas> without a text alternative · ×1
  • <canvas> without a text alternative pet/port.html:9 — A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
AC3 · Page structure · Heading level jumps from h2 to h4 · ×1
  • Heading level jumps from h2 to h4 web/components/ratatui/explorer.tsx:235 — Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
AC7 · A11y enforcement · Accessibility enforcement below the top rung · ×1
  • Accessibility enforcement below the top rung — 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 105 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 · linux.create (cyclomatic 326) · ×1
  • linux.create (cyclomatic 326) crates/tui/plugins/computer-use/src/backends/linux.mjs:85 — linux.create has cyclomatic complexity 326 (threshold 15). Most of this is not in the body itself: 1 of the 326 points is its own statement and the rest belongs to 79 function items inside it that branch (a function literal at line 561, a function literal at line 1071, a function literal at line 1160, …). 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 · callTool (cyclomatic 284) · ×1
  • callTool (cyclomatic 284) crates/tui/plugins/computer-use/mcp/server.mjs:1011 — callTool has cyclomatic complexity 284 (threshold 15). Of this number, 258 points are the body's own statements and 26 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 · evidence.analyzeEvidence (cyclomatic 113) · ×1
  • evidence.analyzeEvidence (cyclomatic 113) pet/src/core/evidence.ts:153 — evidence.analyzeEvidence has cyclomatic complexity 113 (threshold 15). Of this number, 97 points are the body's own statements and 16 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 · scene.createOcean (cyclomatic 99) · ×1
  • scene.createOcean (cyclomatic 99) crates/tui/src/integrations/dsh/scene.js:17 — scene.createOcean has cyclomatic complexity 99 (threshold 15). Most of this is not in the body itself: 3 of the 99 points are its own statements and the rest belongs to 27 function items inside it that branch (a function literal at line 152, a function literal at line 173, buildColors, …). 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 · route.POST (cyclomatic 99) · ×1
  • route.POST (cyclomatic 99) web/app/api/admin/post/route.ts:87 — route.POST has cyclomatic complexity 99 (threshold 15). Of this number, 85 points are the body's own statements and 14 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · browser-cdp.createBrowser (cyclomatic 94) · ×1
  • browser-cdp.createBrowser (cyclomatic 94) crates/tui/plugins/computer-use/src/browser-cdp.mjs:312 — browser-cdp.createBrowser has cyclomatic complexity 94 (threshold 15). Of this number, 66 points are the body's own statements and 28 belong to 10 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 · win32.create (cyclomatic 88) · ×1
  • win32.create (cyclomatic 88) crates/tui/plugins/computer-use/src/backends/win32.mjs:152 — win32.create has cyclomatic complexity 88 (threshold 15). Most of this is not in the body itself: 4 of the 88 points are its own statements and the rest belongs to 22 function items inside it that branch (a function literal at line 409, a function literal at line 353, a function literal at line 333, …). 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 · install.httpRequest (cyclomatic 79) · ×1
  • install.httpRequest (cyclomatic 79) REDACTED:535 — install.httpRequest has cyclomatic complexity 79 (threshold 15). Most of this is not in the body itself: 7 of the 79 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 547, 592, 668, …). 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 · resolveTool (cyclomatic 76) · ×1
  • resolveTool (cyclomatic 76) crates/tui/plugins/computer-use/src/tools.mjs:783 — resolveTool has cyclomatic complexity 76 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · facts-publish.validateSource (cyclomatic 73) · ×1
  • facts-publish.validateSource (cyclomatic 73) web/scripts/facts-publish.mjs:168 — facts-publish.validateSource has cyclomatic complexity 73 (threshold 15). Of this number, 35 points are the body's own statements and 38 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 · pet-telemetry.compilePetTelemetry (cyclomatic 66) · ×1
  • pet-telemetry.compilePetTelemetry (cyclomatic 66) pet/src/core/pet-telemetry.ts:70 — pet-telemetry.compilePetTelemetry has cyclomatic complexity 66 (threshold 15). Of this number, 60 points are the body's own statements and 6 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 · app.applyRuntimeEvent (cyclomatic 65) · ×1
  • app.applyRuntimeEvent (cyclomatic 65) crates/tui/src/runtime_web/app.mjs:94 — app.applyRuntimeEvent has cyclomatic complexity 65 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SetupWizardView · ×1
  • SetupWizardView::handle_key (cyclomatic 62) crates/tui/src/tui/setup/mod.rs:3063 — SetupWizardView::handle_key has cyclomatic complexity 62 (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 · review-eval.buildCorpus (cyclomatic 62) · ×1
  • review-eval.buildCorpus (cyclomatic 62) scripts/review-eval.mjs:255 — review-eval.buildCorpus has cyclomatic complexity 62 (threshold 15). Of this number, 61 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 · explorer.RatatuiExplorer (cyclomatic 61) · ×1
  • explorer.RatatuiExplorer (cyclomatic 61) web/components/ratatui/explorer.tsx:110 — explorer.RatatuiExplorer has cyclomatic complexity 61 (threshold 15). Of this number, 35 points are the body's own statements and 26 belong to 17 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Carver.run (cyclomatic 60) · ×1
  • Carver.run (cyclomatic 60) scripts/split/carve.py:155 — Carver.run 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 · CodewhaleRuntimeTrace.append (cyclomatic 60) · ×1
  • CodewhaleRuntimeTrace.append (cyclomatic 60) pet/src/core/codewhale.ts:365 — CodewhaleRuntimeTrace.append has cyclomatic complexity 60 (threshold 15). Of this number, 58 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 · ShellBinding · ×1
  • ShellBinding::matches (cyclomatic 59) crates/tui/src/tui/shell_key_routing.rs:168 — ShellBinding::matches has cyclomatic complexity 59 (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 · reexports.run (cyclomatic 59) · ×1
  • reexports.run (cyclomatic 59) scripts/split/reexports.py:60 — reexports.run 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 · merch-storefront.MerchCheckout (cyclomatic 54) · ×1
  • merch-storefront.MerchCheckout (cyclomatic 54) web/components/merch-storefront.tsx:21 — merch-storefront.MerchCheckout has cyclomatic complexity 54 (threshold 15). Of this number, 16 points are the body's own statements and 38 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 · parseProviderDescriptors (cyclomatic 53) · ×1
  • parseProviderDescriptors (cyclomatic 53) web/lib/provider-descriptors.mjs:2 — parseProviderDescriptors has cyclomatic complexity 53 (threshold 15). Of this number, 52 points are the body's own statements and 1 belongs to 6 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 · check-command-migration-manifest.parse_rust_file (cyclomatic 52) · ×1
  • check-command-migration-manifest.parse_rust_file (cyclomatic 52) scripts/check-command-migration-manifest.py:792 — check-command-migration-manifest.parse_rust_file 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 · lib.validateBridgeConfig (cyclomatic 49) · ×1
  • lib.validateBridgeConfig (cyclomatic 49) REDACTED:437 — lib.validateBridgeConfig has cyclomatic complexity 49 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · index.streamTurnEvents (cyclomatic 48) · ×1
  • index.streamTurnEvents (cyclomatic 48) integrations/telegram-bridge/src/index.mjs:594 — index.streamTurnEvents has cyclomatic complexity 48 (threshold 15). Of this number, 41 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · lib.validateBridgeConfig (cyclomatic 46) · ×1
  • lib.validateBridgeConfig (cyclomatic 46) integrations/feishu-bridge/src/lib.mjs:94 — lib.validateBridgeConfig has cyclomatic complexity 46 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · codewhale.fromCodewhaleSession (cyclomatic 46) · ×1
  • codewhale.fromCodewhaleSession (cyclomatic 46) pet/src/core/codewhale.ts:130 — codewhale.fromCodewhaleSession has cyclomatic complexity 46 (threshold 15). Of this number, 41 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 · parseModelCatalog (cyclomatic 46) · ×1
  • parseModelCatalog (cyclomatic 46) web/lib/model-catalog.mjs:3 — parseModelCatalog has cyclomatic complexity 46 (threshold 15). Of this number, 30 points are the body's own statements and 16 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 · pet-runtime.followRuntime (cyclomatic 45) · ×1
  • pet-runtime.followRuntime (cyclomatic 45) pet/scripts/lib/pet-runtime.mjs:15 — pet-runtime.followRuntime has cyclomatic complexity 45 (threshold 15). Most of this is not in the body itself: 13 of the 45 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 32, 43). 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 · batchSteps (cyclomatic 45) · ×1
  • batchSteps (cyclomatic 45) crates/tui/plugins/computer-use/mcp/server.mjs:544 — batchSteps has cyclomatic complexity 45 (threshold 15). Most of this is not in the body itself: 4 of the 45 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 548, 550, 565, …). 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 · handle (cyclomatic 44) · ×1
  • handle (cyclomatic 44) REDACTED:191 — handle has cyclomatic complexity 44 (threshold 15). Of this number, 24 points are the body's own statements and 20 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 · MfjsValidationState · ×1
  • MfjsValidationState::validate_schema (cyclomatic 43) crates/tui/src/tools/schema_sanitize.rs:1452 — MfjsValidationState::validate_schema 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 · ReviewedCatalog · ×1
  • ReviewedCatalog::validate (cyclomatic 42) crates/config/src/catalog/reviewed.rs:200 — ReviewedCatalog::validate has cyclomatic complexity 42 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · compiled-hosts.parseCatalog (cyclomatic 42) · ×1
  • compiled-hosts.parseCatalog (cyclomatic 42) npm/codewhale/scripts/compiled-hosts.js:38 — compiled-hosts.parseCatalog 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 · ingest.importTrace (cyclomatic 42) · ×1
  • ingest.importTrace (cyclomatic 42) pet/src/core/ingest.ts:218 — ingest.importTrace has cyclomatic complexity 42 (threshold 15). Of this number, 24 points are the body's own statements and 18 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · server.validateToolArgs (cyclomatic 41) · ×1
  • server.validateToolArgs (cyclomatic 41) crates/tui/plugins/computer-use/mcp/server.mjs:1586 — server.validateToolArgs 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 · cloud-facts.verifyEnvelope (cyclomatic 41) · ×1
  • cloud-facts.verifyEnvelope (cyclomatic 41) web/lib/cloud-facts.ts:187 — cloud-facts.verifyEnvelope 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 · dot-field.projectDotField (cyclomatic 40) · ×1
  • dot-field.projectDotField (cyclomatic 40) pet/src/core/dot-field.ts:53 — dot-field.projectDotField 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 · ModelInventory · ×1
  • ModelInventory::from_config_scoped (cyclomatic 39) crates/tui/src/model_inventory.rs:223 — ModelInventory::from_config_scoped 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 · HotbarSetupView · ×1
  • HotbarSetupView::handle_key (cyclomatic 39) crates/tui/src/tui/hotbar/setup.rs:788 — HotbarSetupView::handle_key has cyclomatic complexity 39 (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 · updates.validateReleaseZip (cyclomatic 39) · ×1
  • updates.validateReleaseZip (cyclomatic 39) crates/tui/plugins/computer-use/app/updates.mjs:46 — updates.validateReleaseZip has cyclomatic complexity 39 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · facts-publish.verifyEnvelope (cyclomatic 39) · ×1
  • facts-publish.verifyEnvelope (cyclomatic 39) web/scripts/facts-publish.mjs:102 — facts-publish.verifyEnvelope has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · runActions (cyclomatic 39) · ×1
  • runActions (cyclomatic 39) crates/tui/plugins/computer-use/mcp/server.mjs:582 — runActions has cyclomatic complexity 39 (threshold 15). Of this number, 37 points are the body's own statements and 2 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 · waitFor (cyclomatic 38) · ×1
  • waitFor (cyclomatic 38) crates/tui/plugins/computer-use/mcp/server.mjs:656 — waitFor has cyclomatic complexity 38 (threshold 15). Of this number, 34 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · consentCheck (cyclomatic 38) · ×1
  • consentCheck (cyclomatic 38) crates/tui/plugins/computer-use/mcp/server.mjs:793 — consentCheck 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 · check-persistence-backlog-budget.validate_receipt (cyclomatic 37) · ×1
  • check-persistence-backlog-budget.validate_receipt (cyclomatic 37) scripts/check-persistence-backlog-budget.py:158 — check-persistence-backlog-budget.validate_receipt has cyclomatic complexity 37 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Renderer · ×1
  • Renderer::render (cyclomatic 36) crates/tui/src/tui/pet_watch/graphics.rs:27 — Renderer::render 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 · background-check.runBackgroundCheck (cyclomatic 36) · ×1
  • background-check.runBackgroundCheck (cyclomatic 36) crates/tui/plugins/computer-use/app/background-check.mjs:10 — background-check.runBackgroundCheck has cyclomatic complexity 36 (threshold 15). Of this number, 24 points are the body's own statements and 12 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 · runtime_mobile.html.eventText (cyclomatic 36) · ×1
  • runtime_mobile.html.eventText (cyclomatic 36) crates/tui/src/runtime_mobile.html:570 — runtime_mobile.html.eventText has cyclomatic complexity 36 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · index.flushOutputs (cyclomatic 36) · ×1
  • index.flushOutputs (cyclomatic 36) integrations/weixin-bridge/src/index.mjs:636 — index.flushOutputs has cyclomatic complexity 36 (threshold 15). Of this number, 19 points are the body's own statements and 17 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 · schema.validateBatch (cyclomatic 36) · ×1
  • schema.validateBatch (cyclomatic 36) REDACTED:545 — schema.validateBatch 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 · whale-live.WhaleLive (cyclomatic 36) · ×1
  • whale-live.WhaleLive (cyclomatic 36) web/components/whale-live.tsx:38 — whale-live.WhaleLive has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 3 of the 36 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 65, 91, 103, …). 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 · activatedControl (cyclomatic 36) · ×1
  • activatedControl (cyclomatic 36) crates/tui/plugins/computer-use/mcp/server.mjs:928 — activatedControl has cyclomatic complexity 36 (threshold 15). Of this number, 34 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 · Broker · ×1
  • Broker::authorize_frame (cyclomatic 35) crates/tui/src/extension_host/mcp.rs:438 — Broker::authorize_frame 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 · check-command-migration-manifest.validate_type_node (cyclomatic 35) · ×1
  • check-command-migration-manifest.validate_type_node (cyclomatic 35) scripts/check-command-migration-manifest.py:171 — check-command-migration-manifest.validate_type_node 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 · PetHost.restart (cyclomatic 35) · ×1
  • PetHost.restart (cyclomatic 35) pet/swift/PetHost.swift:76 — PetHost.restart 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 · runtime_mobile.html.noteTurnUsage (cyclomatic 35) · ×1
  • runtime_mobile.html.noteTurnUsage (cyclomatic 35) crates/tui/src/runtime_mobile.html:609 — runtime_mobile.html.noteTurnUsage has cyclomatic complexity 35 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ChatView.handleStreamEvent (cyclomatic 35) · ×1
  • ChatView.handleStreamEvent (cyclomatic 35) extensions/vscode/src/chat.ts:488 — ChatView.handleStreamEvent has cyclomatic complexity 35 (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 · serve (cyclomatic 35) · ×1
  • serve (cyclomatic 35) crates/tui/plugins/computer-use/app/daemon.mjs:136 — serve has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 1 of the 35 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 157, 141, 150, …). 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 · normalizeTarget (cyclomatic 35) · ×1
  • normalizeTarget (cyclomatic 35) crates/tui/plugins/computer-use/mcp/server.mjs:312 — normalizeTarget 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 · create.recordingStart (cyclomatic 35) · ×1
  • create.recordingStart (cyclomatic 35) crates/tui/plugins/computer-use/src/backends/darwin.mjs:574 — create.recordingStart has cyclomatic complexity 35 (threshold 15). Of this number, 25 points are the body's own statements and 10 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 · ExecPolicyEngine · ×1
  • ExecPolicyEngine::check (cyclomatic 34) crates/execpolicy/src/lib.rs:508 — ExecPolicyEngine::check 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 · Connection · ×1
  • Connection::project (cyclomatic 34) crates/tui/src/tui/pet_watch/runtime.rs:185 — Connection::project has cyclomatic complexity 34 (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 · TranscriptViewCache · ×1
  • TranscriptViewCache::ensure_iter (cyclomatic 34) crates/tui/src/tui/transcript.rs:318 — TranscriptViewCache::ensure_iter 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 · Mover.plan_cfg (cyclomatic 34) · ×1
  • Mover.plan_cfg (cyclomatic 34) scripts/split/move-modules.py:433 — Mover.plan_cfg 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 · splitlib.apply_changes (cyclomatic 34) · ×1
  • splitlib.apply_changes (cyclomatic 34) scripts/split/splitlib.py:286 — splitlib.apply_changes 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 · index.streamTurnEvents (cyclomatic 34) · ×1
  • index.streamTurnEvents (cyclomatic 34) integrations/wecom-bridge/src/index.mjs:317 — index.streamTurnEvents 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 · fetch-compiled-host-proof.fetchProof (cyclomatic 34) · ×1
  • fetch-compiled-host-proof.fetchProof (cyclomatic 34) scripts/release/fetch-compiled-host-proof.js:9 — fetch-compiled-host-proof.fetchProof has cyclomatic complexity 34 (threshold 15). Of this number, 24 points are the body's own statements and 10 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 · validateSurvivalContract (cyclomatic 34) · ×1
  • validateSurvivalContract (cyclomatic 34) crates/tui/src/compaction/validate_survival_contract.mjs:128 — validateSurvivalContract has cyclomatic complexity 34 (threshold 15). Of this number, 22 points are the body's own statements and 12 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 · observeState (cyclomatic 34) · ×1
  • observeState (cyclomatic 34) crates/tui/plugins/computer-use/mcp/server.mjs:489 — observeState has cyclomatic complexity 34 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · create.screenshot (cyclomatic 34) · ×1
  • create.screenshot (cyclomatic 34) crates/tui/plugins/computer-use/src/backends/darwin.mjs:466 — create.screenshot has cyclomatic complexity 34 (threshold 15). Of this number, 32 points are the body's own statements and 2 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 · CommandContextBundle · ×1
  • CommandContextBundle::contexts (cyclomatic 33) crates/tui/src/commands/contract.rs:4730 — CommandContextBundle::contexts has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: codewhale_tui::commands::contract::key_to_message_id (cyclomatic 109) 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 function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionManager · ×1
  • SessionManager::remove_session (cyclomatic 33) crates/tui/src/session_manager.rs:4094 — SessionManager::remove_session 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 · WebRunTool · ×1
  • WebRunTool::execute (cyclomatic 33) crates/tui/src/tools/web_run.rs:521 — WebRunTool::execute 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 · SessionPickerView · ×1
  • SessionPickerView::handle_key (cyclomatic 33) crates/tui/src/tui/session_picker.rs:945 — SessionPickerView::handle_key has cyclomatic complexity 33 (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 · count_lines.classify_crate (cyclomatic 33) · ×1
  • count_lines.classify_crate (cyclomatic 33) scripts/split/count_lines.py:246 — count_lines.classify_crate 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 · create.native (cyclomatic 33) · ×1
  • create.native (cyclomatic 33) crates/tui/plugins/computer-use/src/backends/darwin.mjs:269 — create.native has cyclomatic complexity 33 (threshold 15). Of this number, 32 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 · facts.isRepoFacts (cyclomatic 32) · ×1
  • facts.isRepoFacts (cyclomatic 32) web/lib/facts.ts:72 — facts.isRepoFacts has cyclomatic complexity 32 (threshold 15). Of this number, 30 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 · createStreamConnector.connectStream (cyclomatic 32) · ×1
  • createStreamConnector.connectStream (cyclomatic 32) crates/tui/src/runtime_web/app.mjs:553 — createStreamConnector.connectStream has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 13 of the 32 points are its own statements and the rest belongs to 10 function items inside it that branch (onerror, a function literal at line 562, onopen, …). 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 · HistoryCell · ×1
  • HistoryCell::lines_with_options_folded (cyclomatic 31) crates/tui/src/tui/history.rs:443 — HistoryCell::lines_with_options_folded has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · catalog_models_dev.normalize_seed_spec (cyclomatic 31) · ×1
  • catalog_models_dev.normalize_seed_spec (cyclomatic 31) scripts/catalog_models_dev.py:594 — catalog_models_dev.normalize_seed_spec 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 · check-blocking-calls-budget.strip_comments_and_strings (cyclomatic 31) · ×1
  • check-blocking-calls-budget.strip_comments_and_strings (cyclomatic 31) scripts/check-blocking-calls-budget.py:68 — check-blocking-calls-budget.strip_comments_and_strings 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 · check-runtime-contract-budget.check_fragment_caps (cyclomatic 31) · ×1
  • check-runtime-contract-budget.check_fragment_caps (cyclomatic 31) scripts/check-runtime-contract-budget.py:462 — check-runtime-contract-budget.check_fragment_caps 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 · darwin.create.native (cyclomatic 31) · ×1
  • darwin.create.native (cyclomatic 31) crates/tui/plugins/computer-use/src/backends/darwin.mjs:269 — darwin.create.native has cyclomatic complexity 31 (threshold 15). Of this number, 30 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 · app.createStreamConnector.connectStream (cyclomatic 31) · ×1
  • app.createStreamConnector.connectStream (cyclomatic 31) crates/tui/src/runtime_web/app.mjs:553 — app.createStreamConnector.connectStream has cyclomatic complexity 31 (threshold 15). Of this number, 16 points are the body's own statements and 15 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 · index.streamTurnEvents (cyclomatic 31) · ×1
  • index.streamTurnEvents (cyclomatic 31) integrations/feishu-bridge/src/index.mjs:332 — index.streamTurnEvents 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 · schema.validateEvent (cyclomatic 31) · ×1
  • schema.validateEvent (cyclomatic 31) REDACTED:440 — schema.validateEvent 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 · product-usage.validateEnvelope (cyclomatic 31) · ×1
  • product-usage.validateEnvelope (cyclomatic 31) web/lib/telemetry/product-usage.ts:119 — product-usage.validateEnvelope 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 · create.openApplication (cyclomatic 31) · ×1
  • create.openApplication (cyclomatic 31) crates/tui/plugins/computer-use/src/backends/darwin.mjs:724 — create.openApplication 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 · check-persistence-backlog-budget.validate_budget (cyclomatic 30) · ×1
  • check-persistence-backlog-budget.validate_budget (cyclomatic 30) scripts/check-persistence-backlog-budget.py:264 — check-persistence-backlog-budget.validate_budget has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · widen.plan_edits (cyclomatic 30) · ×1
  • widen.plan_edits (cyclomatic 30) scripts/split/widen.py:260 — widen.plan_edits 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 · signal.buildPyramid (cyclomatic 30) · ×1
  • signal.buildPyramid (cyclomatic 30) pet/src/core/signal.ts:10 — signal.buildPyramid 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 · merch-interest.MerchInterest (cyclomatic 30) · ×1
  • merch-interest.MerchInterest (cyclomatic 30) web/components/merch-interest.tsx:11 — merch-interest.MerchInterest has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 7 of the 30 points are its own statements and the rest belongs to 7 function items inside it that branch (join, a function literal at line 34, a function literal at line 70, …). 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 · mobile-menu.MobileMenu (cyclomatic 30) · ×1
  • mobile-menu.MobileMenu (cyclomatic 30) web/components/mobile-menu.tsx:11 — mobile-menu.MobileMenu has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 6 of the 30 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 101, a function literal at line 80, a function literal at line 50, …). 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 · model.reviewedRoute (cyclomatic 30) · ×1
  • model.reviewedRoute (cyclomatic 30) web/lib/merch/model.ts:50 — model.reviewedRoute has cyclomatic complexity 30 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ProviderLivePricingQuote · ×1
  • ProviderLivePricingQuote::pricing_for_route (cyclomatic 29) crates/tui/src/provider_catalog_live.rs:400 — ProviderLivePricingQuote::pricing_for_route 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 · RuntimeOptions · ×1
  • RuntimeOptions::merge (cyclomatic 29) crates/tui/src/runtime_options.rs:68 — RuntimeOptions::merge 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 · ReviewTool · ×1
  • ReviewTool::execute (cyclomatic 29) crates/tui/src/tools/review.rs:1500 — ReviewTool::execute has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · check-command-migration-manifest.validate_const_atom (cyclomatic 29) · ×1
  • check-command-migration-manifest.validate_const_atom (cyclomatic 29) scripts/check-command-migration-manifest.py:92 — check-command-migration-manifest.validate_const_atom 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 · darwin.create.recordingStart (cyclomatic 29) · ×1
  • darwin.create.recordingStart (cyclomatic 29) crates/tui/plugins/computer-use/src/backends/darwin.mjs:574 — darwin.create.recordingStart has cyclomatic complexity 29 (threshold 15). Of this number, 19 points are the body's own statements and 10 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 · pet-sim.gaitTarget (cyclomatic 29) · ×1
  • pet-sim.gaitTarget (cyclomatic 29) pet/src/core/pet-sim.ts:160 — pet-sim.gaitTarget 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 · facts-publish.main (cyclomatic 29) · ×1
  • facts-publish.main (cyclomatic 29) web/scripts/facts-publish.mjs:555 — facts-publish.main 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 · check-blocking-calls-budget.file_counts (cyclomatic 28) · ×1
  • check-blocking-calls-budget.file_counts (cyclomatic 28) scripts/check-blocking-calls-budget.py:170 — check-blocking-calls-budget.file_counts 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 · contributor-wall.refresh (cyclomatic 28) · ×1
  • contributor-wall.refresh (cyclomatic 28) scripts/contributor-wall.py:75 — contributor-wall.refresh 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 · darwin.create.open_application (cyclomatic 28) · ×1
  • darwin.create.open_application (cyclomatic 28) crates/tui/plugins/computer-use/src/backends/darwin.mjs:724 — darwin.create.open_application 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 · extension.activate (cyclomatic 28) · ×1
  • extension.activate (cyclomatic 28) extensions/vscode/src/extension.ts:14 — extension.activate has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 3 of the 28 points are its own statements and the rest belongs to 9 function items inside it that branch (checkAndRefreshRuntime, a function literal at line 151, a function literal at line 170, …). 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 · pet-recorder.createPetRecorder (cyclomatic 28) · ×1
  • pet-recorder.createPetRecorder (cyclomatic 28) pet/scripts/lib/pet-recorder.mjs:50 — pet-recorder.createPetRecorder 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 · review.classify (cyclomatic 28) · ×1
  • review.classify (cyclomatic 28) REDACTED:89 — review.classify has cyclomatic complexity 28 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · computer-use-release.releaseAssets (cyclomatic 28) · ×1
  • computer-use-release.releaseAssets (cyclomatic 28) web/lib/computer-use-release.ts:39 — computer-use-release.releaseAssets has cyclomatic complexity 28 (threshold 15). Of this number, 25 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · FleetFile · ×1
  • FleetFile::validate (cyclomatic 27) crates/tui/src/fleet/store.rs:301 — FleetFile::validate 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 · SkillRegistry · ×1
  • SkillRegistry::discover_recursive (cyclomatic 27) crates/tui/src/skills/mod.rs:617 — SkillRegistry::discover_recursive 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 · HelpView · ×1
  • HelpView::handle_key (cyclomatic 27) crates/tui/src/tui/views/help.rs:1048 — HelpView::handle_key has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · testsplit.main (cyclomatic 27) · ×1
  • testsplit.main (cyclomatic 27) scripts/split/testsplit.py:106 — testsplit.main 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 · admin-client.AdminClient (cyclomatic 27) · ×1
  • admin-client.AdminClient (cyclomatic 27) web/app/[locale]/admin/admin-client.tsx:13 — admin-client.AdminClient has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 7 of the 27 points are its own statements and the rest belongs to 4 function items inside it that branch (handleAction, a function literal at line 71, a function literal at line 156, …). 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 · operator.operatorAction (cyclomatic 27) · ×1
  • operator.operatorAction (cyclomatic 27) web/lib/merch/operator.ts:25 — operator.operatorAction 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 · ProviderDashboardRow · ×1
  • ProviderDashboardRow::from_config_with_provider_id (cyclomatic 26) crates/tui/src/tui/provider_picker.rs:557 — ProviderDashboardRow::from_config_with_provider_id has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: ProviderPickerView::render (cyclomatic 28) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · catalog_models_dev.seed_lock_report (cyclomatic 26) · ×1
  • catalog_models_dev.seed_lock_report (cyclomatic 26) scripts/catalog_models_dev.py:768 — catalog_models_dev.seed_lock_report 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 · check-command-migration-manifest.validate_topology_document (cyclomatic 26) · ×1
  • check-command-migration-manifest.validate_topology_document (cyclomatic 26) scripts/check-command-migration-manifest.py:390 — check-command-migration-manifest.validate_topology_document 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 · validate-crate-publish-order.validate_order (cyclomatic 26) · ×1
  • validate-crate-publish-order.validate_order (cyclomatic 26) scripts/release/validate-crate-publish-order.py:81 — validate-crate-publish-order.validate_order 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 · PetSharedHabitat.body (cyclomatic 26) · ×1
  • PetSharedHabitat.body (cyclomatic 26) pet/swift/PetShared.swift:204 — PetSharedHabitat.body 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 · PetSim.swift.gaitTarget (cyclomatic 26) · ×1
  • PetSim.swift.gaitTarget (cyclomatic 26) pet/swift/PetSim.swift:145 — PetSim.swift.gaitTarget 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 · qr.penalty (cyclomatic 26) · ×1
  • qr.penalty (cyclomatic 26) integrations/weixin-bridge/src/qr.mjs:305 — qr.penalty has cyclomatic complexity 26 (threshold 15). Of this number, 18 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · install.withRetry (cyclomatic 26) · ×1
  • install.withRetry (cyclomatic 26) REDACTED:937 — install.withRetry 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 · pet-recorder.createPetRecorder.append (cyclomatic 26) · ×1
  • pet-recorder.createPetRecorder.append (cyclomatic 26) pet/scripts/lib/pet-recorder.mjs:104 — pet-recorder.createPetRecorder.append 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 · ExecAgentEvents · ×1
  • ExecAgentEvents::next (cyclomatic 25) crates/tui/src/exec_agent.rs:113 — ExecAgentEvents::next 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 · HostProcess · ×1
  • HostProcess::spawn (cyclomatic 25) crates/tui/src/extension_host/supervisor.rs:1424 — HostProcess::spawn has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · LiveTranscriptOverlay · ×1
  • LiveTranscriptOverlay::handle_key (cyclomatic 25) crates/tui/src/tui/live_transcript.rs:501 — LiveTranscriptOverlay::handle_key has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · codewhale_workflow_js · ×1
  • codewhale_workflow_js::vm::line_leading_export_default (cyclomatic 25) crates/workflow-js/src/vm.rs:481 — codewhale_workflow_js::vm::line_leading_export_default 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 · check-blocking-calls-budget._cargo_crate_roots (cyclomatic 25) · ×1
  • check-blocking-calls-budget._cargo_crate_roots (cyclomatic 25) scripts/check-blocking-calls-budget.py:331 — check-blocking-calls-budget._cargo_crate_roots 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 · module_graph.lex_mask (cyclomatic 25) · ×1
  • module_graph.lex_mask (cyclomatic 25) scripts/split/module_graph.py:110 — module_graph.lex_mask 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 · ChatView.handleWebviewMessage (cyclomatic 25) · ×1
  • ChatView.handleWebviewMessage (cyclomatic 25) extensions/vscode/src/chat.ts:223 — ChatView.handleWebviewMessage has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · review-eval.replay (cyclomatic 25) · ×1
  • review-eval.replay (cyclomatic 25) scripts/review-eval.mjs:678 — review-eval.replay has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · handleLine (cyclomatic 25) · ×1
  • handleLine (cyclomatic 25) crates/tui/plugins/computer-use/mcp/server.mjs:1887 — handleLine 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 · ModelRegistry · ×1
  • ModelRegistry::resolve (cyclomatic 24) crates/agent/src/lib.rs:218 — ModelRegistry::resolve has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · EditFileTool · ×1
  • EditFileTool::execute (cyclomatic 24) REDACTED:2647 — EditFileTool::execute has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ExploringCell · ×1
  • ExploringCell::render_with_locale (cyclomatic 24) crates/tui/src/tui/history.rs:1543 — ExploringCell::render_with_locale 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 · PetSimKt.gaitTarget (cyclomatic 24) · ×1
  • PetSimKt.gaitTarget (cyclomatic 24) pet/android/PetSim.kt:126 — PetSimKt.gaitTarget 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 · catalog_models_dev.validate_reviewed (cyclomatic 24) · ×1
  • catalog_models_dev.validate_reviewed (cyclomatic 24) scripts/catalog_models_dev.py:896 — catalog_models_dev.validate_reviewed 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 · check-command-migration-manifest._strip_comments_and_strings (cyclomatic 24) · ×1
  • check-command-migration-manifest._strip_comments_and_strings (cyclomatic 24) scripts/check-command-migration-manifest.py:624 — check-command-migration-manifest._strip_comments_and_strings 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 · check-lexicon.rust_tokens (cyclomatic 24) · ×1
  • check-lexicon.rust_tokens (cyclomatic 24) scripts/check-lexicon.py:251 — check-lexicon.rust_tokens 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 · module_graph.build_report (cyclomatic 24) · ×1
  • module_graph.build_report (cyclomatic 24) scripts/split/module_graph.py:516 — module_graph.build_report 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 · darwin.create.screenshot (cyclomatic 24) · ×1
  • darwin.create.screenshot (cyclomatic 24) crates/tui/plugins/computer-use/src/backends/darwin.mjs:466 — darwin.create.screenshot has cyclomatic complexity 24 (threshold 15). 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · qr.makeMatrix (cyclomatic 24) · ×1
  • qr.makeMatrix (cyclomatic 24) integrations/weixin-bridge/src/qr.mjs:173 — qr.makeMatrix has cyclomatic complexity 24 (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 · index.monitorLoop (cyclomatic 24) · ×1
  • index.monitorLoop (cyclomatic 24) integrations/weixin-bridge/src/index.mjs:1222 — index.monitorLoop has cyclomatic complexity 24 (threshold 15). Of this number, 18 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 · review-eval.grade (cyclomatic 24) · ×1
  • review-eval.grade (cyclomatic 24) scripts/review-eval.mjs:777 — review-eval.grade has cyclomatic complexity 24 (threshold 15). Of this number, 19 points are the body's own statements and 5 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 · models-table.compare (cyclomatic 24) · ×1
  • models-table.compare (cyclomatic 24) web/components/models-table.tsx:33 — models-table.compare 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 · workflowReceiptPresentation (cyclomatic 24) · ×1
  • workflowReceiptPresentation (cyclomatic 24) crates/tui/src/runtime_web/app.mjs:457 — workflowReceiptPresentation 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 · runInputLease (cyclomatic 24) · ×1
  • runInputLease (cyclomatic 24) crates/tui/plugins/computer-use/src/exec.mjs:85 — runInputLease has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 5 of the 24 points are its own statements and the rest belongs to 17 function items inside it that branch (send, release, onStdout, …). 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 · readLease (cyclomatic 24) · ×1
  • readLease (cyclomatic 24) crates/tui/plugins/computer-use/src/lease.mjs:33 — readLease 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 · AutomationManager · ×1
  • AutomationManager::update_automation_unlocked (cyclomatic 23) crates/tui/src/automation_manager.rs:1368 — AutomationManager::update_automation_unlocked 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 · FleetRoster · ×1
  • FleetRoster::load_with_personal_dir_and_plugins (cyclomatic 23) crates/tui/src/fleet/roster.rs:256 — FleetRoster::load_with_personal_dir_and_plugins has cyclomatic complexity 23 (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 · PluginInstallSource · ×1
  • PluginInstallSource::parse (cyclomatic 23) crates/tui/src/plugins/install/mod.rs:114 — PluginInstallSource::parse 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 · braille-mark.icon_square (cyclomatic 23) · ×1
  • braille-mark.icon_square (cyclomatic 23) scripts/brand/braille-mark.py:124 — braille-mark.icon_square 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 · check-provider-registry.report_antigravity_public_contract (cyclomatic 23) · ×1
  • check-provider-registry.report_antigravity_public_contract (cyclomatic 23) scripts/check-provider-registry.py:274 — check-provider-registry.report_antigravity_public_contract 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 · count_lines.analyse_file (cyclomatic 23) · ×1
  • count_lines.analyse_file (cyclomatic 23) scripts/split/count_lines.py:173 — count_lines.analyse_file 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 · app.applySnapshot (cyclomatic 23) · ×1
  • app.applySnapshot (cyclomatic 23) crates/tui/src/runtime_web/app.mjs:56 — app.applySnapshot 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 · ingest.categoryFor (cyclomatic 23) · ×1
  • ingest.categoryFor (cyclomatic 23) pet/src/core/ingest.ts:78 — ingest.categoryFor 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 · pet-audio.renderPetPCM (cyclomatic 23) · ×1
  • pet-audio.renderPetPCM (cyclomatic 23) pet/src/core/pet-audio.ts:71 — pet-audio.renderPetPCM 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 · github.loadFeed (cyclomatic 23) · ×1
  • github.loadFeed (cyclomatic 23) web/lib/github.ts:206 — github.loadFeed 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 · interest.handleAdminMerchInterest (cyclomatic 23) · ×1
  • interest.handleAdminMerchInterest (cyclomatic 23) web/lib/merch/interest.ts:143 — interest.handleAdminMerchInterest has cyclomatic complexity 23 (threshold 15). Of this number, 15 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · createBrowser · ×1
  • createBrowser::start (cyclomatic 23) crates/tui/plugins/computer-use/src/browser-cdp.mjs:443 — createBrowser::start 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 · codewhale_cloud_facts · ×1
  • codewhale_cloud_facts::refresh_using (cyclomatic 22) crates/cloud-facts/src/lib.rs:698 — codewhale_cloud_facts::refresh_using 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 · LlmError · ×1
  • LlmError::from_http_response_with_retry_hints (cyclomatic 22) crates/tui/src/llm_client/mod.rs:494 — LlmError::from_http_response_with_retry_hints 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 · RlmTool · ×1
  • RlmTool::execute_eval (cyclomatic 22) crates/tui/src/tools/rlm.rs:467 — RlmTool::execute_eval has cyclomatic complexity 22 (threshold 15). Of this number, 20 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, 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 · check-blocking-calls-budget._test_module_edges (cyclomatic 22) · ×1
  • check-blocking-calls-budget._test_module_edges (cyclomatic 22) scripts/check-blocking-calls-budget.py:266 — check-blocking-calls-budget._test_module_edges 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 · check-command-migration-manifest.check_source_frontier (cyclomatic 22) · ×1
  • check-command-migration-manifest.check_source_frontier (cyclomatic 22) scripts/check-command-migration-manifest.py:1122 — check-command-migration-manifest.check_source_frontier 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 · testsplit.analyse_file (cyclomatic 22) · ×1
  • testsplit.analyse_file (cyclomatic 22) scripts/split/testsplit.py:61 — testsplit.analyse_file 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 · app.collectProviderModelPages (cyclomatic 22) · ×1
  • app.collectProviderModelPages (cyclomatic 22) crates/tui/src/runtime_web/app.mjs:811 — app.collectProviderModelPages 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 · review.run (cyclomatic 22) · ×1
  • review.run (cyclomatic 22) REDACTED:124 — review.run has cyclomatic complexity 22 (threshold 15). Of this number, 20 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · computer-use-release.receiptQualifiedRelease (cyclomatic 22) · ×1
  • computer-use-release.receiptQualifiedRelease (cyclomatic 22) web/lib/computer-use-release.ts:128 — computer-use-release.receiptQualifiedRelease has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · facts-lib.deriveFeatures.features (cyclomatic 22) · ×1
  • facts-lib.deriveFeatures.features (cyclomatic 22) REDACTED:154 — facts-lib.deriveFeatures.features has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · validateWaitArgs (cyclomatic 22) · ×1
  • validateWaitArgs (cyclomatic 22) crates/tui/plugins/computer-use/mcp/server.mjs:640 — validateWaitArgs has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · codewhale_command_contract · ×1
  • codewhale_command_contract::metrics::build_groups (cyclomatic 21) crates/command-contract/src/metrics.rs:141 — codewhale_command_contract::metrics::build_groups 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 · NameStakes · ×1
  • NameStakes::from_tool_name (cyclomatic 21) crates/tui/src/core/authority/auto_review.rs:312 — NameStakes::from_tool_name 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 · RawDacl · ×1
  • RawDacl::from_storage (cyclomatic 21) crates/tui/src/extension_host/windows.rs:1573 — RawDacl::from_storage 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 · HookExecutor · ×1
  • HookExecutor::execute_sync_legacy (cyclomatic 21) crates/tui/src/hooks/executor.rs:2435 — HookExecutor::execute_sync_legacy has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · LspManager · ×1
  • LspManager::semantic_locations (cyclomatic 21) crates/tui/src/lsp/mod.rs:677 — LspManager::semantic_locations 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 · ClientParser · ×1
  • ClientParser::feed (cyclomatic 21) crates/tui/src/runtime_api/computer_display.rs:636 — ClientParser::feed 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 · ApprovalView · ×1
  • ApprovalView::handle_key (cyclomatic 21) crates/tui/src/tui/approval/view.rs:343 — ApprovalView::handle_key has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · PetSharedClient.poll (cyclomatic 21) · ×1
  • PetSharedClient.poll (cyclomatic 21) pet/android/src/main/kotlin/codewhale/pet/PetSharedClient.kt:46 — PetSharedClient.poll 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 · PetViewModel.handle (cyclomatic 21) · ×1
  • PetViewModel.handle (cyclomatic 21) pet/android/src/main/kotlin/codewhale/pet/PetViewModel.kt:261 — PetViewModel.handle 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 · convert-plugin.convert (cyclomatic 21) · ×1
  • convert-plugin.convert (cyclomatic 21) scripts/convert-plugin.py:391 — convert-plugin.convert has cyclomatic complexity 21 (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 · runtime_mobile.html.openThreadEvents (cyclomatic 21) · ×1
  • runtime_mobile.html.openThreadEvents (cyclomatic 21) crates/tui/src/runtime_mobile.html:854 — runtime_mobile.html.openThreadEvents 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 4 function literals inside it that branch (lines 887, 900, 927, …). 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 · app.answersForUserInput (cyclomatic 21) · ×1
  • app.answersForUserInput (cyclomatic 21) crates/tui/src/runtime_web/app.mjs:345 — app.answersForUserInput has cyclomatic complexity 21 (threshold 15). Of this number, 20 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 · markdown.renderMarkdown (cyclomatic 21) · ×1
  • markdown.renderMarkdown (cyclomatic 21) REDACTED:16 — markdown.renderMarkdown 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 · verify-release-inventory.run (cyclomatic 21) · ×1
  • verify-release-inventory.run (cyclomatic 21) scripts/release/verify-release-inventory.js:137 — verify-release-inventory.run 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 · compare-deployed-facts.main (cyclomatic 21) · ×1
  • compare-deployed-facts.main (cyclomatic 21) web/scripts/compare-deployed-facts.mjs:100 — compare-deployed-facts.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 · (anonymous) (cyclomatic 21) · ×1
  • (anonymous) (cyclomatic 21) crates/tui/plugins/computer-use/app/daemon.mjs:87 — (anonymous) has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to 11 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 · create.get_app_state (cyclomatic 21) · ×1
  • create.get_app_state (cyclomatic 21) crates/tui/plugins/computer-use/src/backends/darwin.mjs:912 — create.get_app_state 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 · NotificationConfigUpdate · ×1
  • NotificationConfigUpdate::parse (cyclomatic 20) crates/config/src/notifications.rs:189 — NotificationConfigUpdate::parse has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ReasoningEffort · ×1
  • ReasoningEffort::normalize_for_route_identity (cyclomatic 20) crates/tui/src/reasoning_preference.rs:248 — ReasoningEffort::normalize_for_route_identity has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · RuntimeChatRelayHost · ×1
  • RuntimeChatRelayHost::apply_prompt (cyclomatic 20) crates/tui/src/runtime_chat_relay.rs:596 — RuntimeChatRelayHost::apply_prompt 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 · AgentsCoordinateTool · ×1
  • AgentsCoordinateTool::mutate_coordination (cyclomatic 20) crates/tui/src/tools/subagent/coord.rs:1137 — AgentsCoordinateTool::mutate_coordination 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 · AgentTool · ×1
  • AgentTool::execute (cyclomatic 20) crates/tui/src/tools/subagent/mod.rs:11857 — AgentTool::execute has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · SubAgentWorkflowDriver · ×1
  • SubAgentWorkflowDriver::spawn_task_admitted (cyclomatic 20) crates/tui/src/tools/workflow/mod.rs:4707 — SubAgentWorkflowDriver::spawn_task_admitted 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 · ContextMenuView · ×1
  • ContextMenuView::render (cyclomatic 20) crates/tui/src/tui/context_menu.rs:505 — ContextMenuView::render 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 · TextField · ×1
  • TextField::key (cyclomatic 20) crates/tui/src/tui/views/automations/editor.rs:165 — TextField::key 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 · AutomationsView · ×1
  • AutomationsView::handle_key (cyclomatic 20) crates/tui/src/tui/views/automations.rs:660 — AutomationsView::handle_key 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 · ElevationWidget · ×1
  • ElevationWidget::render (cyclomatic 20) crates/tui/src/tui/widgets/mod.rs:2534 — ElevationWidget::render 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 · check-contributor-credit.main (cyclomatic 20) · ×1
  • check-contributor-credit.main (cyclomatic 20) scripts/check-contributor-credit.py:90 — check-contributor-credit.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 · check-media-assets.main (cyclomatic 20) · ×1
  • check-media-assets.main (cyclomatic 20) scripts/media/check-media-assets.py:110 — check-media-assets.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 · count_lines.summarise (cyclomatic 20) · ×1
  • count_lines.summarise (cyclomatic 20) scripts/split/count_lines.py:323 — count_lines.summarise 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 · ingest.fromOTLP (cyclomatic 20) · ×1
  • ingest.fromOTLP (cyclomatic 20) pet/src/core/ingest.ts:162 — ingest.fromOTLP 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 · verify-release-inventory.assertInventory (cyclomatic 20) · ×1
  • verify-release-inventory.assertInventory (cyclomatic 20) scripts/release/verify-release-inventory.js:78 — verify-release-inventory.assertInventory 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 · highlight.tokenize (cyclomatic 20) · ×1
  • highlight.tokenize (cyclomatic 20) web/components/ratatui/highlight.tsx:12 — highlight.tokenize has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its 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.validateQuoteInput (cyclomatic 20) · ×1
  • model.validateQuoteInput (cyclomatic 20) web/lib/merch/model.ts:18 — model.validateQuoteInput 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 · codewhale_agent · ×1
  • codewhale_agent::model_family (cyclomatic 19) crates/agent/src/lib.rs:405 — codewhale_agent::model_family 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 · CatalogCorrections · ×1
  • CatalogCorrections::validate (cyclomatic 19) crates/config/src/catalog/corrections.rs:83 — CatalogCorrections::validate 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 · codewhale_localization · ×1
  • codewhale_localization::parse_locale (cyclomatic 19) crates/localization/src/lib.rs:5680 — codewhale_localization::parse_locale 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 · HookContext · ×1
  • HookContext::to_env_vars (cyclomatic 19) crates/tui/src/hooks/executor.rs:366 — HookContext::to_env_vars 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 · SseTransport · ×1
  • SseTransport::run_sse_loop (cyclomatic 19) crates/tui/src/mcp/sse.rs:83 — SseTransport::run_sse_loop 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 · RuntimeChatPrompt · ×1
  • RuntimeChatPrompt::validate_shape (cyclomatic 19) crates/tui/src/runtime_chat_relay.rs:1219 — RuntimeChatPrompt::validate_shape 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 · CommandPaletteView · ×1
  • CommandPaletteView::render (cyclomatic 19) crates/tui/src/tui/command_palette.rs:879 — CommandPaletteView::render 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 · Workspace · ×1
  • Workspace::browser_completion_candidates_inner (cyclomatic 19) crates/tui/src/working_set.rs:469 — Workspace::browser_completion_candidates_inner 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 · harness._parse_stream_receipt (cyclomatic 19) · ×1
  • harness._parse_stream_receipt (cyclomatic 19) integrations/verifiers-codewhale/codewhale_harness/harness.py:345 — harness._parse_stream_receipt 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 · check-command-core-navigation-proof.violations (cyclomatic 19) · ×1
  • check-command-core-navigation-proof.violations (cyclomatic 19) scripts/check-command-core-navigation-proof.py:92 — check-command-core-navigation-proof.violations 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 · carve.parse_items (cyclomatic 19) · ×1
  • carve.parse_items (cyclomatic 19) scripts/split/carve.py:34 — carve.parse_items 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 · Mover.plan_manifests (cyclomatic 19) · ×1
  • Mover.plan_manifests (cyclomatic 19) scripts/split/move-modules.py:514 — Mover.plan_manifests 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 · PetSharedFrame.validate (cyclomatic 19) · ×1
  • PetSharedFrame.validate (cyclomatic 19) pet/swift/PetShared.swift:42 — PetSharedFrame.validate 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 · app-script-policy.checkJxa (cyclomatic 19) · ×1
  • app-script-policy.checkJxa (cyclomatic 19) crates/tui/plugins/computer-use/src/app-script-policy.mjs:142 — app-script-policy.checkJxa 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 · server.prepareArgs (cyclomatic 19) · ×1
  • server.prepareArgs (cyclomatic 19) crates/tui/plugins/computer-use/mcp/server.mjs:1618 — server.prepareArgs 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 · darwin.create.get_app_state (cyclomatic 19) · ×1
  • darwin.create.get_app_state (cyclomatic 19) crates/tui/plugins/computer-use/src/backends/darwin.mjs:912 — darwin.create.get_app_state 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 · chat.readPayloadUserInput (cyclomatic 19) · ×1
  • chat.readPayloadUserInput (cyclomatic 19) extensions/vscode/src/chat.ts:868 — chat.readPayloadUserInput has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 882, 899). 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 · qr.makeMatrix.setFinder (cyclomatic 19) · ×1
  • qr.makeMatrix.setFinder (cyclomatic 19) integrations/weixin-bridge/src/qr.mjs:178 — qr.makeMatrix.setFinder 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 · index.reconcileSnapshot (cyclomatic 19) · ×1
  • index.reconcileSnapshot (cyclomatic 19) integrations/weixin-bridge/src/index.mjs:707 — index.reconcileSnapshot 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 3 function literals inside it that branch (lines 717, 712, 714). 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 · index.streamTurnEvents (cyclomatic 19) · ×1
  • index.streamTurnEvents (cyclomatic 19) integrations/weixin-bridge/src/index.mjs:766 — index.streamTurnEvents has cyclomatic complexity 19 (threshold 15). Of this number, 16 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 · index.handleInbound (cyclomatic 19) · ×1
  • index.handleInbound (cyclomatic 19) integrations/weixin-bridge/src/index.mjs:1188 — index.handleInbound 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 · index.main (cyclomatic 19) · ×1
  • index.main (cyclomatic 19) integrations/weixin-bridge/src/index.mjs:1387 — index.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 · ingest.redact (cyclomatic 19) · ×1
  • ingest.redact (cyclomatic 19) pet/src/core/ingest.ts:18 — ingest.redact 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 · cnb-github-checkrun.main (cyclomatic 19) · ×1
  • cnb-github-checkrun.main (cyclomatic 19) scripts/ci/cnb-github-checkrun.mjs:90 — cnb-github-checkrun.main 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 · connection-banner.ConnectionBanner (cyclomatic 19) · ×1
  • connection-banner.ConnectionBanner (cyclomatic 19) web/components/connection-banner.tsx:23 — connection-banner.ConnectionBanner has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 81, 40, 63, …). 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 · contributor-merch.ContributorMerch (cyclomatic 19) · ×1
  • contributor-merch.ContributorMerch (cyclomatic 19) web/components/contributor-merch.tsx:16 — contributor-merch.ContributorMerch has cyclomatic complexity 19 (threshold 15). Of this number, 11 points are the body's own statements and 8 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 · draft-claim-lock.applyDraftLock (cyclomatic 19) · ×1
  • draft-claim-lock.applyDraftLock (cyclomatic 19) web/lib/draft-claim-lock.ts:51 — draft-claim-lock.applyDraftLock 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 · interest.validated (cyclomatic 19) · ×1
  • interest.validated (cyclomatic 19) web/lib/merch/interest.ts:90 — interest.validated 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 · makeMatrix · ×1
  • makeMatrix::setFinder (cyclomatic 19) integrations/weixin-bridge/src/qr.mjs:178 — makeMatrix::setFinder 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 · register (cyclomatic 19) · ×1
  • register (cyclomatic 19) crates/tui/plugins/computer-use/src/registry.mjs:91 — register 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 · codewhale_sanitize · ×1
  • codewhale_sanitize::sanitize::strip_ansi_impl (cyclomatic 18) crates/sanitize/src/sanitize.rs:133 — codewhale_sanitize::sanitize::strip_ansi_impl 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 · ToolActionKind · ×1
  • ToolActionKind::from_tool_call (cyclomatic 18) crates/tui/src/core/authority/auto_review.rs:123 — ToolActionKind::from_tool_call 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 · FleetLedger · ×1
  • FleetLedger::compact_with_snapshot_hook (cyclomatic 18) crates/tui/src/fleet/ledger.rs:1627 — FleetLedger::compact_with_snapshot_hook has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: codewhale_tui::fleet::ledger::privacy_bounded_worker_payload (cyclomatic 29) 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 function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · McpServer · ×1
  • McpServer::handle_message (cyclomatic 18) crates/tui/src/mcp_server.rs:192 — McpServer::handle_message 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 · SnapshotRepo · ×1
  • SnapshotRepo::restore_path_plan_locked (cyclomatic 18) crates/tui/src/snapshot/repo.rs:1302 — SnapshotRepo::restore_path_plan_locked 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 · WorkflowRunJournal · ×1
  • WorkflowRunJournal::hydrate_runs (cyclomatic 18) crates/tui/src/tools/workflow/journal.rs:196 — WorkflowRunJournal::hydrate_runs 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 · FleetRosterView · ×1
  • FleetRosterView::render_body (cyclomatic 18) crates/tui/src/tui/views/fleet_roster.rs:546 — FleetRosterView::render_body has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · catalog_models_dev.stale_corrections (cyclomatic 18) · ×1
  • catalog_models_dev.stale_corrections (cyclomatic 18) scripts/catalog_models_dev.py:862 — catalog_models_dev.stale_corrections 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 · check-command-migration-manifest.validate_selector (cyclomatic 18) · ×1
  • check-command-migration-manifest.validate_selector (cyclomatic 18) scripts/check-command-migration-manifest.py:270 — check-command-migration-manifest.validate_selector 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 · convert-plugin.remote_server (cyclomatic 18) · ×1
  • convert-plugin.remote_server (cyclomatic 18) scripts/convert-plugin.py:228 — convert-plugin.remote_server 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 · updates.prepareUpdate (cyclomatic 18) · ×1
  • updates.prepareUpdate (cyclomatic 18) crates/tui/plugins/computer-use/app/updates.mjs:80 — updates.prepareUpdate 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 · lib.parseQuestionAnswers (cyclomatic 18) · ×1
  • lib.parseQuestionAnswers (cyclomatic 18) integrations/weixin-bridge/src/lib.mjs:189 — lib.parseQuestionAnswers has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · install.prepareCompiledHost (cyclomatic 18) · ×1
  • install.prepareCompiledHost (cyclomatic 18) REDACTED:1590 — install.prepareCompiledHost 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 · pet.get('follow').onclick (cyclomatic 18) · ×1
  • pet.get('follow').onclick (cyclomatic 18) pet/src/ui/pet.ts:231 — pet.get('follow').onclick has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to one function item inside it that branches (poll). 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 · opencode-chat2responses-proxy.server (cyclomatic 18) · ×1
  • opencode-chat2responses-proxy.server (cyclomatic 18) scripts/opencode-chat2responses-proxy.mjs:128 — opencode-chat2responses-proxy.server has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 141). 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 · server.webhook (cyclomatic 18) · ×1
  • server.webhook (cyclomatic 18) web/lib/merch/server.ts:111 — server.webhook 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 · inputOwnerCheck (cyclomatic 18) · ×1
  • inputOwnerCheck (cyclomatic 18) crates/tui/plugins/computer-use/mcp/server.mjs:877 — inputOwnerCheck 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 (cyclomatic 18) · ×1
  • run (cyclomatic 18) crates/tui/plugins/computer-use/src/exec.mjs:25 — run has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 11 function items inside it that branch (a function literal at line 30, (anonymous)::finish, (anonymous)::terminate, …). 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 · CapturedRlmCaller · ×1
  • CapturedRlmCaller::dispatch_admitted (cyclomatic 17) crates/tui/src/core/engine/rlm_host.rs:221 — CapturedRlmCaller::dispatch_admitted has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Reader · ×1
  • Reader::handle (cyclomatic 17) crates/tui/src/extension_host/supervisor.rs:2044 — Reader::handle has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · PythonRuntime · ×1
  • PythonRuntime::run (cyclomatic 17) crates/tui/src/repl/runtime.rs:407 — PythonRuntime::run has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ReadFileTool · ×1
  • ReadFileTool::execute_contract_read (cyclomatic 17) REDACTED:935 — ReadFileTool::execute_contract_read 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 · WorkflowTally · ×1
  • WorkflowTally::from_events (cyclomatic 17) crates/tui/src/tools/workflow/view.rs:108 — WorkflowTally::from_events 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 · WorkflowPlan · ×1
  • WorkflowPlan::from_config (cyclomatic 17) crates/workflow/src/lib.rs:359 — WorkflowPlan::from_config 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 · CodewhaleHarness.launch (cyclomatic 17) · ×1
  • CodewhaleHarness.launch (cyclomatic 17) integrations/verifiers-codewhale/codewhale_harness/harness.py:144 — CodewhaleHarness.launch 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 · build-lock.main (cyclomatic 17) · ×1
  • build-lock.main (cyclomatic 17) scripts/build-lock.py:30 — build-lock.main 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 · catalog_models_dev.cmd_defaults_audit (cyclomatic 17) · ×1
  • catalog_models_dev.cmd_defaults_audit (cyclomatic 17) scripts/catalog_models_dev.py:1075 — catalog_models_dev.cmd_defaults_audit 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 · check_orcarouter_contract.main (cyclomatic 17) · ×1
  • check_orcarouter_contract.main (cyclomatic 17) scripts/check_orcarouter_contract.py:86 — check_orcarouter_contract.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 · check-windows-imports.main (cyclomatic 17) · ×1
  • check-windows-imports.main (cyclomatic 17) scripts/release/check-windows-imports.py:79 — check-windows-imports.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 · Mover.run_plan (cyclomatic 17) · ×1
  • Mover.run_plan (cyclomatic 17) scripts/split/move-modules.py:299 — Mover.run_plan 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 · widen.main (cyclomatic 17) · ×1
  • widen.main (cyclomatic 17) scripts/split/widen.py:335 — widen.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 · CodewhalePetMobileApp.body (cyclomatic 17) · ×1
  • CodewhalePetMobileApp.body (cyclomatic 17) pet/ios/CodewhalePetApp.swift:14 — CodewhalePetMobileApp.body has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodewhalePetApp.body (cyclomatic 17) · ×1
  • CodewhalePetApp.body (cyclomatic 17) pet/macos/CodewhalePetApp.swift:14 — CodewhalePetApp.body has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PetSharedHost.start (cyclomatic 17) · ×1
  • PetSharedHost.start (cyclomatic 17) pet/swift/PetShared.swift:117 — PetSharedHost.start 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 · darwin.create.app_script (cyclomatic 17) · ×1
  • darwin.create.app_script (cyclomatic 17) crates/tui/plugins/computer-use/src/backends/darwin.mjs:845 — darwin.create.app_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 · index.handleCommand (cyclomatic 17) · ×1
  • index.handleCommand (cyclomatic 17) integrations/wecom-bridge/src/index.mjs:160 — index.handleCommand 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 · install.isRetryable (cyclomatic 17) · ×1
  • install.isRetryable (cyclomatic 17) REDACTED:874 — install.isRetryable has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · install.ensureBinary (cyclomatic 17) · ×1
  • install.ensureBinary (cyclomatic 17) REDACTED:1511 — install.ensureBinary 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 · install.run (cyclomatic 17) · ×1
  • install.run (cyclomatic 17) REDACTED:1690 — install.run has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · pet.get<HTMLInputElement>('file').onchange (cyclomatic 17) · ×1
  • pet.get<HTMLInputElement>('file').onchange (cyclomatic 17) pet/src/ui/pet.ts:193 — pet.get<HTMLInputElement>('file').onchange 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 · review.settings (cyclomatic 17) · ×1
  • review.settings (cyclomatic 17) REDACTED:33 — review.settings 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 · review.target (cyclomatic 17) · ×1
  • review.target (cyclomatic 17) REDACTED:56 — review.target 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 · prepare-local-release-assets.main (cyclomatic 17) · ×1
  • prepare-local-release-assets.main (cyclomatic 17) scripts/release/prepare-local-release-assets.js:23 — prepare-local-release-assets.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 · docs-search.DocsSearch (cyclomatic 17) · ×1
  • docs-search.DocsSearch (cyclomatic 17) web/components/docs-search.tsx:123 — docs-search.DocsSearch has cyclomatic complexity 17 (threshold 15). Of this number, 11 points are the body's own statements and 6 belong to 6 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 · render-terminal-capture.compact.rows (cyclomatic 17) · ×1
  • render-terminal-capture.compact.rows (cyclomatic 17) REDACTED:90 — render-terminal-capture.compact.rows 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · handleCallbackQuery (cyclomatic 17) · ×1
  • handleCallbackQuery (cyclomatic 17) integrations/telegram-bridge/src/index.mjs:275 — handleCallbackQuery 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 · filterElements (cyclomatic 17) · ×1
  • filterElements (cyclomatic 17) crates/tui/plugins/computer-use/mcp/server.mjs:418 — filterElements has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 433, 422, 420, …). 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 · resolveAppIdentity (cyclomatic 17) · ×1
  • resolveAppIdentity (cyclomatic 17) crates/tui/plugins/computer-use/mcp/server.mjs:754 — resolveAppIdentity has cyclomatic complexity 17 (threshold 15). Of this number, 10 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · create.appScript (cyclomatic 17) · ×1
  • create.appScript (cyclomatic 17) crates/tui/plugins/computer-use/src/backends/darwin.mjs:845 — create.appScript 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 · RuntimeBridge · ×1
  • RuntimeBridge::message_thread (cyclomatic 16) crates/app-server/src/lib.rs:2455 — RuntimeBridge::message_thread has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: codewhale_app_server::dispatch_stdio_request_with_writer (cyclomatic 35) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Store · ×1
  • Store::recall_impl (cyclomatic 16) crates/memory/src/store.rs:978 — Store::recall_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 · codewhale_runtime · ×1
  • codewhale_runtime::tool_history_repair::repair_tool_call_pairs_inner (cyclomatic 16) crates/runtime/src/tool_history_repair.rs:68 — codewhale_runtime::tool_history_repair::repair_tool_call_pairs_inner 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 · SetupCmd · ×1
  • SetupCmd::execute (cyclomatic 16) crates/tui/src/commands/groups/core/setup.rs:26 — SetupCmd::execute has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ToolActivationCache · ×1
  • ToolActivationCache::activate_inner (cyclomatic 16) crates/tui/src/core/session.rs:216 — ToolActivationCache::activate_inner 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 · Caller · ×1
  • Caller::check (cyclomatic 16) crates/tui/src/extension_host/execution.rs:116 — Caller::check has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkspaceFile · ×1
  • WorkspaceFile::open_confined (cyclomatic 16) crates/tui/src/fleet/files.rs:97 — WorkspaceFile::open_confined 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 · EventSoundPolicy · ×1
  • EventSoundPolicy::decide_configured (cyclomatic 16) crates/tui/src/notify/sound_policy.rs:85 — EventSoundPolicy::decide_configured 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 · RuntimeEventJournal · ×1
  • RuntimeEventJournal::load (cyclomatic 16) crates/tui/src/remote_control.rs:449 — RuntimeEventJournal::load 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 · CapturedRuntimeFrontend · ×1
  • CapturedRuntimeFrontend::serve (cyclomatic 16) crates/tui/src/runtime_api.rs:677 — CapturedRuntimeFrontend::serve has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: codewhale_tui::runtime_api::fleet_event_label (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · UpdateGoalTool · ×1
  • UpdateGoalTool::execute (cyclomatic 16) crates/tui/src/tools/goal.rs:1197 — UpdateGoalTool::execute has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OcrOutcome · ×1
  • OcrOutcome::into_host_text (cyclomatic 16) crates/tui/src/tools/image_ocr.rs:306 — OcrOutcome::into_host_text 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 · LoadSkillTool · ×1
  • LoadSkillTool::execute (cyclomatic 16) crates/tui/src/tools/skill.rs:75 — LoadSkillTool::execute has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SlotLedger · ×1
  • SlotLedger::classify (cyclomatic 16) crates/tui/src/tools/workflow/mod.rs:1040 — SlotLedger::classify 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 · EvidenceRef · ×1
  • EvidenceRef::new (cyclomatic 16) crates/tui/src/work_graph/model.rs:504 — EvidenceRef::new 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 · WorkRuntime · ×1
  • WorkRuntime::restore_internal (cyclomatic 16) crates/tui/src/work_graph/runtime.rs:671 — WorkRuntime::restore_internal 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 · ExactFleet · ×1
  • ExactFleet::from_toml (cyclomatic 16) crates/workflow/src/fleet_exact.rs:573 — ExactFleet::from_toml 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 · codewhale_workflow · ×1
  • codewhale_workflow::redaction::redact_token (cyclomatic 16) crates/workflow/src/redaction.rs:282 — codewhale_workflow::redaction::redact_token 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-lexicon.scan_rust (cyclomatic 16) · ×1
  • check-lexicon.scan_rust (cyclomatic 16) scripts/check-lexicon.py:322 — check-lexicon.scan_rust 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-runtime-contract-budget.main (cyclomatic 16) · ×1
  • check-runtime-contract-budget.main (cyclomatic 16) scripts/check-runtime-contract-budget.py:639 — check-runtime-contract-budget.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 · convert-plugin.skill_files (cyclomatic 16) · ×1
  • convert-plugin.skill_files (cyclomatic 16) scripts/convert-plugin.py:146 — convert-plugin.skill_files 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 · PetNativeCore.pcm (cyclomatic 16) · ×1
  • PetNativeCore.pcm (cyclomatic 16) pet/swift/PetNativeCore.swift:141 — PetNativeCore.pcm 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 · app-script-policy.checkAppleScript (cyclomatic 16) · ×1
  • app-script-policy.checkAppleScript (cyclomatic 16) crates/tui/plugins/computer-use/src/app-script-policy.mjs:83 — app-script-policy.checkAppleScript 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 · ThreadStore.ensureShape (cyclomatic 16) · ×1
  • ThreadStore.ensureShape (cyclomatic 16) integrations/bridge-core/src/lib.mjs:89 — ThreadStore.ensureShape has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: lib.commandAction (cyclomatic 17) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · index.reattachActiveTurns (cyclomatic 16) · ×1
  • index.reattachActiveTurns (cyclomatic 16) integrations/telegram-bridge/src/index.mjs:557 — index.reattachActiveTurns 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 · index.applyTurnEvent (cyclomatic 16) · ×1
  • index.applyTurnEvent (cyclomatic 16) integrations/weixin-bridge/src/index.mjs:590 — index.applyTurnEvent 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 · index.startChatRecovery (cyclomatic 16) · ×1
  • index.startChatRecovery (cyclomatic 16) integrations/weixin-bridge/src/index.mjs:806 — index.startChatRecovery has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 808). 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 · verify-release-assets.downloadJson (cyclomatic 16) · ×1
  • verify-release-assets.downloadJson (cyclomatic 16) npm/codewhale/scripts/verify-release-assets.js:188 — verify-release-assets.downloadJson has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 227, 207, 196, …). 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 · pet.draw (cyclomatic 16) · ×1
  • pet.draw (cyclomatic 16) pet/src/ui/pet.ts:140 — pet.draw 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 · opencode-chat2responses-proxy.chatToResponses (cyclomatic 16) · ×1
  • opencode-chat2responses-proxy.chatToResponses (cyclomatic 16) scripts/opencode-chat2responses-proxy.mjs:40 — opencode-chat2responses-proxy.chatToResponses has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · review-eval.runCliCase (cyclomatic 16) · ×1
  • review-eval.runCliCase (cyclomatic 16) scripts/review-eval.mjs:551 — review-eval.runCliCase 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 · review-eval.runSkillCase (cyclomatic 16) · ×1
  • review-eval.runSkillCase (cyclomatic 16) scripts/review-eval.mjs:618 — review-eval.runSkillCase 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 · cloud-facts.fetchCurrentRow (cyclomatic 16) · ×1
  • cloud-facts.fetchCurrentRow (cyclomatic 16) web/lib/cloud-facts.ts:255 — cloud-facts.fetchCurrentRow has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: cloud-facts.isEnvelope (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · content-watch.runSemanticDrift (cyclomatic 16) · ×1
  • content-watch.runSemanticDrift (cyclomatic 16) web/lib/content-watch.ts:287 — content-watch.runSemanticDrift has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · learning.getGuidance (cyclomatic 16) · ×1
  • learning.getGuidance (cyclomatic 16) web/lib/ratatui/learning.ts:180 — learning.getGuidance 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 · render-terminal-capture.frameSvg (cyclomatic 16) · ×1
  • render-terminal-capture.frameSvg (cyclomatic 16) REDACTED:238 — render-terminal-capture.frameSvg has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 244, 256). 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 · findBrowserApp (cyclomatic 16) · ×1
  • findBrowserApp (cyclomatic 16) crates/tui/plugins/computer-use/src/browser-cdp.mjs:59 — findBrowserApp 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 · create.invokeMenu (cyclomatic 16) · ×1
  • create.invokeMenu (cyclomatic 16) crates/tui/plugins/computer-use/src/backends/darwin.mjs:787 — create.invokeMenu has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs 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.
D2 · Cognitive Complexity · callTool (cognitive 411) · ×1
  • callTool (cognitive 411) crates/tui/plugins/computer-use/mcp/server.mjs:1011 — callTool has cognitive complexity 411 (threshold 15). Drivers by points: if/else 95 (165 pts), ternaries 31 (72 pts), boolean chains 61, other 61, error handling 20 (43 pts), loops 4 (9 pts) (nesting depth added 139). Of this number, 376 points are the body's own statements and 35 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 · linux.create (cognitive 388) · ×1
  • linux.create (cognitive 388) crates/tui/plugins/computer-use/src/backends/linux.mjs:85 — linux.create has cognitive complexity 388 (threshold 15). Drivers by points: if/else 159 (202 pts), boolean chains 84, ternaries 41 (61 pts), loops 16 (23 pts), error handling 14 (18 pts) (nesting depth added 74). None of this is in the body itself: all 388 points belong to 79 function items inside it that branch (a function literal at line 561, a function literal at line 1071, a function literal at line 876, …). 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 · evidence.analyzeEvidence (cognitive 217) · ×1
  • evidence.analyzeEvidence (cognitive 217) pet/src/core/evidence.ts:153 — evidence.analyzeEvidence has cognitive complexity 217 (threshold 15). Drivers by points: if/else 48 (131 pts), boolean chains 39, loops 15 (26 pts), ternaries 5 (21 pts) (nesting depth added 110). Of this number, 201 points are the body's own statements and 16 belong to 9 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · route.POST (cognitive 178) · ×1
  • route.POST (cognitive 178) web/app/api/admin/post/route.ts:87 — route.POST has cognitive complexity 178 (threshold 15). Drivers by points: if/else 51 (106 pts), error handling 15 (37 pts), boolean chains 18, ternaries 7 (15 pts), loops 1 (2 pts) (nesting depth added 86). Of this number, 151 points are the body's own statements and 27 belong to 6 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 · reexports.run (cognitive 153) · ×1
  • reexports.run (cognitive 153) scripts/split/reexports.py:60 — reexports.run has cognitive complexity 153 (threshold 15). Drivers by points: if/else 28 (73 pts), loops 20 (55 pts), ternaries 5 (17 pts), boolean chains 8 (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 · review-eval.buildCorpus (cognitive 147) · ×1
  • review-eval.buildCorpus (cognitive 147) scripts/review-eval.mjs:255 — review-eval.buildCorpus has cognitive complexity 147 (threshold 15). Drivers by points: if/else 25 (91 pts), ternaries 13 (29 pts), boolean chains 17, loops 5 (10 pts) (nesting depth added 87). Of this number, 146 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 · check-command-migration-manifest.parse_rust_file (cognitive 144) · ×1
  • check-command-migration-manifest.parse_rust_file (cognitive 144) scripts/check-command-migration-manifest.py:792 — check-command-migration-manifest.parse_rust_file has cognitive complexity 144 (threshold 15). Drivers by points: if/else 21 (78 pts), ternaries 6 (25 pts), loops 7 (24 pts), boolean chains 14, error handling 2 (3 pts) (nesting depth added 94). 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 · CodewhaleRuntimeTrace.append (cognitive 128) · ×1
  • CodewhaleRuntimeTrace.append (cognitive 128) pet/src/core/codewhale.ts:365 — CodewhaleRuntimeTrace.append has cognitive complexity 128 (threshold 15). Drivers by points: if/else 25 (59 pts), ternaries 17 (52 pts), boolean chains 12, loops 2 (5 pts) (nesting depth added 72). Of this number, 126 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 · facts-publish.validateSource (cognitive 122) · ×1
  • facts-publish.validateSource (cognitive 122) web/scripts/facts-publish.mjs:168 — facts-publish.validateSource has cognitive complexity 122 (threshold 15). Drivers by points: if/else 42 (85 pts), boolean chains 23, loops 5 (10 pts), error handling 1 (4 pts) (nesting depth added 51). Of this number, 52 points are the body's own statements and 70 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · browser-cdp.createBrowser (cognitive 118) · ×1
  • browser-cdp.createBrowser (cognitive 118) crates/tui/plugins/computer-use/src/browser-cdp.mjs:312 — browser-cdp.createBrowser has cognitive complexity 118 (threshold 15). Drivers by points: if/else 45 (62 pts), boolean chains 20, ternaries 13 (16 pts), error handling 10 (14 pts), loops 4 (6 pts) (nesting depth added 26). Of this number, 87 points are the body's own statements and 31 belong to 10 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 · Carver.run (cognitive 116) · ×1
  • Carver.run (cognitive 116) scripts/split/carve.py:155 — Carver.run has cognitive complexity 116 (threshold 15). Drivers by points: if/else 31 (63 pts), loops 18 (34 pts), ternaries 5 (12 pts), boolean chains 7 (nesting depth added 55). 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 · tools.resolveTool (cognitive 99) · ×1
  • tools.resolveTool (cognitive 99) crates/tui/plugins/computer-use/src/tools.mjs:783 — tools.resolveTool has cognitive complexity 99 (threshold 15). Drivers by points: if/else 24 (56 pts), ternaries 5 (20 pts), boolean chains 18, match/switch 3 (5 pts) (nesting depth added 49). 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 · create (cognitive 99) · ×1
  • create (cognitive 99) crates/tui/plugins/computer-use/src/backends/win32.mjs:152 — create has cognitive complexity 99 (threshold 15). Drivers by points: if/else 27 (28 pts), boolean chains 26, ternaries 19, other 15, error handling 5 (6 pts), loops 5 (nesting depth added 2). Most of this is not in the body itself: 3 of the 99 points are its own statements and the rest belongs to 69 function items inside it that branch (screenshot, open_application, get_app_state, …). 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 · pet-telemetry.compilePetTelemetry (cognitive 97) · ×1
  • pet-telemetry.compilePetTelemetry (cognitive 97) pet/src/core/pet-telemetry.ts:70 — pet-telemetry.compilePetTelemetry has cognitive complexity 97 (threshold 15). Drivers by points: if/else 18 (37 pts), ternaries 10 (25 pts), boolean chains 18, loops 10 (17 pts) (nesting depth added 41). Of this number, 92 points are the body's own statements and 5 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 · explorer.RatatuiExplorer (cognitive 93) · ×1
  • explorer.RatatuiExplorer (cognitive 93) web/components/ratatui/explorer.tsx:110 — explorer.RatatuiExplorer has cognitive complexity 93 (threshold 15). Drivers by points: ternaries 20 (56 pts), boolean chains 21, if/else 13 (16 pts) (nesting depth added 39). Of this number, 64 points are the body's own statements and 29 belong to 17 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 · codewhale.fromCodewhaleSession (cognitive 90) · ×1
  • codewhale.fromCodewhaleSession (cognitive 90) pet/src/core/codewhale.ts:130 — codewhale.fromCodewhaleSession has cognitive complexity 90 (threshold 15). Drivers by points: ternaries 15 (44 pts), if/else 20 (35 pts), boolean chains 6, loops 4 (5 pts) (nesting depth added 45). Of this number, 85 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 · Renderer · ×1
  • Renderer::render (cognitive 82) crates/tui/src/tui/pet_watch/graphics.rs:27 — Renderer::render has cognitive complexity 82 (threshold 15). Drivers by points: if/else 28 (46 pts), loops 12 (31 pts), boolean chains 5 (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 · install.httpRequest (cognitive 79) · ×1
  • install.httpRequest (cognitive 79) REDACTED:535 — install.httpRequest has cognitive complexity 79 (threshold 15). Drivers by points: if/else 20 (28 pts), boolean chains 23, error handling 10 (20 pts), ternaries 7 (8 pts) (nesting depth added 19). Most of this is not in the body itself: 6 of the 79 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 547, 592, 668, …). 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 · scene.createOcean (cognitive 77) · ×1
  • scene.createOcean (cognitive 77) crates/tui/src/integrations/dsh/scene.js:17 — scene.createOcean has cognitive complexity 77 (threshold 15). Drivers by points: if/else 32 (36 pts), boolean chains 18, ternaries 9 (14 pts), loops 7 (8 pts), error handling 1 (nesting depth added 10). Most of this is not in the body itself: 2 of the 77 points are its own statements and the rest belongs to 27 function items inside it that branch (drawFish, buildColors, detectScheme, …). 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 · ModelInventory · ×1
  • ModelInventory::from_config_scoped (cognitive 76) crates/tui/src/model_inventory.rs:223 — ModelInventory::from_config_scoped has cognitive complexity 76 (threshold 15). Drivers by points: if/else 25 (57 pts), boolean chains 8, loops 4 (7 pts), match/switch 3 (4 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Mover.plan_cfg (cognitive 75) · ×1
  • Mover.plan_cfg (cognitive 75) scripts/split/move-modules.py:433 — Mover.plan_cfg has cognitive complexity 75 (threshold 15). Drivers by points: if/else 13 (33 pts), ternaries 5 (18 pts), loops 8 (17 pts), boolean chains 4, error handling 1 (3 pts) (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PetHost.restart (cognitive 75) · ×1
  • PetHost.restart (cognitive 75) pet/swift/PetHost.swift:76 — PetHost.restart has cognitive complexity 75 (threshold 15). Drivers by points: if/else 14 (37 pts), ternaries 5 (12 pts), boolean chains 11, error handling 4 (10 pts), loops 1 (5 pts) (nesting depth added 40). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · check-blocking-calls-budget.strip_comments_and_strings (cognitive 72) · ×1
  • check-blocking-calls-budget.strip_comments_and_strings (cognitive 72) scripts/check-blocking-calls-budget.py:68 — check-blocking-calls-budget.strip_comments_and_strings has cognitive complexity 72 (threshold 15). Drivers by points: if/else 23 (58 pts), loops 3 (9 pts), ternaries 1 (3 pts), boolean chains 2 (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 · pet-runtime.followRuntime (cognitive 72) · ×1
  • pet-runtime.followRuntime (cognitive 72) pet/scripts/lib/pet-runtime.mjs:15 — pet-runtime.followRuntime has cognitive complexity 72 (threshold 15). Drivers by points: if/else 16 (45 pts), boolean chains 9, ternaries 2 (8 pts), error handling 3 (7 pts), loops 2 (3 pts) (nesting depth added 40). Most of this is not in the body itself: 6 of the 72 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 32, 43). 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 · index.streamTurnEvents (cognitive 69) · ×1
  • index.streamTurnEvents (cognitive 69) integrations/telegram-bridge/src/index.mjs:594 — index.streamTurnEvents has cognitive complexity 69 (threshold 15). Drivers by points: if/else 22 (42 pts), boolean chains 19, ternaries 2 (5 pts), error handling 2, loops 1 (nesting depth added 23). Of this number, 63 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 · count_lines.classify_crate (cognitive 68) · ×1
  • count_lines.classify_crate (cognitive 68) scripts/split/count_lines.py:246 — count_lines.classify_crate has cognitive complexity 68 (threshold 15). Drivers by points: if/else 14 (35 pts), loops 12 (23 pts), boolean chains 6, ternaries 2 (4 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 · widen.plan_edits (cognitive 68) · ×1
  • widen.plan_edits (cognitive 68) scripts/split/widen.py:260 — widen.plan_edits has cognitive complexity 68 (threshold 15). Drivers by points: if/else 14 (44 pts), boolean chains 11, loops 4 (10 pts), ternaries 1 (3 pts) (nesting depth added 38). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · check-blocking-calls-budget.file_counts (cognitive 67) · ×1
  • check-blocking-calls-budget.file_counts (cognitive 67) scripts/check-blocking-calls-budget.py:170 — check-blocking-calls-budget.file_counts has cognitive complexity 67 (threshold 15). Drivers by points: if/else 13 (40 pts), loops 6 (14 pts), ternaries 2 (8 pts), boolean chains 5 (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 · WebRunTool · ×1
  • WebRunTool::execute (cognitive 66) crates/tui/src/tools/web_run.rs:521 — WebRunTool::execute has cognitive complexity 66 (threshold 15). Drivers by points: if/else 25 (47 pts), loops 6 (12 pts), match/switch 2 (6 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 · app.applyRuntimeEvent (cognitive 66) · ×1
  • app.applyRuntimeEvent (cognitive 66) crates/tui/src/runtime_web/app.mjs:94 — app.applyRuntimeEvent has cognitive complexity 66 (threshold 15). Drivers by points: if/else 26 (38 pts), boolean chains 18, ternaries 5 (10 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 · flushOutputs (cognitive 65) · ×1
  • flushOutputs (cognitive 65) integrations/weixin-bridge/src/index.mjs:636 — flushOutputs has cognitive complexity 65 (threshold 15). Drivers by points: if/else 22 (45 pts), boolean chains 7, loops 3 (6 pts), ternaries 2 (5 pts), error handling 1 (2 pts) (nesting depth added 30). Of this number, 31 points are the body's own statements and 34 belong to 6 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 · SkillRegistry · ×1
  • SkillRegistry::discover_recursive (cognitive 64) crates/tui/src/skills/mod.rs:617 — SkillRegistry::discover_recursive has cognitive complexity 64 (threshold 15). Drivers by points: if/else 15 (34 pts), match/switch 8 (23 pts), loops 2 (5 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 · testsplit.main (cognitive 64) · ×1
  • testsplit.main (cognitive 64) scripts/split/testsplit.py:106 — testsplit.main has cognitive complexity 64 (threshold 15). Drivers by points: if/else 18 (45 pts), loops 6 (15 pts), boolean chains 4 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MfjsValidationState · ×1
  • MfjsValidationState::validate_schema (cognitive 62) crates/tui/src/tools/schema_sanitize.rs:1452 — MfjsValidationState::validate_schema has cognitive complexity 62 (threshold 15). Drivers by points: if/else 26 (41 pts), boolean chains 10, loops 5 (9 pts), match/switch 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check-blocking-calls-budget._cargo_crate_roots (cognitive 61) · ×1
  • check-blocking-calls-budget._cargo_crate_roots (cognitive 61) scripts/check-blocking-calls-budget.py:331 — check-blocking-calls-budget._cargo_crate_roots has cognitive complexity 61 (threshold 15). Drivers by points: if/else 16 (41 pts), loops 6 (12 pts), ternaries 1 (4 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check-command-migration-manifest.check_source_frontier (cognitive 61) · ×1
  • check-command-migration-manifest.check_source_frontier (cognitive 61) scripts/check-command-migration-manifest.py:1122 — check-command-migration-manifest.check_source_frontier has cognitive complexity 61 (threshold 15). Drivers by points: if/else 14 (41 pts), loops 7 (20 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 · makeMatrix (cognitive 60) · ×1
  • makeMatrix (cognitive 60) integrations/weixin-bridge/src/qr.mjs:173 — makeMatrix has cognitive complexity 60 (threshold 15). Drivers by points: loops 11 (21 pts), if/else 7 (15 pts), ternaries 4 (14 pts), boolean chains 10 (nesting depth added 28). Of this number, 46 points are the body's own statements and 14 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · handle (cognitive 60) · ×1
  • handle (cognitive 60) REDACTED:191 — handle has cognitive complexity 60 (threshold 15). Drivers by points: if/else 20 (28 pts), boolean chains 10, ternaries 3 (8 pts), error handling 3 (6 pts), other 6, loops 1 (2 pts) (nesting depth added 17). Of this number, 37 points are the body's own statements and 23 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 · PetSimKt.gaitTarget (cognitive 56) · ×1
  • PetSimKt.gaitTarget (cognitive 56) pet/android/PetSim.kt:126 — PetSimKt.gaitTarget has cognitive complexity 56 (threshold 15). Drivers by points: if/else 28 (54 pts), boolean chains 1, match/switch 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check-command-migration-manifest._strip_comments_and_strings (cognitive 56) · ×1
  • check-command-migration-manifest._strip_comments_and_strings (cognitive 56) scripts/check-command-migration-manifest.py:624 — check-command-migration-manifest._strip_comments_and_strings has cognitive complexity 56 (threshold 15). Drivers by points: if/else 17 (43 pts), loops 3 (8 pts), boolean chains 5 (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 · module_graph.lex_mask (cognitive 55) · ×1
  • module_graph.lex_mask (cognitive 55) scripts/split/module_graph.py:110 — module_graph.lex_mask has cognitive complexity 55 (threshold 15). Drivers by points: if/else 12 (32 pts), ternaries 3 (9 pts), boolean chains 7, loops 3 (7 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 · splitlib.apply_changes (cognitive 55) · ×1
  • splitlib.apply_changes (cognitive 55) scripts/split/splitlib.py:286 — splitlib.apply_changes has cognitive complexity 55 (threshold 15). Drivers by points: if/else 14 (28 pts), loops 9 (14 pts), boolean chains 5, error handling 2 (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 · runActions (cognitive 55) · ×1
  • runActions (cognitive 55) crates/tui/plugins/computer-use/mcp/server.mjs:582 — runActions has cognitive complexity 55 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 13, ternaries 6 (12 pts), other 5, error handling 1 (2 pts), loops 1 (nesting depth added 16). Of this number, 53 points are the body's own statements and 2 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 · consentCheck (cognitive 55) · ×1
  • consentCheck (cognitive 55) crates/tui/plugins/computer-use/mcp/server.mjs:793 — consentCheck has cognitive complexity 55 (threshold 15). Drivers by points: if/else 19 (33 pts), boolean chains 8, ternaries 3 (5 pts), error handling 1 (4 pts), loops 2 (3 pts), other 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 · pet-sim.gaitTarget (cognitive 54) · ×1
  • pet-sim.gaitTarget (cognitive 54) pet/src/core/pet-sim.ts:160 — pet-sim.gaitTarget has cognitive complexity 54 (threshold 15). Drivers by points: if/else 21 (30 pts), ternaries 7 (22 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 · serve (cognitive 54) · ×1
  • serve (cognitive 54) crates/tui/plugins/computer-use/app/daemon.mjs:136 — serve has cognitive complexity 54 (threshold 15). Drivers by points: if/else 21 (29 pts), boolean chains 8, ternaries 2 (8 pts), error handling 3 (7 pts), loops 1, other 1 (nesting depth added 18). None of this is in the body itself: all 54 points belong to 6 function literals inside it that branch (lines 157, 141, 150, …). 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 · ReviewedCatalog · ×1
  • ReviewedCatalog::validate (cognitive 51) crates/config/src/catalog/reviewed.rs:200 — ReviewedCatalog::validate has cognitive complexity 51 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 16, loops 10, match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TranscriptViewCache · ×1
  • TranscriptViewCache::ensure_iter (cognitive 51) crates/tui/src/tui/transcript.rs:318 — TranscriptViewCache::ensure_iter has cognitive complexity 51 (threshold 15). Drivers by points: if/else 23 (34 pts), boolean chains 13, match/switch 1 (3 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · catalog_models_dev.normalize_seed_spec (cognitive 51) · ×1
  • catalog_models_dev.normalize_seed_spec (cognitive 51) scripts/catalog_models_dev.py:594 — catalog_models_dev.normalize_seed_spec has cognitive complexity 51 (threshold 15). Drivers by points: if/else 16 (33 pts), boolean chains 7, loops 5 (6 pts), ternaries 2 (5 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check-lexicon.rust_tokens (cognitive 51) · ×1
  • check-lexicon.rust_tokens (cognitive 51) scripts/check-lexicon.py:251 — check-lexicon.rust_tokens has cognitive complexity 51 (threshold 15). Drivers by points: if/else 9 (21 pts), ternaries 6 (18 pts), loops 3 (7 pts), boolean chains 5 (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 · server.validateToolArgs (cognitive 51) · ×1
  • server.validateToolArgs (cognitive 51) crates/tui/plugins/computer-use/mcp/server.mjs:1586 — server.validateToolArgs has cognitive complexity 51 (threshold 15). Drivers by points: if/else 16 (29 pts), boolean chains 20, 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 · index.streamTurnEvents (cognitive 51) · ×1
  • index.streamTurnEvents (cognitive 51) integrations/wecom-bridge/src/index.mjs:317 — index.streamTurnEvents has cognitive complexity 51 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 16, ternaries 3 (10 pts), error handling 2 (3 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 · merch-storefront.MerchCheckout (cognitive 51) · ×1
  • merch-storefront.MerchCheckout (cognitive 51) web/components/merch-storefront.tsx:21 — merch-storefront.MerchCheckout has cognitive complexity 51 (threshold 15). Drivers by points: ternaries 15 (25 pts), boolean chains 13, if/else 11, error handling 2 (nesting depth added 10). Of this number, 19 points are the body's own statements and 32 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 · normalizeTarget (cognitive 51) · ×1
  • normalizeTarget (cognitive 51) crates/tui/plugins/computer-use/mcp/server.mjs:312 — normalizeTarget has cognitive complexity 51 (threshold 15). Drivers by points: if/else 15 (33 pts), boolean chains 8, other 7, ternaries 1 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FleetRoster · ×1
  • FleetRoster::load_with_personal_dir_and_plugins (cognitive 50) crates/tui/src/fleet/roster.rs:256 — FleetRoster::load_with_personal_dir_and_plugins has cognitive complexity 50 (threshold 15). Drivers by points: loops 14 (35 pts), match/switch 4 (9 pts), if/else 5 (6 pts) (nesting depth added 27). 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 · check-command-migration-manifest.validate_type_node (cognitive 50) · ×1
  • check-command-migration-manifest.validate_type_node (cognitive 50) scripts/check-command-migration-manifest.py:171 — check-command-migration-manifest.validate_type_node has cognitive complexity 50 (threshold 15). Drivers by points: if/else 17 (35 pts), loops 3 (8 pts), boolean chains 7 (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 · PetSim.swift.gaitTarget (cognitive 50) · ×1
  • PetSim.swift.gaitTarget (cognitive 50) pet/swift/PetSim.swift:145 — PetSim.swift.gaitTarget has cognitive complexity 50 (threshold 15). Drivers by points: ternaries 8 (25 pts), if/else 14 (22 pts), boolean chains 2, match/switch 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · waitFor (cognitive 50) · ×1
  • waitFor (cognitive 50) crates/tui/plugins/computer-use/mcp/server.mjs:656 — waitFor has cognitive complexity 50 (threshold 15). Drivers by points: if/else 12 (24 pts), other 11, boolean chains 8, ternaries 4 (6 pts), loops 1 (nesting depth added 14). Of this number, 46 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check-command-migration-manifest.validate_topology_document (cognitive 48) · ×1
  • check-command-migration-manifest.validate_topology_document (cognitive 48) scripts/check-command-migration-manifest.py:390 — check-command-migration-manifest.validate_topology_document has cognitive complexity 48 (threshold 15). Drivers by points: if/else 16 (36 pts), boolean chains 6, loops 3 (6 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 · FleetFile · ×1
  • FleetFile::validate (cognitive 46) crates/tui/src/fleet/store.rs:301 — FleetFile::validate has cognitive complexity 46 (threshold 15). Drivers by points: if/else 16 (32 pts), loops 4 (7 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExecPolicyEngine · ×1
  • ExecPolicyEngine::check (cognitive 45) crates/execpolicy/src/lib.rs:508 — ExecPolicyEngine::check has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 10, match/switch 5 (8 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 · ReviewTool · ×1
  • ReviewTool::execute (cognitive 45) crates/tui/src/tools/review.rs:1500 — ReviewTool::execute has cognitive complexity 45 (threshold 15). Drivers by points: if/else 19 (28 pts), match/switch 8 (13 pts), loops 2 (3 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 · braille-mark.icon_square (cognitive 45) · ×1
  • braille-mark.icon_square (cognitive 45) scripts/brand/braille-mark.py:124 — braille-mark.icon_square has cognitive complexity 45 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 10 (19 pts), boolean chains 4 (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 · index.streamTurnEvents (cognitive 45) · ×1
  • index.streamTurnEvents (cognitive 45) integrations/feishu-bridge/src/index.mjs:332 — index.streamTurnEvents has cognitive complexity 45 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 15, ternaries 1 (3 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 · models-table.compare (cognitive 45) · ×1
  • models-table.compare (cognitive 45) web/components/models-table.tsx:33 — models-table.compare has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 9 (24 pts), if/else 7 (17 pts), boolean chains 3, match/switch 1 (nesting depth added 25). 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 · facts-publish.verifyEnvelope (cognitive 45) · ×1
  • facts-publish.verifyEnvelope (cognitive 45) web/scripts/facts-publish.mjs:102 — facts-publish.verifyEnvelope has cognitive complexity 45 (threshold 15). Drivers by points: if/else 21 (26 pts), boolean chains 10, error handling 3 (5 pts), loops 2 (3 pts), ternaries 1 (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 · render-terminal-capture.frameSvg (cognitive 45) · ×1
  • render-terminal-capture.frameSvg (cognitive 45) REDACTED:238 — render-terminal-capture.frameSvg has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 7 (31 pts), if/else 4 (9 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 30). Most of this is not in the body itself: 1 of the 45 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 244, 256). 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 · testsplit.analyse_file (cognitive 44) · ×1
  • testsplit.analyse_file (cognitive 44) scripts/split/testsplit.py:61 — testsplit.analyse_file has cognitive complexity 44 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 6 (12 pts), ternaries 4 (9 pts), boolean chains 4 (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 · background-check.runBackgroundCheck (cognitive 44) · ×1
  • background-check.runBackgroundCheck (cognitive 44) crates/tui/plugins/computer-use/app/background-check.mjs:10 — background-check.runBackgroundCheck has cognitive complexity 44 (threshold 15). Drivers by points: if/else 18 (25 pts), boolean chains 9, error handling 2 (5 pts), loops 3 (4 pts), ternaries 1 (nesting depth added 11). Of this number, 27 points are the body's own statements and 17 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 · signal.buildPyramid (cognitive 44) · ×1
  • signal.buildPyramid (cognitive 44) pet/src/core/signal.ts:10 — signal.buildPyramid has cognitive complexity 44 (threshold 15). Drivers by points: loops 11 (21 pts), if/else 10 (20 pts), boolean chains 3 (nesting depth added 20). 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 · ingest.importTrace (cognitive 44) · ×1
  • ingest.importTrace (cognitive 44) pet/src/core/ingest.ts:218 — ingest.importTrace has cognitive complexity 44 (threshold 15). Drivers by points: if/else 19 (23 pts), ternaries 10 (12 pts), boolean chains 6, loops 2, error handling 1 (nesting depth added 6). Of this number, 27 points are the body's own statements and 17 belong to 5 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · index.monitorLoop (cognitive 43) · ×1
  • index.monitorLoop (cognitive 43) integrations/weixin-bridge/src/index.mjs:1222 — index.monitorLoop has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (31 pts), boolean chains 7, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 18). Of this number, 35 points are the body's own statements and 8 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 · facts-publish.main (cognitive 43) · ×1
  • facts-publish.main (cognitive 43) web/scripts/facts-publish.mjs:555 — facts-publish.main has cognitive complexity 43 (threshold 15). Drivers by points: if/else 20 (33 pts), ternaries 3 (6 pts), boolean chains 4 (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 · codewhale_command_contract · ×1
  • codewhale_command_contract::metrics::build_groups (cognitive 42) crates/command-contract/src/metrics.rs:141 — codewhale_command_contract::metrics::build_groups has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (38 pts), match/switch 1 (2 pts), boolean chains 1, 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 · SseTransport · ×1
  • SseTransport::run_sse_loop (cognitive 42) crates/tui/src/mcp/sse.rs:83 — SseTransport::run_sse_loop has cognitive complexity 42 (threshold 15). Drivers by points: if/else 8 (22 pts), match/switch 6 (14 pts), loops 3 (6 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 · check-persistence-backlog-budget.validate_receipt (cognitive 42) · ×1
  • check-persistence-backlog-budget.validate_receipt (cognitive 42) scripts/check-persistence-backlog-budget.py:158 — check-persistence-backlog-budget.validate_receipt has cognitive complexity 42 (threshold 15). Drivers by points: if/else 23 (28 pts), boolean chains 7, loops 5 (7 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · schema.validateEvent (cognitive 42) · ×1
  • schema.validateEvent (cognitive 42) REDACTED:440 — schema.validateEvent has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (33 pts), boolean chains 6, loops 1 (2 pts), match/switch 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · validateSurvivalContract (cognitive 42) · ×1
  • validateSurvivalContract (cognitive 42) crates/tui/src/compaction/validate_survival_contract.mjs:128 — validateSurvivalContract has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 7 (9 pts), boolean chains 7, other 5, ternaries 2 (nesting depth added 9). Of this number, 28 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 · create.openApplication (cognitive 42) · ×1
  • create.openApplication (cognitive 42) crates/tui/plugins/computer-use/src/backends/darwin.mjs:724 — create.openApplication has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (23 pts), ternaries 7 (9 pts), boolean chains 4, error handling 2 (4 pts), other 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 · check-command-migration-manifest.validate_const_atom (cognitive 41) · ×1
  • check-command-migration-manifest.validate_const_atom (cognitive 41) scripts/check-command-migration-manifest.py:92 — check-command-migration-manifest.validate_const_atom has cognitive complexity 41 (threshold 15). Drivers by points: if/else 18 (33 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 · count_lines.analyse_file (cognitive 41) · ×1
  • count_lines.analyse_file (cognitive 41) scripts/split/count_lines.py:173 — count_lines.analyse_file has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (26 pts), loops 5 (9 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · module_graph.build_report (cognitive 41) · ×1
  • module_graph.build_report (cognitive 41) scripts/split/module_graph.py:516 — module_graph.build_report has cognitive complexity 41 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 9 (17 pts), boolean chains 5 (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 · batchSteps (cognitive 41) · ×1
  • batchSteps (cognitive 41) crates/tui/plugins/computer-use/mcp/server.mjs:544 — batchSteps has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 18, ternaries 2, loops 1, other 1 (nesting depth added 3). Most of this is not in the body itself: 2 of the 41 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 548, 550, 565, …). 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 · catalog_models_dev.seed_lock_report (cognitive 40) · ×1
  • catalog_models_dev.seed_lock_report (cognitive 40) scripts/catalog_models_dev.py:768 — catalog_models_dev.seed_lock_report has cognitive complexity 40 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 8, loops 6 (8 pts), ternaries 3 (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 · contributor-wall.refresh (cognitive 40) · ×1
  • contributor-wall.refresh (cognitive 40) scripts/contributor-wall.py:75 — contributor-wall.refresh has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 11 (13 pts), boolean chains 5, 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 · count_lines.summarise (cognitive 40) · ×1
  • count_lines.summarise (cognitive 40) scripts/split/count_lines.py:323 — count_lines.summarise has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 5 (11 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · dot-field.projectDotField (cognitive 40) · ×1
  • dot-field.projectDotField (cognitive 40) pet/src/core/dot-field.ts:53 — dot-field.projectDotField has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 13 (25 pts), if/else 3 (7 pts), boolean chains 4, match/switch 1 (3 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 · createBrowser · ×1
  • createBrowser::start (cognitive 40) crates/tui/plugins/computer-use/src/browser-cdp.mjs:443 — createBrowser::start has cognitive complexity 40 (threshold 15). Drivers by points: if/else 15 (27 pts), error handling 2 (6 pts), boolean chains 4, loops 1 (2 pts), ternaries 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · qr.penalty (cognitive 39) · ×1
  • qr.penalty (cognitive 39) integrations/weixin-bridge/src/qr.mjs:305 — qr.penalty has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (27 pts), loops 11 (17 pts), ternaries 2 (8 pts), boolean chains 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. This shape REPEATS in the file: one other method here (qr.penalty::scanForFinderLike) 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 · schema.validateBatch (cognitive 39) · ×1
  • schema.validateBatch (cognitive 39) REDACTED:545 — schema.validateBatch has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (25 pts), boolean chains 10, 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 · merch-interest.MerchInterest (cognitive 39) · ×1
  • merch-interest.MerchInterest (cognitive 39) web/components/merch-interest.tsx:11 — merch-interest.MerchInterest has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 10 (22 pts), if/else 10 (11 pts), boolean chains 5, error handling 1 (nesting depth added 13). Most of this is not in the body itself: 11 of the 39 points are its own statements and the rest belongs to 7 function items inside it that branch (join, a function literal at line 70, a function literal at line 34, …). 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 · cloud-facts.verifyEnvelope (cognitive 39) · ×1
  • cloud-facts.verifyEnvelope (cognitive 39) web/lib/cloud-facts.ts:187 — cloud-facts.verifyEnvelope has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 10, ternaries 3 (6 pts), error handling 3 (4 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 · validate-crate-publish-order.validate_order (cognitive 38) · ×1
  • validate-crate-publish-order.validate_order (cognitive 38) scripts/release/validate-crate-publish-order.py:81 — validate-crate-publish-order.validate_order has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (27 pts), boolean chains 6, loops 3 (5 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pet-recorder.createPetRecorder (cognitive 38) · ×1
  • pet-recorder.createPetRecorder (cognitive 38) pet/scripts/lib/pet-recorder.mjs:50 — pet-recorder.createPetRecorder has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (25 pts), boolean chains 7, loops 2 (4 pts), error handling 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 · parseProviderDescriptors (cognitive 38) · ×1
  • parseProviderDescriptors (cognitive 38) web/lib/provider-descriptors.mjs:2 — parseProviderDescriptors has cognitive complexity 38 (threshold 15). Drivers by points: boolean chains 22, if/else 8 (11 pts), other 2, error handling 1, loops 1, ternaries 1 (nesting depth added 3). Of this number, 36 points are the body's own statements and 2 belong to 6 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 · validateReleaseZip (cognitive 38) · ×1
  • validateReleaseZip (cognitive 38) crates/tui/plugins/computer-use/app/updates.mjs:46 — validateReleaseZip has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 13, error handling 1 (2 pts), 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 · codewhale_cloud_facts · ×1
  • codewhale_cloud_facts::refresh_using (cognitive 37) crates/cloud-facts/src/lib.rs:698 — codewhale_cloud_facts::refresh_using has cognitive complexity 37 (threshold 15). Drivers by points: if/else 17 (31 pts), match/switch 3 (4 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check-runtime-contract-budget.check_fragment_caps (cognitive 37) · ×1
  • check-runtime-contract-budget.check_fragment_caps (cognitive 37) scripts/check-runtime-contract-budget.py:462 — check-runtime-contract-budget.check_fragment_caps has cognitive complexity 37 (threshold 15). Drivers by points: if/else 22 (30 pts), loops 3, boolean chains 2, 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 · create.recordingStart (cognitive 37) · ×1
  • create.recordingStart (cognitive 37) crates/tui/plugins/computer-use/src/backends/darwin.mjs:574 — create.recordingStart has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 7, other 6, error handling 2 (3 pts), ternaries 2 (3 pts), loops 1 (nesting depth added 7). Of this number, 28 points are the body's own statements and 9 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 · PetSharedHost.start (cognitive 36) · ×1
  • PetSharedHost.start (cognitive 36) pet/swift/PetShared.swift:117 — PetSharedHost.start has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (25 pts), ternaries 2 (6 pts), boolean chains 2, error handling 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 · darwin.create.open_application (cognitive 36) · ×1
  • darwin.create.open_application (cognitive 36) crates/tui/plugins/computer-use/src/backends/darwin.mjs:724 — darwin.create.open_application has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (23 pts), ternaries 5 (7 pts), boolean chains 4, 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 · runtime_mobile.html.noteTurnUsage (cognitive 36) · ×1
  • runtime_mobile.html.noteTurnUsage (cognitive 36) crates/tui/src/runtime_mobile.html:609 — runtime_mobile.html.noteTurnUsage has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 19, if/else 12 (17 pts) (nesting depth added 5). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · compiled-hosts.parseCatalog (cognitive 36) · ×1
  • compiled-hosts.parseCatalog (cognitive 36) npm/codewhale/scripts/compiled-hosts.js:38 — compiled-hosts.parseCatalog has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 9, loops 2 (3 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 · (anonymous) (cognitive 36) · ×1
  • (anonymous) (cognitive 36) crates/tui/plugins/computer-use/app/daemon.mjs:87 — (anonymous) has cognitive complexity 36 (threshold 15). Drivers by points: error handling 5 (14 pts), if/else 9 (14 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 17). Of this number, 29 points are the body's own statements and 7 belong to 11 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 · activatedControl (cognitive 36) · ×1
  • activatedControl (cognitive 36) crates/tui/plugins/computer-use/mcp/server.mjs:928 — activatedControl has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 10, if/else 7 (10 pts), other 6, ternaries 4 (6 pts), error handling 2 (3 pts), loops 1 (nesting depth added 6). Of this number, 34 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LoadSkillTool · ×1
  • LoadSkillTool::execute (cognitive 35) crates/tui/src/tools/skill.rs:75 — LoadSkillTool::execute has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (30 pts), boolean chains 2, loops 1 (2 pts), match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check-contributor-credit.main (cognitive 35) · ×1
  • check-contributor-credit.main (cognitive 35) scripts/check-contributor-credit.py:90 — check-contributor-credit.main has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 4 (7 pts), ternaries 3 (7 pts), boolean chains 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.
D2 · Cognitive Complexity · check-media-assets.main (cognitive 35) · ×1
  • check-media-assets.main (cognitive 35) scripts/media/check-media-assets.py:110 — check-media-assets.main has cognitive complexity 35 (threshold 15). Drivers by points: if/else 20 (26 pts), ternaries 2 (5 pts), boolean chains 2, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PetSharedHabitat.body (cognitive 35) · ×1
  • PetSharedHabitat.body (cognitive 35) pet/swift/PetShared.swift:204 — PetSharedHabitat.body has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 8, ternaries 7 (8 pts), loops 3 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · install.withRetry (cognitive 35) · ×1
  • install.withRetry (cognitive 35) REDACTED:937 — install.withRetry has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 10, error handling 1 (2 pts), ternaries 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · highlight.tokenize (cognitive 35) · ×1
  • highlight.tokenize (cognitive 35) web/components/ratatui/highlight.tsx:12 — highlight.tokenize has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (20 pts), ternaries 3 (7 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 16). Of this number, 34 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · handleLine (cognitive 35) · ×1
  • handleLine (cognitive 35) crates/tui/plugins/computer-use/mcp/server.mjs:1887 — handleLine has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (23 pts), ternaries 2 (5 pts), boolean chains 4, other 2, 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 · create.native (cognitive 35) · ×1
  • create.native (cognitive 35) crates/tui/plugins/computer-use/src/backends/darwin.mjs:269 — create.native has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 13, ternaries 2 (4 pts), error handling 1 (2 pts), other 2 (nesting depth added 6). Of this number, 34 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 · WorkspaceFile · ×1
  • WorkspaceFile::open_confined (cognitive 34) crates/tui/src/fleet/files.rs:97 — WorkspaceFile::open_confined has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (29 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowRunJournal · ×1
  • WorkflowRunJournal::hydrate_runs (cognitive 34) crates/tui/src/tools/workflow/journal.rs:196 — WorkflowRunJournal::hydrate_runs has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 4 (6 pts), match/switch 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 · check_orcarouter_contract.main (cognitive 34) · ×1
  • check_orcarouter_contract.main (cognitive 34) scripts/check_orcarouter_contract.py:86 — check_orcarouter_contract.main has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 5 (9 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 · partition_report.strongly_connected (cognitive 34) · ×1
  • partition_report.strongly_connected (cognitive 34) scripts/split/partition_report.py:136 — partition_report.strongly_connected has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (24 pts), loops 4 (10 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 · ProviderDashboardRow · ×1
  • ProviderDashboardRow::from_config_with_provider_id (cognitive 33) crates/tui/src/tui/provider_picker.rs:557 — ProviderDashboardRow::from_config_with_provider_id has cognitive complexity 33 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 9, match/switch 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 · FleetRosterView · ×1
  • FleetRosterView::render_body (cognitive 33) crates/tui/src/tui/views/fleet_roster.rs:546 — FleetRosterView::render_body has cognitive complexity 33 (threshold 15). Drivers by points: if/else 18 (27 pts), boolean chains 5, 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 · WorkflowPlan · ×1
  • WorkflowPlan::from_config (cognitive 33) crates/workflow/src/lib.rs:359 — WorkflowPlan::from_config has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 7 (12 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 · check-blocking-calls-budget._test_module_edges (cognitive 33) · ×1
  • check-blocking-calls-budget._test_module_edges (cognitive 33) scripts/check-blocking-calls-budget.py:266 — check-blocking-calls-budget._test_module_edges has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 5, ternaries 2 (4 pts), loops 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · markdown.renderMarkdown (cognitive 33) · ×1
  • markdown.renderMarkdown (cognitive 33) REDACTED:16 — markdown.renderMarkdown has cognitive complexity 33 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 4 (9 pts), ternaries 2 (7 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 · ingest.fromOTLP (cognitive 33) · ×1
  • ingest.fromOTLP (cognitive 33) pet/src/core/ingest.ts:162 — ingest.fromOTLP has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 4 (9 pts), loops 4 (6 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 · findBrowserApp (cognitive 33) · ×1
  • findBrowserApp (cognitive 33) crates/tui/plugins/computer-use/src/browser-cdp.mjs:59 — findBrowserApp has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 6 (13 pts), boolean chains 1, other 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 · create.screenshot (cognitive 33) · ×1
  • create.screenshot (cognitive 33) crates/tui/plugins/computer-use/src/backends/darwin.mjs:466 — create.screenshot has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (12 pts), other 10, boolean chains 6, ternaries 5 (nesting depth added 2). Of this number, 31 points are the body's own statements and 2 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 · CronField · ×1
  • CronField::parse (cognitive 32) crates/tui/src/automation_manager.rs:884 — CronField::parse has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (29 pts), 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 · CommandContextBundle · ×1
  • CommandContextBundle::contexts (cognitive 32) crates/tui/src/commands/contract.rs:4730 — CommandContextBundle::contexts has cognitive complexity 32 (threshold 15). Drivers by points: if/else 32. 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 · ExecAgentEvents · ×1
  • ExecAgentEvents::next (cognitive 32) crates/tui/src/exec_agent.rs:113 — ExecAgentEvents::next has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (19 pts), match/switch 3 (7 pts), boolean chains 5, 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 · PluginInstallSource · ×1
  • PluginInstallSource::parse (cognitive 32) crates/tui/src/plugins/install/mod.rs:114 — PluginInstallSource::parse has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 7, match/switch 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 · ClientParser · ×1
  • ClientParser::feed (cognitive 32) crates/tui/src/runtime_api/computer_display.rs:636 — ClientParser::feed has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 2 (4 pts), match/switch 2 (4 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check-persistence-backlog-budget.validate_budget (cognitive 32) · ×1
  • check-persistence-backlog-budget.validate_budget (cognitive 32) scripts/check-persistence-backlog-budget.py:264 — check-persistence-backlog-budget.validate_budget has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 8, loops 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 · darwin.create.native (cognitive 32) · ×1
  • darwin.create.native (cognitive 32) crates/tui/plugins/computer-use/src/backends/darwin.mjs:269 — darwin.create.native has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 11, ternaries 2 (5 pts), error handling 1 (2 pts) (nesting depth added 7). Of this number, 31 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 · runtime_mobile.html.eventText (cognitive 32) · ×1
  • runtime_mobile.html.eventText (cognitive 32) crates/tui/src/runtime_mobile.html:570 — runtime_mobile.html.eventText has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 17, if/else 14 (15 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 · index.streamTurnEvents (cognitive 32) · ×1
  • index.streamTurnEvents (cognitive 32) integrations/weixin-bridge/src/index.mjs:766 — index.streamTurnEvents has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (26 pts), boolean chains 5, loops 1 (nesting depth added 14). Of this number, 27 points are the body's own statements and 5 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 · whale-live.WhaleLive (cognitive 32) · ×1
  • whale-live.WhaleLive (cognitive 32) web/components/whale-live.tsx:38 — whale-live.WhaleLive has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18 (20 pts), boolean chains 8, ternaries 4 (nesting depth added 2). Most of this is not in the body itself: 2 of the 32 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 65, 91, 131, …). 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 · createStreamConnector.connectStream (cognitive 32) · ×1
  • createStreamConnector.connectStream (cognitive 32) crates/tui/src/runtime_web/app.mjs:553 — createStreamConnector.connectStream has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 10, error handling 2, loops 1, ternaries 1 (nesting depth added 3). Most of this is not in the body itself: 13 of the 32 points are its own statements and the rest belongs to 10 function items inside it that branch (onerror, a function literal at line 562, onopen, …). 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 · catalog_models_dev.render_seed (cognitive 31) · ×1
  • catalog_models_dev.render_seed (cognitive 31) scripts/catalog_models_dev.py:935 — catalog_models_dev.render_seed has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 4 (6 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 · app.applySnapshot (cognitive 31) · ×1
  • app.applySnapshot (cognitive 31) crates/tui/src/runtime_web/app.mjs:56 — app.applySnapshot has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 5 (10 pts), boolean chains 5, loops 5 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · chat.readPayloadUserInput (cognitive 31) · ×1
  • chat.readPayloadUserInput (cognitive 31) extensions/vscode/src/chat.ts:868 — chat.readPayloadUserInput has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 9 (18 pts), if/else 5 (9 pts), boolean chains 4 (nesting depth added 13). Most of this is not in the body itself: 7 of the 31 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 882, 899). 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 · index.startChatRecovery (cognitive 31) · ×1
  • index.startChatRecovery (cognitive 31) integrations/weixin-bridge/src/index.mjs:806 — index.startChatRecovery has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (26 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 16). Most of this is not in the body itself: 2 of the 31 points are its own statements and the rest belongs to one function literal inside it that branches (line 808). 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 · Connection · ×1
  • Connection::project (cognitive 30) crates/tui/src/tui/pet_watch/runtime.rs:185 — Connection::project has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 6 (12 pts), boolean chains 2 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · braille-mark.eye_hole (cognitive 30) · ×1
  • braille-mark.eye_hole (cognitive 30) scripts/brand/braille-mark.py:231 — braille-mark.eye_hole has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 4 (10 pts), boolean chains 4 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check-provider-registry.report_antigravity_public_contract (cognitive 30) · ×1
  • check-provider-registry.report_antigravity_public_contract (cognitive 30) scripts/check-provider-registry.py:274 — check-provider-registry.report_antigravity_public_contract has cognitive complexity 30 (threshold 15). Drivers by points: if/else 17 (22 pts), loops 3 (4 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · interest.handleAdminMerchInterest (cognitive 30) · ×1
  • interest.handleAdminMerchInterest (cognitive 30) web/lib/merch/interest.ts:143 — interest.handleAdminMerchInterest has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 8, ternaries 2 (4 pts), error handling 2 (3 pts) (nesting depth added 9). Of this number, 19 points are the body's own statements and 11 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 · ExploringCell · ×1
  • ExploringCell::render_with_locale (cognitive 29) crates/tui/src/tui/history.rs:1543 — ExploringCell::render_with_locale has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (20 pts), match/switch 3 (7 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 · harness._parse_stream_receipt (cognitive 29) · ×1
  • harness._parse_stream_receipt (cognitive 29) integrations/verifiers-codewhale/codewhale_harness/harness.py:345 — harness._parse_stream_receipt has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 4, error handling 1 (2 pts), loops 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · catalog_models_dev.validate_reviewed (cognitive 29) · ×1
  • catalog_models_dev.validate_reviewed (cognitive 29) scripts/catalog_models_dev.py:896 — catalog_models_dev.validate_reviewed has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 8, loops 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 · carve.parse_items (cognitive 29) · ×1
  • carve.parse_items (cognitive 29) scripts/split/carve.py:34 — carve.parse_items has cognitive complexity 29 (threshold 15). Drivers by points: if/else 4 (11 pts), ternaries 4 (7 pts), loops 3 (6 pts), boolean chains 5 (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 · Preflight.includes (cognitive 29) · ×1
  • Preflight.includes (cognitive 29) scripts/split/preflight.py:77 — Preflight.includes has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 5 (8 pts), boolean chains 2, 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 · darwin.create.recordingStart (cognitive 29) · ×1
  • darwin.create.recordingStart (cognitive 29) crates/tui/plugins/computer-use/src/backends/darwin.mjs:574 — darwin.create.recordingStart has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 7, error handling 2 (3 pts), loops 1, ternaries 1 (nesting depth added 6). Of this number, 20 points are the body's own statements and 9 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 · app.collectProviderModelPages (cognitive 29) · ×1
  • app.collectProviderModelPages (cognitive 29) crates/tui/src/runtime_web/app.mjs:811 — app.collectProviderModelPages has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 6, 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 · pet-recorder.createPetRecorder.append (cognitive 29) · ×1
  • pet-recorder.createPetRecorder.append (cognitive 29) pet/scripts/lib/pet-recorder.mjs:104 — pet-recorder.createPetRecorder.append has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 7, error handling 1 (3 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 · observeState (cognitive 29) · ×1
  • observeState (cognitive 29) crates/tui/plugins/computer-use/mcp/server.mjs:489 — observeState has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 12, ternaries 7, if/else 5, other 5. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · create.get_app_state (cognitive 29) · ×1
  • create.get_app_state (cognitive 29) crates/tui/plugins/computer-use/src/backends/darwin.mjs:912 — create.get_app_state has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 4 (8 pts), boolean chains 4, error handling 1 (2 pts), other 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 · SessionJournal · ×1
  • SessionJournal::prune_plan (cognitive 28) crates/runtime/src/session_tree.rs:381 — SessionJournal::prune_plan has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 4 (7 pts), match/switch 2 (7 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 · RuntimeOptions · ×1
  • RuntimeOptions::merge (cognitive 28) crates/tui/src/runtime_options.rs:68 — RuntimeOptions::merge has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 14, if/else 14. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CommandPaletteView · ×1
  • CommandPaletteView::render (cognitive 28) crates/tui/src/tui/command_palette.rs:879 — CommandPaletteView::render has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (18 pts), match/switch 2 (6 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoryCell · ×1
  • HistoryCell::lines_with_options_folded (cognitive 28) crates/tui/src/tui/history.rs:443 — HistoryCell::lines_with_options_folded has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 4 (7 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 · ChatView.handleStreamEvent (cognitive 28) · ×1
  • ChatView.handleStreamEvent (cognitive 28) extensions/vscode/src/chat.ts:488 — ChatView.handleStreamEvent has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 7, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · review-eval.replay (cognitive 28) · ×1
  • review-eval.replay (cognitive 28) scripts/review-eval.mjs:678 — review-eval.replay has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 15, if/else 5 (7 pts), ternaries 3, error handling 1 (2 pts), loops 1 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · operator.operatorAction (cognitive 28) · ×1
  • operator.operatorAction (cognitive 28) web/lib/merch/operator.ts:25 — operator.operatorAction has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 8, error handling 1 (2 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 · product-usage.validateEnvelope (cognitive 28) · ×1
  • product-usage.validateEnvelope (cognitive 28) web/lib/telemetry/product-usage.ts:119 — product-usage.validateEnvelope has cognitive complexity 28 (threshold 15). Drivers by points: if/else 20 (21 pts), boolean chains 6, 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 · runInputLease (cognitive 28) · ×1
  • runInputLease (cognitive 28) crates/tui/plugins/computer-use/src/exec.mjs:85 — runInputLease has cognitive complexity 28 (threshold 15). Drivers by points: error handling 5 (8 pts), if/else 6 (8 pts), boolean chains 5, ternaries 2 (3 pts), loops 2, other 2 (nesting depth added 6). Most of this is not in the body itself: 5 of the 28 points are its own statements and the rest belongs to 17 function items inside it that branch (release, send, onStdout, …). 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 · HostProcess · ×1
  • HostProcess::spawn (cognitive 27) crates/tui/src/extension_host/supervisor.rs:1424 — HostProcess::spawn has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (12 pts), match/switch 6 (9 pts), loops 4, boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RawDacl · ×1
  • RawDacl::from_storage (cognitive 27) crates/tui/src/extension_host/windows.rs:1573 — RawDacl::from_storage has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 7, 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 · PythonRuntime · ×1
  • PythonRuntime::run (cognitive 27) crates/tui/src/repl/runtime.rs:407 — PythonRuntime::run has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 5 (12 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 · Workspace · ×1
  • Workspace::browser_completion_candidates_inner (cognitive 27) crates/tui/src/working_set.rs:469 — Workspace::browser_completion_candidates_inner has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 5, loops 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Mover.run_plan (cognitive 27) · ×1
  • Mover.run_plan (cognitive 27) scripts/split/move-modules.py:299 — Mover.run_plan has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 5 (7 pts), ternaries 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 · app-script-policy.checkJxa (cognitive 27) · ×1
  • app-script-policy.checkJxa (cognitive 27) crates/tui/plugins/computer-use/src/app-script-policy.mjs:142 — app-script-policy.checkJxa has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 6 (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 · draft-claim-lock.applyDraftLock (cognitive 27) · ×1
  • draft-claim-lock.applyDraftLock (cognitive 27) web/lib/draft-claim-lock.ts:51 — draft-claim-lock.applyDraftLock has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 7, 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 · github.loadFeed (cognitive 27) · ×1
  • github.loadFeed (cognitive 27) web/lib/github.ts:206 — github.loadFeed has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 4 (6 pts), boolean chains 4, loops 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · parseModelCatalog (cognitive 27) · ×1
  • parseModelCatalog (cognitive 27) web/lib/model-catalog.mjs:3 — parseModelCatalog has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 14, if/else 3 (5 pts), ternaries 4, other 2, error handling 1, loops 1 (nesting depth added 2). Of this number, 18 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.
D2 · Cognitive Complexity · answersForUserInput (cognitive 27) · ×1
  • answersForUserInput (cognitive 27) crates/tui/src/runtime_web/app.mjs:345 — answersForUserInput has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 4 (7 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 9). Of this number, 26 points are the body's own statements and 1 belongs to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelRegistry · ×1
  • ModelRegistry::resolve (cognitive 26) crates/agent/src/lib.rs:218 — ModelRegistry::resolve has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 10 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Caller · ×1
  • Caller::check (cognitive 26) crates/tui/src/extension_host/execution.rs:116 — Caller::check has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (5 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 · ProviderLivePricingQuote · ×1
  • ProviderLivePricingQuote::pricing_for_route (cognitive 26) crates/tui/src/provider_catalog_live.rs:400 — ProviderLivePricingQuote::pricing_for_route has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 15, if/else 8 (10 pts), match/switch 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · EditFileTool · ×1
  • EditFileTool::execute (cognitive 26) REDACTED:2647 — EditFileTool::execute has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17 (18 pts), match/switch 4 (7 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · WorktreeManagerView · ×1
  • WorktreeManagerView::render_list (cognitive 26) crates/tui/src/tui/worktree_manager.rs:296 — WorktreeManagerView::render_list has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (24 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 · catalog_models_dev.stale_corrections (cognitive 26) · ×1
  • catalog_models_dev.stale_corrections (cognitive 26) scripts/catalog_models_dev.py:862 — catalog_models_dev.stale_corrections has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 6, loops 4 (5 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · preview-whale-art.render_png (cognitive 26) · ×1
  • preview-whale-art.render_png (cognitive 26) scripts/preview-whale-art.py:137 — preview-whale-art.render_png has cognitive complexity 26 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 3 (9 pts), ternaries 1 (5 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 · module_graph.collect_refs (cognitive 26) · ×1
  • module_graph.collect_refs (cognitive 26) scripts/split/module_graph.py:447 — module_graph.collect_refs has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 6 (11 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 · PetHabitatView.body (cognitive 26) · ×1
  • PetHabitatView.body (cognitive 26) pet/swift/PetHabitatView.swift:7 — PetHabitatView.body has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 2 (6 pts), loops 2 (5 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 · review-eval.grade (cognitive 26) · ×1
  • review-eval.grade (cognitive 26) scripts/review-eval.mjs:777 — review-eval.grade has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 13 (17 pts), boolean chains 6, if/else 1 (2 pts), loops 1 (nesting depth added 5). Of this number, 22 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 · mobile-menu.MobileMenu (cognitive 26) · ×1
  • mobile-menu.MobileMenu (cognitive 26) web/components/mobile-menu.tsx:11 — mobile-menu.MobileMenu has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15, boolean chains 7, loops 2, ternaries 2. Most of this is not in the body itself: 3 of the 26 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 101, a function literal at line 80, a function literal at line 50, …). 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 · render-terminal-capture.compact.rows (cognitive 26) · ×1
  • render-terminal-capture.compact.rows (cognitive 26) REDACTED:90 — render-terminal-capture.compact.rows has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 3 (5 pts), boolean chains 4, loops 1 (nesting depth added 10). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NameStakes · ×1
  • NameStakes::from_tool_name (cognitive 25) crates/tui/src/core/authority/auto_review.rs:312 — NameStakes::from_tool_name has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 10, 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 · PetSim · ×1
  • PetSim::step (cognitive 25) crates/tui/src/tui/ambient_life/pet_sim.rs:633 — PetSim::step has cognitive complexity 25 (threshold 15). Drivers by points: if/else 19 (23 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, 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 · ReviewCell · ×1
  • ReviewCell::render (cognitive 25) crates/tui/src/tui/history.rs:1786 — ReviewCell::render has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (21 pts), 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 · SessionPickerView · ×1
  • SessionPickerView::handle_key (cognitive 25) crates/tui/src/tui/session_picker.rs:945 — SessionPickerView::handle_key has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 5 (9 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 · RouterSetupView · ×1
  • RouterSetupView::render (cognitive 25) crates/tui/src/tui/views/router_setup.rs:686 — RouterSetupView::render has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 2 (4 pts), match/switch 3 (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 · PetSim.step (cognitive 25) · ×1
  • PetSim.step (cognitive 25) pet/android/PetSim.kt:299 — PetSim.step has cognitive complexity 25 (threshold 15). Drivers by points: if/else 19 (23 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, 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 · PetSharedClient.poll (cognitive 25) · ×1
  • PetSharedClient.poll (cognitive 25) pet/android/src/main/kotlin/codewhale/pet/PetSharedClient.kt:46 — PetSharedClient.poll has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15, boolean chains 10. 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-command-migration-manifest.validate_selector (cognitive 25) · ×1
  • check-command-migration-manifest.validate_selector (cognitive 25) scripts/check-command-migration-manifest.py:270 — check-command-migration-manifest.validate_selector has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 5 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check-lexicon.scan_rust (cognitive 25) · ×1
  • check-lexicon.scan_rust (cognitive 25) scripts/check-lexicon.py:322 — check-lexicon.scan_rust has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 6 (9 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check-lexicon.main (cognitive 25) · ×1
  • check-lexicon.main (cognitive 25) scripts/check-lexicon.py:357 — check-lexicon.main has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 4 (8 pts), 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 · check-windows-imports.main (cognitive 25) · ×1
  • check-windows-imports.main (cognitive 25) scripts/release/check-windows-imports.py:79 — check-windows-imports.main has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 3, error handling 2 (3 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · widen.static_prepass (cognitive 25) · ×1
  • widen.static_prepass (cognitive 25) scripts/split/widen.py:227 — widen.static_prepass has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 4 (6 pts), boolean chains 2, 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 · CodewhalePetApp.body (cognitive 25) · ×1
  • CodewhalePetApp.body (cognitive 25) pet/macos/CodewhalePetApp.swift:14 — CodewhalePetApp.body has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (14 pts), error handling 4 (8 pts), boolean chains 3 (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 · app.createStreamConnector.connectStream (cognitive 25) · ×1
  • app.createStreamConnector.connectStream (cognitive 25) crates/tui/src/runtime_web/app.mjs:553 — app.createStreamConnector.connectStream has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 10, error handling 1, loops 1, ternaries 1 (nesting depth added 3). Of this number, 16 points are the body's own statements and 9 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 · extension.activate (cognitive 25) · ×1
  • extension.activate (cognitive 25) extensions/vscode/src/extension.ts:14 — extension.activate has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 6, ternaries 2 (4 pts), error handling 3, match/switch 1 (nesting depth added 3). Most of this is not in the body itself: 2 of the 25 points are its own statements and the rest belongs to 9 function items inside it that branch (checkAndRefreshRuntime, a function literal at line 170, a function literal at line 202, …). 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 · index.main (cognitive 25) · ×1
  • index.main (cognitive 25) integrations/weixin-bridge/src/index.mjs:1387 — index.main has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (13 pts), error handling 5 (6 pts), boolean chains 3, 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 · install.prepareCompiledHost (cognitive 25) · ×1
  • install.prepareCompiledHost (cognitive 25) REDACTED:1590 — install.prepareCompiledHost has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 4, ternaries 2 (4 pts), loops 2, 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 · WireBodyView · ×1
  • WireBodyView::extract (cognitive 24) crates/tui/src/client/prepared.rs:494 — WireBodyView::extract has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 1 (3 pts), boolean chains 2, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToolActivationCache · ×1
  • ToolActivationCache::activate_inner (cognitive 24) crates/tui/src/core/session.rs:216 — ToolActivationCache::activate_inner has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 5, 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 · RuntimeEventJournal · ×1
  • RuntimeEventJournal::load (cognitive 24) crates/tui/src/remote_control.rs:449 — RuntimeEventJournal::load has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 3, loops 2 (3 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReadFileTool · ×1
  • ReadFileTool::execute_contract_read (cognitive 24) REDACTED:935 — ReadFileTool::execute_contract_read has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 3, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RlmTool · ×1
  • RlmTool::execute_eval (cognitive 24) crates/tui/src/tools/rlm.rs:467 — RlmTool::execute_eval has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14, match/switch 6 (10 pts) (nesting depth added 4). Of this number, 23 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: 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 · ShellManager · ×1
  • ShellManager::spawn_background_sandboxed (cognitive 24) crates/tui/src/tools/shell.rs:2673 — ShellManager::spawn_background_sandboxed has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16 (18 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · ShellBinding · ×1
  • ShellBinding::matches (cognitive 24) crates/tui/src/tui/shell_key_routing.rs:168 — ShellBinding::matches has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 23, match/switch 1. 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 · PetViewModel.handle (cognitive 24) · ×1
  • PetViewModel.handle (cognitive 24) pet/android/src/main/kotlin/codewhale/pet/PetViewModel.kt:261 — PetViewModel.handle has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (16 pts), error handling 3 (6 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 · CodewhaleHarness.launch (cognitive 24) · ×1
  • CodewhaleHarness.launch (cognitive 24) integrations/verifiers-codewhale/codewhale_harness/harness.py:144 — CodewhaleHarness.launch has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (20 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 · catalog_models_dev.cmd_defaults_audit (cognitive 24) · ×1
  • catalog_models_dev.cmd_defaults_audit (cognitive 24) scripts/catalog_models_dev.py:1075 — catalog_models_dev.cmd_defaults_audit has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, loops 3 (4 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check-command-config-proof.source_closure (cognitive 24) · ×1
  • check-command-config-proof.source_closure (cognitive 24) scripts/check-command-config-proof.py:57 — check-command-config-proof.source_closure has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 1 (4 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 · check-command-core-navigation-proof.source_closure (cognitive 24) · ×1
  • check-command-core-navigation-proof.source_closure (cognitive 24) scripts/check-command-core-navigation-proof.py:64 — check-command-core-navigation-proof.source_closure has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 1 (4 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 · check-command-core-navigation-proof.violations (cognitive 24) · ×1
  • check-command-core-navigation-proof.violations (cognitive 24) scripts/check-command-core-navigation-proof.py:92 — check-command-core-navigation-proof.violations has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 5, loops 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check-tui-locale-parity.main (cognitive 24) · ×1
  • check-tui-locale-parity.main (cognitive 24) scripts/check-tui-locale-parity.py:70 — check-tui-locale-parity.main has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3 (6 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 · convert-plugin.convert (cognitive 24) · ×1
  • convert-plugin.convert (cognitive 24) scripts/convert-plugin.py:391 — convert-plugin.convert has cognitive complexity 24 (threshold 15). Drivers by points: loops 7 (11 pts), boolean chains 7, if/else 4, error handling 1, ternaries 1 (nesting depth added 4). 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 · Mover.plan_manifests (cognitive 24) · ×1
  • Mover.plan_manifests (cognitive 24) scripts/split/move-modules.py:514 — Mover.plan_manifests has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 7, 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 · app-script-policy.checkAppleScript (cognitive 24) · ×1
  • app-script-policy.checkAppleScript (cognitive 24) crates/tui/plugins/computer-use/src/app-script-policy.mjs:83 — app-script-policy.checkAppleScript has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 5, 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 · app.startBrowserClient · ×1
  • app.startBrowserClient::loadNewThreadModels (cognitive 24) crates/tui/src/runtime_web/app.mjs:1999 — app.startBrowserClient::loadNewThreadModels has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 7, ternaries 3 (4 pts), loops 2, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · api.readThreadDetail (cognitive 24) · ×1
  • api.readThreadDetail (cognitive 24) extensions/vscode/src/api.ts:558 — api.readThreadDetail has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 9 (17 pts), if/else 3 (7 pts) (nesting depth added 12). Most of this is not in the body itself: 4 of the 24 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 594, 599, 562, …). 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 · index.handleCommand (cognitive 24) · ×1
  • index.handleCommand (cognitive 24) integrations/wecom-bridge/src/index.mjs:160 — index.handleCommand has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (23 pts), match/switch 1 (nesting depth added 17). 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 · SessionLifecycleAdapter · ×1
  • SessionLifecycleAdapter::tree_body (cognitive 23) crates/tui/src/commands/contract.rs:422 — SessionLifecycleAdapter::tree_body has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 3 (8 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 · UserCommandRegistry · ×1
  • UserCommandRegistry::load_from_entries (cognitive 23) crates/tui/src/commands/user_registry.rs:242 — UserCommandRegistry::load_from_entries has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 4 (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 · Reader · ×1
  • Reader::handle (cognitive 23) crates/tui/src/extension_host/supervisor.rs:2044 — Reader::handle has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 4 (9 pts), boolean chains 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · PlanState · ×1
  • PlanState::update (cognitive 23) crates/tui/src/tools/plan.rs:208 — PlanState::update has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowTally · ×1
  • WorkflowTally::from_events (cognitive 23) crates/tui/src/tools/workflow/view.rs:108 — WorkflowTally::from_events has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (17 pts), match/switch 2 (4 pts), loops 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ContextMenuView · ×1
  • ContextMenuView::render (cognitive 23) crates/tui/src/tui/context_menu.rs:505 — ContextMenuView::render has cognitive complexity 23 (threshold 15). Drivers by points: loops 6 (9 pts), if/else 4 (8 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ElevationWidget · ×1
  • ElevationWidget::render (cognitive 23) crates/tui/src/tui/widgets/mod.rs:2534 — ElevationWidget::render has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 4 (5 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check-blocking-calls-budget.main (cognitive 23) · ×1
  • check-blocking-calls-budget.main (cognitive 23) scripts/check-blocking-calls-budget.py:453 — check-blocking-calls-budget.main has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 6 (10 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_mobile.html.openThreadEvents (cognitive 23) · ×1
  • runtime_mobile.html.openThreadEvents (cognitive 23) crates/tui/src/runtime_mobile.html:854 — runtime_mobile.html.openThreadEvents has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 5, error handling 2 (3 pts), loops 1, ternaries 1 (nesting depth added 6). Most of this is not in the body itself: 5 of the 23 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 887, 900, 919, …). 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 · opencode-chat2responses-proxy.chatToResponses (cognitive 23) · ×1
  • opencode-chat2responses-proxy.chatToResponses (cognitive 23) scripts/opencode-chat2responses-proxy.mjs:40 — opencode-chat2responses-proxy.chatToResponses has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 3 (7 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 · opencode-chat2responses-proxy.server (cognitive 23) · ×1
  • opencode-chat2responses-proxy.server (cognitive 23) scripts/opencode-chat2responses-proxy.mjs:128 — opencode-chat2responses-proxy.server has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, loops 2 (3 pts), ternaries 2 (3 pts), error handling 1 (nesting depth added 6). Most of this is not in the body itself: 4 of the 23 points are its own statements and the rest belongs to one function literal inside it that branches (line 141). 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 · verify-release-inventory.assertInventory (cognitive 23) · ×1
  • verify-release-inventory.assertInventory (cognitive 23) scripts/release/verify-release-inventory.js:78 — verify-release-inventory.assertInventory has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 5, 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 · inputOwnerCheck (cognitive 23) · ×1
  • inputOwnerCheck (cognitive 23) crates/tui/plugins/computer-use/mcp/server.mjs:877 — inputOwnerCheck has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 3 (6 pts), boolean chains 3, other 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 · readLease (cognitive 23) · ×1
  • readLease (cognitive 23) crates/tui/plugins/computer-use/src/lease.mjs:33 — readLease has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, other 5, error handling 2, 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 · CatalogCorrections · ×1
  • CatalogCorrections::validate (cognitive 22) crates/config/src/catalog/corrections.rs:83 — CatalogCorrections::validate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (12 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 · codewhale_models · ×1
  • codewhale_models::explicit_context_window_hint (cognitive 22) crates/models/src/lib.rs:415 — codewhale_models::explicit_context_window_hint has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 6, loops 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 · FleetLedger · ×1
  • FleetLedger::compact_with_snapshot_hook (cognitive 22) crates/tui/src/fleet/ledger.rs:1627 — FleetLedger::compact_with_snapshot_hook has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 11 (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 · LlmError · ×1
  • LlmError::from_http_response_with_retry_hints (cognitive 22) crates/tui/src/llm_client/mod.rs:494 — LlmError::from_http_response_with_retry_hints has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 7, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · RuntimeChatRelayHost · ×1
  • RuntimeChatRelayHost::apply_prompt (cognitive 22) crates/tui/src/runtime_chat_relay.rs:596 — RuntimeChatRelayHost::apply_prompt has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 5, match/switch 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 · SkillRootCatalog · ×1
  • SkillRootCatalog::runtime_directories (cognitive 22) crates/tui/src/skills/roots.rs:279 — SkillRootCatalog::runtime_directories has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentsCoordinateTool · ×1
  • AgentsCoordinateTool::mutate_coordination (cognitive 22) crates/tui/src/tools/subagent/coord.rs:1137 — AgentsCoordinateTool::mutate_coordination has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 2, loops 1 (2 pts), match/switch 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 · LiveTranscriptOverlay · ×1
  • LiveTranscriptOverlay::flatten (cognitive 22) crates/tui/src/tui/live_transcript.rs:291 — LiveTranscriptOverlay::flatten has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (3 pts), match/switch 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · convert-plugin.remote_server (cognitive 22) · ×1
  • convert-plugin.remote_server (cognitive 22) scripts/convert-plugin.py:228 — convert-plugin.remote_server has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 8, ternaries 3 (6 pts), if/else 4, error handling 2 (3 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · module_graph.strip_cfg_test (cognitive 22) · ×1
  • module_graph.strip_cfg_test (cognitive 22) scripts/split/module_graph.py:203 — module_graph.strip_cfg_test has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (5 pts), boolean chains 3, ternaries 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 · lib.parseQuestionAnswers (cognitive 22) · ×1
  • lib.parseQuestionAnswers (cognitive 22) integrations/weixin-bridge/src/lib.mjs:189 — lib.parseQuestionAnswers has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 6, if/else 5 (6 pts), ternaries 4 (6 pts), loops 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 · install.ensureBinary (cognitive 22) · ×1
  • install.ensureBinary (cognitive 22) REDACTED:1511 — install.ensureBinary has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 6, ternaries 2, 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 · review.target (cognitive 22) · ×1
  • review.target (cognitive 22) REDACTED:56 — review.target has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (16 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 · verify-release-inventory.run (cognitive 22) · ×1
  • verify-release-inventory.run (cognitive 22) scripts/release/verify-release-inventory.js:137 — verify-release-inventory.run has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 6, ternaries 3, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · (anonymous) (cognitive 22) · ×1
  • (anonymous) (cognitive 22) workflows/operate_best_of_n.workflow.js:11 — (anonymous) has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 12 (16 pts), other 4, boolean chains 1, loops 1 (nesting depth added 4). Of this number, 14 points are the body's own statements and 8 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 · prepareArgs (cognitive 22) · ×1
  • prepareArgs (cognitive 22) crates/tui/plugins/computer-use/mcp/server.mjs:1618 — prepareArgs has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 6, ternaries 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 · openAppSession (cognitive 22) · ×1
  • openAppSession (cognitive 22) crates/tui/plugins/computer-use/src/app-socket.mjs:132 — openAppSession has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (4 pts), boolean chains 3, other 3, error handling 1 (2 pts) (nesting depth added 8). Most of this is not in the body itself: 7 of the 22 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 140, 146, 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 · StateStore · ×1
  • StateStore::migrate_schema (cognitive 21) crates/state/src/lib.rs:366 — StateStore::migrate_schema has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (19 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RepoConstitution · ×1
  • RepoConstitution::render_block (cognitive 21) crates/tui/src/project_context/constitution.rs:208 — RepoConstitution::render_block has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 4 (8 pts), match/switch 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 · ReasoningEffort · ×1
  • ReasoningEffort::normalize_for_route_identity (cognitive 21) crates/tui/src/reasoning_preference.rs:248 — ReasoningEffort::normalize_for_route_identity has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (10 pts), match/switch 5 (9 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · DeliveryEvidence · ×1
  • DeliveryEvidence::changed_paths (cognitive 21) crates/tui/src/tools/subagent/delivery.rs:220 — DeliveryEvidence::changed_paths has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 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 · SlotLedger · ×1
  • SlotLedger::classify (cognitive 21) crates/tui/src/tools/workflow/mod.rs:1040 — SlotLedger::classify has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · FileMutationReceipt · ×1
  • FileMutationReceipt::from_success (cognitive 21) crates/tui/src/tui/history/file_mutation.rs:54 — FileMutationReceipt::from_success has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (4 pts), match/switch 1 (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 · Worker · ×1
  • Worker::start (cognitive 21) crates/tui/src/tui/work_surface/terminal.rs:119 — Worker::start has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 6 (18 pts), if/else 1 (2 pts), loops 1 (nesting depth added 13). 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 · WorkingSet · ×1
  • WorkingSet::append_resident_file_contents (cognitive 21) crates/tui/src/working_set.rs:1148 — WorkingSet::append_resident_file_contents has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 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 · convert-plugin.skill_files (cognitive 21) · ×1
  • convert-plugin.skill_files (cognitive 21) scripts/convert-plugin.py:146 — convert-plugin.skill_files has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 7, loops 2 (5 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 · convert-plugin.server_options (cognitive 21) · ×1
  • convert-plugin.server_options (cognitive 21) scripts/convert-plugin.py:204 — convert-plugin.server_options has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 2 (4 pts), loops 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · count_lines.item_end (cognitive 21) · ×1
  • count_lines.item_end (cognitive 21) scripts/split/count_lines.py:142 — count_lines.item_end has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · module_graph.resolve_root_names (cognitive 21) · ×1
  • module_graph.resolve_root_names (cognitive 21) scripts/split/module_graph.py:346 — module_graph.resolve_root_names has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 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 · Mover.changes (cognitive 21) · ×1
  • Mover.changes (cognitive 21) scripts/split/move-modules.py:588 — Mover.changes has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 4 (5 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 · reexports.flatten_groups_impl (cognitive 21) · ×1
  • reexports.flatten_groups_impl (cognitive 21) scripts/split/reexports.py:22 — reexports.flatten_groups_impl has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 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 · widen.main (cognitive 21) · ×1
  • widen.main (cognitive 21) scripts/split/widen.py:335 — widen.main has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (6 pts), loops 4 (6 pts), boolean chains 4, ternaries 2 (4 pts), error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · app.workflowReceiptPresentation (cognitive 21) · ×1
  • app.workflowReceiptPresentation (cognitive 21) crates/tui/src/runtime_web/app.mjs:457 — app.workflowReceiptPresentation has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 6 (9 pts), boolean chains 8, if/else 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 · changelog-lib.parseChangelog (cognitive 21) · ×1
  • changelog-lib.parseChangelog (cognitive 21) web/scripts/changelog-lib.mjs:42 — changelog-lib.parseChangelog has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 3, 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 · RuntimeChatPrompt · ×1
  • RuntimeChatPrompt::validate_shape (cognitive 20) crates/tui/src/runtime_chat_relay.rs:1219 — RuntimeChatPrompt::validate_shape has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 7 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Run · ×1
  • Run::repair_store (cognitive 20) crates/tui/src/session_reconcile.rs:709 — Run::repair_store has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 5 (7 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 · BoundedOutputAccumulator · ×1
  • BoundedOutputAccumulator::snapshot (cognitive 20) crates/tui/src/tools/shell/output.rs:268 — BoundedOutputAccumulator::snapshot has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (17 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 · catalog_models_dev.build_seed_lock (cognitive 20) · ×1
  • catalog_models_dev.build_seed_lock (cognitive 20) scripts/catalog_models_dev.py:720 — catalog_models_dev.build_seed_lock has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (12 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 · catalog_models_dev.newer_stable_rows (cognitive 20) · ×1
  • catalog_models_dev.newer_stable_rows (cognitive 20) scripts/catalog_models_dev.py:1047 — catalog_models_dev.newer_stable_rows has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 4, 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 · check-command-migration-manifest._selector_type_to_text (cognitive 20) · ×1
  • check-command-migration-manifest._selector_type_to_text (cognitive 20) scripts/check-command-migration-manifest.py:1052 — check-command-migration-manifest._selector_type_to_text has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9, ternaries 4 (9 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check-runtime-contract-budget.validate_identity_structure (cognitive 20) · ×1
  • check-runtime-contract-budget.validate_identity_structure (cognitive 20) scripts/check-runtime-contract-budget.py:212 — check-runtime-contract-budget.validate_identity_structure has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 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 · Mover.plan_moves (cognitive 20) · ×1
  • Mover.plan_moves (cognitive 20) scripts/split/move-modules.py:267 — Mover.plan_moves has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (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 · widen.find_field (cognitive 20) · ×1
  • widen.find_field (cognitive 20) scripts/split/widen.py:143 — widen.find_field has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (13 pts), loops 3 (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 · darwin.create.screenshot (cognitive 20) · ×1
  • darwin.create.screenshot (cognitive 20) crates/tui/plugins/computer-use/src/backends/darwin.mjs:466 — darwin.create.screenshot has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 6, ternaries 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · darwin.create.get_app_state (cognitive 20) · ×1
  • darwin.create.get_app_state (cognitive 20) crates/tui/plugins/computer-use/src/backends/darwin.mjs:912 — darwin.create.get_app_state has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, error handling 1 (2 pts), ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · prepare-local-release-assets.main (cognitive 20) · ×1
  • prepare-local-release-assets.main (cognitive 20) scripts/release/prepare-local-release-assets.js:23 — prepare-local-release-assets.main has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (5 pts), boolean chains 4, ternaries 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · compare-deployed-facts.main (cognitive 20) · ×1
  • compare-deployed-facts.main (cognitive 20) web/scripts/compare-deployed-facts.mjs:100 — compare-deployed-facts.main has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, ternaries 2 (3 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 · shutdown (cognitive 20) · ×1
  • shutdown (cognitive 20) crates/tui/plugins/computer-use/mcp/server.mjs:1847 — shutdown has cognitive complexity 20 (threshold 15). Drivers by points: error handling 5 (11 pts), if/else 2 (3 pts), boolean chains 2, loops 2, other 2 (nesting depth added 7). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1857, 1862, 1864). 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 · register (cognitive 20) · ×1
  • register (cognitive 20) crates/tui/plugins/computer-use/src/registry.mjs:91 — register has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, other 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.
D2 · Cognitive Complexity · DaemonSocket · ×1
  • DaemonSocket::serve (cognitive 19) crates/app-server/src/daemon_windows.rs:143 — DaemonSocket::serve has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), match/switch 2 (5 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 · BoundedLines · ×1
  • BoundedLines::next_line (cognitive 19) crates/app-server/src/lib.rs:784 — BoundedLines::next_line has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (17 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 · JsonObjectSpans · ×1
  • JsonObjectSpans::next (cognitive 19) crates/config/src/user_constitution.rs:1277 — JsonObjectSpans::next has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codewhale_localization · ×1
  • codewhale_localization::parse_locale (cognitive 19) crates/localization/src/lib.rs:5680 — codewhale_localization::parse_locale has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 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 · McpOAuthRuntime · ×1
  • McpOAuthRuntime::refresh_and_persist (cognitive 19) crates/tui/src/mcp/oauth.rs:733 — McpOAuthRuntime::refresh_and_persist has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 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 · AnchoredDirectory · ×1
  • AnchoredDirectory::open (cognitive 19) crates/tui/src/tools/github/report.rs:486 — AnchoredDirectory::open has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 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 · SetupWizardView · ×1
  • SetupWizardView::handle_key (cognitive 19) crates/tui/src/tui/setup/mod.rs:3063 — SetupWizardView::handle_key has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 7, match/switch 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 · TerminalInputPump · ×1
  • TerminalInputPump::spawn_parts (cognitive 19) crates/tui/src/tui/ui/terminal_input.rs:177 — TerminalInputPump::spawn_parts has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (13 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AutomationsView · ×1
  • AutomationsView::handle_mouse (cognitive 19) crates/tui/src/tui/views/automations.rs:729 — AutomationsView::handle_mouse has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · build-lock.main (cognitive 19) · ×1
  • build-lock.main (cognitive 19) scripts/build-lock.py:30 — build-lock.main has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (5 pts), boolean chains 4, loops 3 (4 pts), ternaries 3 (4 pts), 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 · catalog_models_dev.refresh_openrouter (cognitive 19) · ×1
  • catalog_models_dev.refresh_openrouter (cognitive 19) scripts/catalog_models_dev.py:255 — catalog_models_dev.refresh_openrouter has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, 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 · check-runtime-contract-budget.main (cognitive 19) · ×1
  • check-runtime-contract-budget.main (cognitive 19) scripts/check-runtime-contract-budget.py:639 — check-runtime-contract-budget.main has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (8 pts), error handling 3 (4 pts), loops 2 (4 pts), boolean chains 2, ternaries 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · compiled-host-native-receipt.extract (cognitive 19) · ×1
  • compiled-host-native-receipt.extract (cognitive 19) scripts/compiled-host-native-receipt.py:53 — compiled-host-native-receipt.extract has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 3, boolean chains 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 · convert-plugin.mcp_config (cognitive 19) · ×1
  • convert-plugin.mcp_config (cognitive 19) scripts/convert-plugin.py:340 — convert-plugin.mcp_config has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · module_graph.compare (cognitive 19) · ×1
  • module_graph.compare (cognitive 19) scripts/split/module_graph.py:596 — module_graph.compare has cognitive complexity 19 (threshold 15). Drivers by points: loops 4 (9 pts), if/else 2 (6 pts), ternaries 1 (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 · move-modules.split_groups (cognitive 19) · ×1
  • move-modules.split_groups (cognitive 19) scripts/split/move-modules.py:104 — move-modules.split_groups has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (17 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 · partition_report.analyse (cognitive 19) · ×1
  • partition_report.analyse (cognitive 19) scripts/split/partition_report.py:51 — partition_report.analyse has cognitive complexity 19 (threshold 15). Drivers by points: loops 6 (7 pts), ternaries 3 (6 pts), if/else 2 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodewhalePetMobileApp.body (cognitive 19) · ×1
  • CodewhalePetMobileApp.body (cognitive 19) pet/ios/CodewhalePetApp.swift:14 — CodewhalePetMobileApp.body has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 5 (6 pts), boolean chains 1, match/switch 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 · PetAudioOutput.present (cognitive 19) · ×1
  • PetAudioOutput.present (cognitive 19) pet/swift/PetAudioOutput.swift:35 — PetAudioOutput.present has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, 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 · PetNativeCore.init (cognitive 19) · ×1
  • PetNativeCore.init (cognitive 19) pet/swift/PetNativeCore.swift:30 — PetNativeCore.init has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatView.openFileAtPath (cognitive 19) · ×1
  • ChatView.openFileAtPath (cognitive 19) extensions/vscode/src/chat.ts:415 — ChatView.openFileAtPath has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 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 · qr.buildCodewords (cognitive 19) · ×1
  • qr.buildCodewords (cognitive 19) integrations/weixin-bridge/src/qr.mjs:124 — qr.buildCodewords has cognitive complexity 19 (threshold 15). Drivers by points: loops 11 (15 pts), if/else 1 (3 pts), ternaries 1 (nesting depth added 6). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · index.reconcileAdmission (cognitive 19) · ×1
  • index.reconcileAdmission (cognitive 19) integrations/weixin-bridge/src/index.mjs:503 — index.reconcileAdmission has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · index.reconcileSnapshot (cognitive 19) · ×1
  • index.reconcileSnapshot (cognitive 19) integrations/weixin-bridge/src/index.mjs:707 — index.reconcileSnapshot has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 8, loops 2 (nesting depth added 1). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 717, 712, 714). 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 · ingest.redact (cognitive 19) · ×1
  • ingest.redact (cognitive 19) pet/src/core/ingest.ts:18 — ingest.redact has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6, ternaries 2 (3 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · review-eval.matchCase (cognitive 19) · ×1
  • review-eval.matchCase (cognitive 19) scripts/review-eval.mjs:754 — review-eval.matchCase has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (12 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 · contributor-merch.ContributorMerch (cognitive 19) · ×1
  • contributor-merch.ContributorMerch (cognitive 19) web/components/contributor-merch.tsx:16 — contributor-merch.ContributorMerch has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 11 (12 pts), boolean chains 5, if/else 2 (nesting depth added 1). Of this number, 10 points are the body's own statements and 9 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 · community-agent.listDrafts (cognitive 19) · ×1
  • community-agent.listDrafts (cognitive 19) web/lib/community-agent.ts:779 — community-agent.listDrafts has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (6 pts), ternaries 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · content-watch.validateDriftFindings (cognitive 19) · ×1
  • content-watch.validateDriftFindings (cognitive 19) web/lib/content-watch.ts:266 — content-watch.validateDriftFindings has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 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 · create.invokeMenu (cognitive 19) · ×1
  • create.invokeMenu (cognitive 19) crates/tui/plugins/computer-use/src/backends/darwin.mjs:787 — create.invokeMenu has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 2 (5 pts), boolean chains 3, other 2, loops 1 (nesting depth added 6). Of this number, 18 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 · codewhale_agent · ×1
  • codewhale_agent::model_family (cognitive 18) crates/agent/src/lib.rs:405 — codewhale_agent::model_family has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11, boolean chains 7. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · TmuxRuntime · ×1
  • TmuxRuntime::start (cognitive 18) crates/lane/src/runtime.rs:688 — TmuxRuntime::start has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ApprovalReplay · ×1
  • ApprovalReplay::from_receipts (cognitive 18) crates/tui/src/approval_log.rs:343 — ApprovalReplay::from_receipts has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HooksConfig · ×1
  • HooksConfig::load_with_project_and_plugins (cognitive 18) crates/tui/src/hooks/config.rs:469 — HooksConfig::load_with_project_and_plugins has cognitive complexity 18 (threshold 15). Drivers by points: loops 3 (8 pts), match/switch 3 (8 pts), if/else 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 · HookContext · ×1
  • HookContext::to_env_vars (cognitive 18) crates/tui/src/hooks/executor.rs:366 — HookContext::to_env_vars has cognitive complexity 18 (threshold 15). Drivers by points: if/else 17, boolean chains 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · BrokerSession · ×1
  • BrokerSession::spawn (cognitive 18) crates/tui/src/mcp/process_broker.rs:90 — BrokerSession::spawn has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (12 pts), loops 3 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · EventSoundPolicy · ×1
  • EventSoundPolicy::decide_configured (cognitive 18) crates/tui/src/notify/sound_policy.rs:85 — EventSoundPolicy::decide_configured has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GoalState · ×1
  • GoalState::sync_from_host_status_with_reason (cognitive 18) crates/tui/src/tools/goal.rs:170 — GoalState::sync_from_host_status_with_reason has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AgentTool · ×1
  • AgentTool::execute (cognitive 18) crates/tui/src/tools/subagent/mod.rs:11857 — AgentTool::execute has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 3 (7 pts), match/switch 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 · Avatars · ×1
  • Avatars::refresh (cognitive 18) crates/tui/src/tui/pet_watch/avatars.rs:41 — Avatars::refresh has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExtensionsSnapshot · ×1
  • ExtensionsSnapshot::with_recommended_actions (cognitive 18) crates/tui/src/tui/views/extensions.rs:335 — ExtensionsSnapshot::with_recommended_actions has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 3 (8 pts), if/else 5 (7 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 · EvidenceRef · ×1
  • EvidenceRef::new (cognitive 18) crates/tui/src/work_graph/model.rs:504 — EvidenceRef::new has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PetActivityKt.Controls (cognitive 18) · ×1
  • PetActivityKt.Controls (cognitive 18) pet/android/src/main/kotlin/codewhale/pet/PetActivity.kt:157 — PetActivityKt.Controls has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16 (17 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 · check-blocking-calls-budget.module_file_scopes (cognitive 18) · ×1
  • check-blocking-calls-budget.module_file_scopes (cognitive 18) scripts/check-blocking-calls-budget.py:392 — check-blocking-calls-budget.module_file_scopes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 5 (7 pts), 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 · check-lexicon.scan_ts (cognitive 18) · ×1
  • check-lexicon.scan_ts (cognitive 18) scripts/check-lexicon.py:139 — check-lexicon.scan_ts has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 3 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check-runtime-contract-budget.compare (cognitive 18) · ×1
  • check-runtime-contract-budget.compare (cognitive 18) scripts/check-runtime-contract-budget.py:319 — check-runtime-contract-budget.compare has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 2, boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check-windows-imports.parse_imports (cognitive 18) · ×1
  • check-windows-imports.parse_imports (cognitive 18) scripts/release/check-windows-imports.py:46 — check-windows-imports.parse_imports has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 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 · closure_report.main (cognitive 18) · ×1
  • closure_report.main (cognitive 18) scripts/split/closure_report.py:72 — closure_report.main has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 pts), loops 5 (6 pts), ternaries 1 (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 · move-modules.rewrite_moved (cognitive 18) · ×1
  • move-modules.rewrite_moved (cognitive 18) scripts/split/move-modules.py:195 — move-modules.rewrite_moved has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 5 (6 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 · widen.unused_import_suggestions (cognitive 18) · ×1
  • widen.unused_import_suggestions (cognitive 18) scripts/split/widen.py:195 — widen.unused_import_suggestions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PetSharedFrame.validate (cognitive 18) · ×1
  • PetSharedFrame.validate (cognitive 18) pet/swift/PetShared.swift:42 — PetSharedFrame.validate has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 17, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · PetSim.step (cognitive 18) · ×1
  • PetSim.step (cognitive 18) pet/swift/PetSim.swift:314 — PetSim.step has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 7 (8 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 · qr.renderQrToText (cognitive 18) · ×1
  • qr.renderQrToText (cognitive 18) integrations/weixin-bridge/src/qr.mjs:461 — qr.renderQrToText has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 3 (6 pts), loops 2 (3 pts), boolean chains 2 (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 · pet.draw (cognitive 18) · ×1
  • pet.draw (cognitive 18) pet/src/ui/pet.ts:140 — pet.draw has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3 (4 pts), boolean chains 2, 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 · pet.get('follow').onclick (cognitive 18) · ×1
  • pet.get('follow').onclick (cognitive 18) pet/src/ui/pet.ts:231 — pet.get('follow').onclick has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 3, error handling 2 (nesting depth added 2). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to one function item inside it that branches (poll). 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 · cnb-github-checkrun.main (cognitive 18) · ×1
  • cnb-github-checkrun.main (cognitive 18) scripts/ci/cnb-github-checkrun.mjs:90 — cnb-github-checkrun.main has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 7, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · review.settings (cognitive 18) · ×1
  • review.settings (cognitive 18) REDACTED:33 — review.settings has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 6, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · fetch-compiled-host-proof.fetchProof (cognitive 18) · ×1
  • fetch-compiled-host-proof.fetchProof (cognitive 18) scripts/release/fetch-compiled-host-proof.js:9 — fetch-compiled-host-proof.fetchProof has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 8. Of this number, 11 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 · review-eval.claimsFromStructured (cognitive 18) · ×1
  • review-eval.claimsFromStructured (cognitive 18) scripts/review-eval.mjs:485 — review-eval.claimsFromStructured has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (12 pts), boolean chains 3, loops 2, if/else 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 · report-active-installs.formatReport (cognitive 18) · ×1
  • report-active-installs.formatReport (cognitive 18) telemetry-ingest/scripts/report-active-installs.mjs:150 — report-active-installs.formatReport has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 6 (7 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 · admin-client.AdminClient (cognitive 18) · ×1
  • admin-client.AdminClient (cognitive 18) web/app/[locale]/admin/admin-client.tsx:13 — admin-client.AdminClient has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, ternaries 3, error handling 1 (nesting depth added 4). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to 4 function items inside it that branch (handleAction, startEdit, a function literal at line 71, …). 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 · bounded-body.readBoundedBody (cognitive 18) · ×1
  • bounded-body.readBoundedBody (cognitive 18) web/lib/bounded-body.ts:9 — bounded-body.readBoundedBody has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 3 (4 pts), loops 2, ternaries 1 (2 pts) (nesting depth added 6). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch 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-agent-tasks.generatePrReview (cognitive 18) · ×1
  • community-agent-tasks.generatePrReview (cognitive 18) web/lib/community-agent-tasks.ts:154 — community-agent-tasks.generatePrReview has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (7 pts), error handling 3 (6 pts), ternaries 2 (4 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · community-agent.getPostOutcomeUnknown (cognitive 18) · ×1
  • community-agent.getPostOutcomeUnknown (cognitive 18) web/lib/community-agent.ts:585 — community-agent.getPostOutcomeUnknown has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · content-watch.runSemanticDrift (cognitive 18) · ×1
  • content-watch.runSemanticDrift (cognitive 18) web/lib/content-watch.ts:287 — content-watch.runSemanticDrift has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 5, ternaries 2 (3 pts), error handling 2, loops 1 (nesting depth added 3). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · learning.getGuidance (cognitive 18) · ×1
  • learning.getGuidance (cognitive 18) web/lib/ratatui/learning.ts:180 — learning.getGuidance has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (9 pts), if/else 5, boolean chains 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · gt-site.check (cognitive 18) · ×1
  • gt-site.check (cognitive 18) web/scripts/gt-site.mjs:216 — gt-site.check 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 · operate_best_of_n.workflow.default (cognitive 18) · ×1
  • operate_best_of_n.workflow.default (cognitive 18) workflows/operate_best_of_n.workflow.js:11 — operate_best_of_n.workflow.default has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 12 (16 pts), boolean chains 1, loops 1 (nesting depth added 4). Of this number, 10 points are the body's own statements and 8 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 · handleStoredAction (cognitive 18) · ×1
  • handleStoredAction (cognitive 18) integrations/telegram-bridge/src/index.mjs:346 — handleStoredAction has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 2 (5 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 8). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · validateWaitArgs (cognitive 18) · ×1
  • validateWaitArgs (cognitive 18) crates/tui/plugins/computer-use/mcp/server.mjs:640 — validateWaitArgs has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, if/else 7, other 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 · create.pointerClick (cognitive 18) · ×1
  • create.pointerClick (cognitive 18) crates/tui/plugins/computer-use/src/backends/darwin.mjs:407 — create.pointerClick has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (4 pts), other 3, 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 · ExecPolicyConfig · ×1
  • ExecPolicyConfig::evaluate (cognitive 17) crates/execpolicy/src/toml_rules.rs:58 — ExecPolicyConfig::evaluate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 4 (6 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ColorDepth · ×1
  • ColorDepth::detect_with (cognitive 17) crates/palette/src/adapt.rs:647 — ColorDepth::detect_with has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · CapturedRlmCaller · ×1
  • CapturedRlmCaller::dispatch_admitted (cognitive 17) crates/tui/src/core/engine/rlm_host.rs:221 — CapturedRlmCaller::dispatch_admitted has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), match/switch 4 (5 pts), boolean chains 2, loops 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · McpServer · ×1
  • McpServer::handle_message (cognitive 17) crates/tui/src/mcp_server.rs:192 — McpServer::handle_message has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, match/switch 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 · CodemodeInvoker · ×1
  • CodemodeInvoker::execute (cognitive 17) crates/tui/src/tools/codemode.rs:774 — CodemodeInvoker::execute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), match/switch 4 (5 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · WriteFileTool · ×1
  • WriteFileTool::execute (cognitive 17) REDACTED:1819 — WriteFileTool::execute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15 (16 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 · UpdateGoalTool · ×1
  • UpdateGoalTool::execute (cognitive 17) crates/tui/src/tools/goal.rs:1197 — UpdateGoalTool::execute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UserInputRequest · ×1
  • UserInputRequest::validate_with_limits (cognitive 17) crates/tui/src/tools/user_input.rs:152 — UserInputRequest::validate_with_limits has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FilePickerView · ×1
  • FilePickerView::render (cognitive 17) crates/tui/src/tui/file_picker.rs:627 — FilePickerView::render has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 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 · HotbarSetupView · ×1
  • HotbarSetupView::handle_key (cognitive 17) crates/tui/src/tui/hotbar/setup.rs:788 — HotbarSetupView::handle_key has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 3 (5 pts), match/switch 2 (3 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 · UserInputView · ×1
  • UserInputView::render (cognitive 17) crates/tui/src/tui/user_input.rs:457 — UserInputView::render has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 1, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · WorkRuntime · ×1
  • WorkRuntime::restore_internal (cognitive 17) crates/tui/src/work_graph/runtime.rs:671 — WorkRuntime::restore_internal has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 7, match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · check-crate-sizes.main (cognitive 17) · ×1
  • check-crate-sizes.main (cognitive 17) scripts/release/check-crate-sizes.py:31 — check-crate-sizes.main has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 3, 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 · carve.main (cognitive 17) · ×1
  • carve.main (cognitive 17) scripts/split/carve.py:315 — carve.main has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (4 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Mover.sweep (cognitive 17) · ×1
  • Mover.sweep (cognitive 17) scripts/split/move-modules.py:394 — Mover.sweep has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 5 (6 pts), 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 · partition_report.scc_edges (cognitive 17) · ×1
  • partition_report.scc_edges (cognitive 17) scripts/split/partition_report.py:112 — partition_report.scc_edges has cognitive complexity 17 (threshold 15). Drivers by points: loops 5 (9 pts), if/else 3 (7 pts), boolean chains 1 (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · tools.parseGrant (cognitive 17) · ×1
  • tools.parseGrant (cognitive 17) crates/tui/plugins/computer-use/src/tools.mjs:645 — tools.parseGrant has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 3 (7 pts), boolean chains 2, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · transport.installRemoteAgent (cognitive 17) · ×1
  • transport.installRemoteAgent (cognitive 17) crates/tui/plugins/computer-use/src/transport.mjs:273 — transport.installRemoteAgent has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (6 pts), ternaries 2 (6 pts), loops 3 (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 · darwin.create.invokeMenu (cognitive 17) · ×1
  • darwin.create.invokeMenu (cognitive 17) crates/tui/plugins/computer-use/src/backends/darwin.mjs:787 — darwin.create.invokeMenu has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 2 (5 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 · darwin.create.app_script (cognitive 17) · ×1
  • darwin.create.app_script (cognitive 17) crates/tui/plugins/computer-use/src/backends/darwin.mjs:845 — darwin.create.app_script has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, ternaries 2 (3 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · index.pollTelegram (cognitive 17) · ×1
  • index.pollTelegram (cognitive 17) integrations/telegram-bridge/src/index.mjs:126 — index.pollTelegram has cognitive complexity 17 (threshold 15). Drivers by points: if/else 2 (7 pts), error handling 2 (5 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 · ingest.categoryFor (cognitive 17) · ×1
  • ingest.categoryFor (cognitive 17) pet/src/core/ingest.ts:78 — ingest.categoryFor has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, boolean chains 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · review.run (cognitive 17) · ×1
  • review.run (cognitive 17) REDACTED:124 — review.run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 3, error handling 2, ternaries 2 (nesting depth added 1). Of this number, 15 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: 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 · connection-banner.ConnectionBanner (cognitive 17) · ×1
  • connection-banner.ConnectionBanner (cognitive 17) web/components/connection-banner.tsx:23 — connection-banner.ConnectionBanner has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, ternaries 5, boolean chains 3, error handling 1. Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 81, 40, 63, …). 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 · cloud-facts.resolveCloudFacts (cognitive 17) · ×1
  • cloud-facts.resolveCloudFacts (cognitive 17) web/lib/cloud-facts.ts:300 — cloud-facts.resolveCloudFacts has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), error handling 2 (3 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · handleInbound (cognitive 17) · ×1
  • handleInbound (cognitive 17) integrations/weixin-bridge/src/index.mjs:1188 — handleInbound 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 · acquireStateLock (cognitive 17) · ×1
  • acquireStateLock (cognitive 17) integrations/weixin-bridge/src/index.mjs:1354 — acquireStateLock has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), error handling 3 (7 pts), boolean chains 1, loops 1 (nesting depth added 9). Of this number, 13 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 · connectPipeSocket (cognitive 17) · ×1
  • connectPipeSocket (cognitive 17) crates/tui/plugins/computer-use/src/browser-cdp.mjs:145 — connectPipeSocket has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), error handling 1 (3 pts), loops 2, other 2, ternaries 1 (2 pts) (nesting depth added 5). None of this is in the body itself: all 17 points belong to 11 function items inside it that branch (a function literal at line 164, a function literal at line 177, (anonymous)::emit, …). 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 · run (cognitive 17) · ×1
  • run (cognitive 17) crates/tui/plugins/computer-use/src/exec.mjs:25 — run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5, ternaries 5, other 4, error handling 3. Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 11 function items inside it that branch (a function literal at line 30, (anonymous)::finish, (anonymous)::terminate, …). 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 · redactCall (cognitive 17) · ×1
  • redactCall (cognitive 17) crates/tui/plugins/computer-use/src/trajectory.mjs:41 — redactCall has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (6 pts), boolean chains 4, if/else 3 (4 pts), other 2, loops 1 (nesting depth added 4). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 2 function items inside it that branch (scrub, a function literal at line 50). 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 · create.appScript (cognitive 17) · ×1
  • create.appScript (cognitive 17) crates/tui/plugins/computer-use/src/backends/darwin.mjs:845 — create.appScript has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, ternaries 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WriterState · ×1
  • WriterState::run (cognitive 16) crates/hooks/src/lifecycle_outbox.rs:310 — WriterState::run has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (9 pts), if/else 2 (4 pts), match/switch 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 · ControlReceipt · ×1
  • ControlReceipt::render (cognitive 16) crates/lane/src/control.rs:1327 — ControlReceipt::render has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), loops 2 (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 · FleetDenialGuard · ×1
  • FleetDenialGuard::observe (cognitive 16) crates/tui/src/core/engine/dispatch.rs:142 — FleetDenialGuard::observe has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · CapturedRuntimeFrontend · ×1
  • CapturedRuntimeFrontend::serve (cognitive 16) crates/tui/src/runtime_api.rs:677 — CapturedRuntimeFrontend::serve has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), match/switch 4 (5 pts), boolean chains 3 (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 · AppHotbarAction · ×1
  • AppHotbarAction::dispatch (cognitive 16) crates/tui/src/tui/hotbar/actions.rs:1008 — AppHotbarAction::dispatch has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 1 (nesting depth added 5). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · LaunchResumeConfirmView · ×1
  • LaunchResumeConfirmView::render (cognitive 16) crates/tui/src/tui/launch_resume_confirm.rs:133 — LaunchResumeConfirmView::render has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 1, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SkillsManagerView · ×1
  • SkillsManagerView::emit_action (cognitive 16) crates/tui/src/tui/views/skills_manager.rs:202 — SkillsManagerView::emit_action has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), match/switch 4 (7 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · harness._bounded_terminal (cognitive 16) · ×1
  • harness._bounded_terminal (cognitive 16) integrations/verifiers-codewhale/codewhale_harness/harness.py:255 — harness._bounded_terminal has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 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 · catalog_models_dev.project_fields (cognitive 16) · ×1
  • catalog_models_dev.project_fields (cognitive 16) scripts/catalog_models_dev.py:534 — catalog_models_dev.project_fields has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (14 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 · PetHabitatStore.write (cognitive 16) · ×1
  • PetHabitatStore.write (cognitive 16) pet/swift/PetHabitatStore.swift:66 — PetHabitatStore.write has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PetHost.suspend (cognitive 16) · ×1
  • PetHost.suspend (cognitive 16) pet/swift/PetHost.swift:57 — PetHost.suspend has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 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 · main.swift.top-level code (cognitive 16) · ×1
  • main.swift.top-level code (cognitive 16) pet/swift/main.swift:62 — main.swift.top-level code has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 2 (4 pts), ternaries 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 · updates.prepareUpdate (cognitive 16) · ×1
  • updates.prepareUpdate (cognitive 16) crates/tui/plugins/computer-use/app/updates.mjs:80 — updates.prepareUpdate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, error handling 1, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · darwin.create.nativeHelper (cognitive 16) · ×1
  • darwin.create.nativeHelper (cognitive 16) crates/tui/plugins/computer-use/src/backends/darwin.mjs:235 — darwin.create.nativeHelper has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · darwin.create.scroll (cognitive 16) · ×1
  • darwin.create.scroll (cognitive 16) crates/tui/plugins/computer-use/src/backends/darwin.mjs:1055 — darwin.create.scroll has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (8 pts), if/else 4 (7 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 · qr.placeData (cognitive 16) · ×1
  • qr.placeData (cognitive 16) integrations/weixin-bridge/src/qr.mjs:254 — qr.placeData has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 3 (6 pts), ternaries 1 (3 pts) (nesting depth added 9). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · qr.penalty · ×1
  • qr.penalty::scanForFinderLike (cognitive 16) integrations/weixin-bridge/src/qr.mjs:341 — qr.penalty::scanForFinderLike has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 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. This shape REPEATS in the file: one other method here (qr.penalty) 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 · install.isRetryable (cognitive 16) · ×1
  • install.isRetryable (cognitive 16) REDACTED:874 — install.isRetryable has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, boolean chains 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · pet.get<HTMLInputElement>('file').onchange (cognitive 16) · ×1
  • pet.get<HTMLInputElement>('file').onchange (cognitive 16) pet/src/ui/pet.ts:193 — pet.get<HTMLInputElement>('file').onchange has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, error handling 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · review.classify (cognitive 16) · ×1
  • review.classify (cognitive 16) REDACTED:89 — review.classify has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 5, if/else 4 (5 pts), ternaries 3 (4 pts), error handling 1, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · review-eval.addedLineSet (cognitive 16) · ×1
  • review-eval.addedLineSet (cognitive 16) scripts/review-eval.mjs:122 — review-eval.addedLineSet 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 · check-docs.main (cognitive 16) · ×1
  • check-docs.main (cognitive 16) REDACTED:110 — check-docs.main has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 2 (5 pts), boolean chains 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 · createOcean · ×1
  • createOcean::step (cognitive 16) crates/tui/src/integrations/dsh/scene.js:173 — createOcean::step has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · handleCallbackQuery (cognitive 16) · ×1
  • handleCallbackQuery (cognitive 16) integrations/telegram-bridge/src/index.mjs:275 — handleCallbackQuery has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 5, ternaries 4, 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 · resolveAppIdentity (cognitive 16) · ×1
  • resolveAppIdentity (cognitive 16) crates/tui/plugins/computer-use/mcp/server.mjs:754 — resolveAppIdentity has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, other 6, if/else 2, error handling 1, ternaries 1. Of this number, 9 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · create.nativeHelper (cognitive 16) · ×1
  • create.nativeHelper (cognitive 16) crates/tui/plugins/computer-use/src/backends/darwin.mjs:235 — create.nativeHelper has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (4 members, 21 shared lines) · ×1
  • Near-duplicate member family (4 members, 21 shared lines) crates/tui/src/fleet/ledger.rs:803 — crates/tui/src/fleet/ledger.rs:803-836 | crates/tui/src/fleet/ledger.rs:851-895 | crates/tui/src/fleet/ledger.rs:909-942 | crates/tui/src/fleet/ledger.rs:1025-1069 — These 4 members are variants of one another: a block of 21 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member pair (468 shared lines) · ×1
  • Near-duplicate member pair (468 shared lines) crates/tui/src/tui/widgets/mod.rs:179 — crates/tui/src/tui/widgets/mod.rs:179-731 | crates/tui/src/tui/widgets/transcript_legacy.rs:130-638 — These two members are variants of one another: 468 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (56 shared lines) · ×1
  • Near-duplicate member pair (56 shared lines) crates/tui/src/plugins/install/tarball.rs:133 — crates/tui/src/plugins/install/tarball.rs:133-228 | crates/tui/src/skills/install.rs:1506-1623 — These two members are variants of one another: 56 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (47 shared lines) · ×1
  • Near-duplicate member pair (47 shared lines) crates/config/src/private_directory.rs:1158 — crates/config/src/private_directory.rs:1158-1229 | crates/tui/src/tools/github/report.rs:1219-1288 — These two members are variants of one another: 47 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (40 shared lines) · ×1
  • Near-duplicate member pair (40 shared lines) crates/cli/src/metrics.rs:472 — crates/cli/src/metrics.rs:472-671 | crates/cli/src/metrics.rs:902-987 — These two members are variants of one another: 40 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (34 shared lines) · ×1
  • Near-duplicate member pair (34 shared lines) crates/tui/src/tools/automation.rs:162 — crates/tui/src/tools/automation.rs:162-255 | crates/tui/src/tools/tasks.rs:219-332 — These two members are variants of one another: 34 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Edited copy of a member (224 corresponding lines) · ×1
  • Edited copy of a member (224 corresponding lines) crates/tui/src/tui/widgets/approval_band_legacy.rs:79 — crates/tui/src/tui/widgets/approval_band_legacy.rs:79-342 | crates/tui/src/tui/widgets/mod.rs:1605-1832 — These two members are one piece of code written twice and then edited apart: 224 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (62 corresponding lines) · ×1
  • Edited copy of a member (62 corresponding lines) crates/tui/src/tui/widgets/mod.rs:877 — crates/tui/src/tui/widgets/mod.rs:877-952 | crates/tui/src/tui/widgets/transcript_legacy.rs:757-819 — These two members are one piece of code written twice and then edited apart: 62 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (31 corresponding lines) · ×1
  • Edited copy of a member (31 corresponding lines) crates/tui/src/core/engine/tool_catalog.rs:1653 — crates/tui/src/core/engine/tool_catalog.rs:1653-1695 | crates/tui/src/tools/js_execution.rs:151-198 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (24 corresponding lines) · ×1
  • Edited copy of a member (24 corresponding lines) crates/tui/src/tools/verifier.rs:393 — crates/tui/src/tools/verifier.rs:393-516 | crates/tui/src/tools/verifier.rs:522-579 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (36 corresponding lines) · ×1
  • Edited copy of a member (36 corresponding lines) crates/tui/src/tui/history/latex_render.rs:1335 — crates/tui/src/tui/history/latex_render.rs:1335-1381 | crates/tui/src/tui/history/latex_render.rs:1383-1418 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (10 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (10 members, 50+ identical tokens) crates/tui/src/tools/web_search.rs:722 — crates/tui/src/tools/web_search.rs:722-823 | crates/tui/src/tools/web_search.rs:833-904 | crates/tui/src/tools/web_search.rs:914-998 | crates/tui/src/tools/web_search.rs:1007-1091 | crates/tui/src/tools/web_search.rs:1102-1179 | crates/tui/src/tools/web_search.rs:1187-1239 | crates/tui/src/tools/web_search.rs:1248-1335 | crates/tui/src/tools/web_search.rs:1345-1442 | crates/tui/src/tools/web_search.rs:1451-1545 | crates/tui/src/tools/web_search.rs:1554-1699 — These 10 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 10 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 10 times.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (6 members, 50+ identical tokens) crates/tui/src/automation_manager.rs:1672 — crates/tui/src/automation_manager.rs:1672-1748 | crates/tui/src/runtime_threads.rs:3670-3705 | crates/tui/src/runtime_threads.rs:3717-3740 | crates/tui/src/runtime_threads.rs:3742-3797 | crates/tui/src/runtime_threads.rs:3890-3933 | crates/tui/src/runtime_threads.rs:4137-4252 — 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 (193 lines × 2) · ×1
  • Duplicated block (193 lines × 2) crates/tui/src/tui/widgets/mod.rs:287 — crates/tui/src/tui/widgets/mod.rs:287-479 | crates/tui/src/tui/widgets/transcript_legacy.rs:225-417 — before extracting anything, compare `crates/tui/src/tui/widgets/mod.rs` and `crates/tui/src/tui/widgets/transcript_legacy.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 778 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (153–157 lines × 2) · ×1
  • Duplicated block (153–157 lines × 2) crates/tui/src/tui/widgets/mod.rs:481 — crates/tui/src/tui/widgets/mod.rs:481-637 | crates/tui/src/tui/widgets/transcript_legacy.rs:419-571 — before extracting anything, compare `crates/tui/src/tui/widgets/mod.rs` and `crates/tui/src/tui/widgets/transcript_legacy.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 778 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (123 lines × 2) · ×1
  • Duplicated block (123 lines × 2) crates/tui/src/tui/widgets/approval_band_legacy.rs:125 — crates/tui/src/tui/widgets/approval_band_legacy.rs:125-247 | crates/tui/src/tui/widgets/mod.rs:1650-1772 — before extracting anything, compare `crates/tui/src/tui/widgets/approval_band_legacy.rs` and `crates/tui/src/tui/widgets/mod.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (71 lines × 2) · ×1
  • Duplicated block (71 lines × 2) crates/tui/src/tui/widgets/mod.rs:180 — crates/tui/src/tui/widgets/mod.rs:180-250 | crates/tui/src/tui/widgets/transcript_legacy.rs:131-201 — before extracting anything, compare `crates/tui/src/tui/widgets/mod.rs` and `crates/tui/src/tui/widgets/transcript_legacy.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 778 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (51–61 lines × 2) · ×1
  • Duplicated block (51–61 lines × 2) crates/tui/src/tui/widgets/mod.rs:878 — crates/tui/src/tui/widgets/mod.rs:878-938 | crates/tui/src/tui/widgets/transcript_legacy.rs:758-808 — before extracting anything, compare `crates/tui/src/tui/widgets/mod.rs` and `crates/tui/src/tui/widgets/transcript_legacy.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 778 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (58 lines × 2) · ×1
  • Duplicated block (58 lines × 2) crates/protocol/src/event_msg.rs:946 — crates/protocol/src/event_msg.rs:946-1003 | crates/protocol/src/event_msg.rs:1007-1064 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (50 lines × 2) · ×1
  • Duplicated block (50 lines × 2) crates/tui/src/tui/widgets/mod.rs:1039 — crates/tui/src/tui/widgets/mod.rs:1039-1088 | crates/tui/src/tui/widgets/transcript_legacy.rs:959-1008 — before extracting anything, compare `crates/tui/src/tui/widgets/mod.rs` and `crates/tui/src/tui/widgets/transcript_legacy.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 778 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (42 lines × 2) · ×1
  • Duplicated block (42 lines × 2) crates/tui/src/fleet/scheduler.rs:159 — crates/tui/src/fleet/scheduler.rs:159-200 | crates/tui/src/fleet/scheduler.rs:268-309 — both copies are in the same file, so extract the 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 (40–41 lines × 2) · ×1
  • Duplicated block (40–41 lines × 2) crates/tui/src/tui/session_picker.rs:1141 — crates/tui/src/tui/session_picker.rs:1141-1180 | crates/tui/src/tui/session_picker.rs:1216-1256 — both copies are in the same file, so extract the 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 (37–40 lines × 2) · ×1
  • Duplicated block (37–40 lines × 2) crates/config/src/xai_credentials.rs:395 — crates/config/src/xai_credentials.rs:395-434 | crates/config/src/xai_credentials.rs:453-489 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (39 lines × 2) · ×1
  • Duplicated block (39 lines × 2) crates/tui/src/tui/widgets/approval_band_legacy.rs:1115 — crates/tui/src/tui/widgets/approval_band_legacy.rs:1115-1153 | crates/tui/src/tui/widgets/mod.rs:2244-2282 — before extracting anything, compare `crates/tui/src/tui/widgets/approval_band_legacy.rs` and `crates/tui/src/tui/widgets/mod.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (38 lines × 2) · ×1
  • Duplicated block (38 lines × 2) crates/tui/src/tui/widgets/approval_band_legacy.rs:1008 — crates/tui/src/tui/widgets/approval_band_legacy.rs:1008-1045 | crates/tui/src/tui/widgets/mod.rs:2137-2174 — before extracting anything, compare `crates/tui/src/tui/widgets/approval_band_legacy.rs` and `crates/tui/src/tui/widgets/mod.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (36–37 lines × 2) · ×1
  • Duplicated block (36–37 lines × 2) crates/tui/src/tools/git.rs:456 — crates/tui/src/tools/git.rs:456-492 | crates/tui/src/tools/git_history.rs:663-698 — before extracting anything, compare `crates/tui/src/tools/git.rs` and `crates/tui/src/tools/git_history.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (29–35 lines × 2) · ×1
  • Duplicated block (29–35 lines × 2) crates/tui/src/fleet/control.rs:94 — crates/tui/src/fleet/control.rs:94-122 | crates/tui/src/runtime_api.rs:5047-5081 — before extracting anything, compare `crates/tui/src/fleet/control.rs` and `crates/tui/src/runtime_api.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 84 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 (35 lines × 2) · ×1
  • Duplicated block (35 lines × 2) crates/tui/src/tui/widgets/approval_band_legacy.rs:248 — crates/tui/src/tui/widgets/approval_band_legacy.rs:248-282 | crates/tui/src/tui/widgets/mod.rs:1773-1807 — before extracting anything, compare `crates/tui/src/tui/widgets/approval_band_legacy.rs` and `crates/tui/src/tui/widgets/mod.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (34 lines × 2) · ×1
  • Duplicated block (34 lines × 2) crates/tui/src/runtime_threads.rs:3750 — crates/tui/src/runtime_threads.rs:3750-3783 | crates/tui/src/runtime_threads.rs:4160-4193 — both copies are in the same file, so extract the 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–34 lines × 2) · ×1
  • Duplicated block (29–34 lines × 2) crates/tui/src/runtime_threads.rs:18797 — crates/tui/src/runtime_threads.rs:18797-18830 | crates/tui/src/runtime_threads.rs:18901-18929 — both copies are in the same file, so extract the 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 (32–33 lines × 2) · ×1
  • Duplicated block (32–33 lines × 2) crates/tui/src/client/anthropic.rs:366 — crates/tui/src/client/anthropic.rs:366-397 | crates/tui/src/client/responses.rs:269-301 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (29–33 lines × 2) · ×1
  • Duplicated block (29–33 lines × 2) crates/tui/src/runtime_threads.rs:8962 — crates/tui/src/runtime_threads.rs:8962-8994 | crates/tui/src/runtime_threads.rs:9007-9035 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (31–33 lines × 2) · ×1
  • Duplicated block (31–33 lines × 2) crates/tui/src/tui/history/latex_render.rs:286 — crates/tui/src/tui/history/latex_render.rs:286-318 | crates/tui/src/tui/history/latex_render.rs:344-374 — both copies are in the same file, so extract the 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–32 lines × 2) · ×1
  • Duplicated block (26–32 lines × 2) crates/tui/src/client.rs:5534 — crates/tui/src/client.rs:5534-5565 | crates/tui/src/client.rs:5612-5637 — both copies are in the same file, so extract the 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 (32 lines × 2) · ×1
  • Duplicated block (32 lines × 2) crates/tui/src/tui/widgets/approval_band_legacy.rs:1055 — crates/tui/src/tui/widgets/approval_band_legacy.rs:1055-1086 | crates/tui/src/tui/widgets/mod.rs:2184-2215 — before extracting anything, compare `crates/tui/src/tui/widgets/approval_band_legacy.rs` and `crates/tui/src/tui/widgets/mod.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (31 lines × 2) · ×1
  • Duplicated block (31 lines × 2) crates/config/src/lib.rs:4836 — crates/config/src/lib.rs:4836-4866 | crates/tui/src/config.rs:9052-9082 — before extracting anything, compare `crates/config/src/lib.rs` and `crates/tui/src/config.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 171 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 (27–31 lines × 2) · ×1
  • Duplicated block (27–31 lines × 2) crates/tui/src/client.rs:6383 — crates/tui/src/client.rs:6383-6413 | crates/tui/src/client.rs:6511-6537 — both copies are in the same file, so extract the 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–30 lines × 2) · ×1
  • Duplicated block (29–30 lines × 2) crates/tui/src/tui/views/automations.rs:674 — crates/tui/src/tui/views/automations.rs:674-702 | crates/tui/src/tui/views/workflows_manager.rs:448-477 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 (28 lines × 2) · ×1
  • Duplicated block (28 lines × 2) crates/tui/src/runtime_threads.rs:6042 — crates/tui/src/runtime_threads.rs:6042-6069 | crates/tui/src/runtime_threads.rs:6081-6108 — both copies are in the same file, so extract the 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–27 lines × 2) · ×1
  • Duplicated block (25–27 lines × 2) crates/tui/src/tools/apply_patch.rs:436 — crates/tui/src/tools/apply_patch.rs:436-460 | crates/tui/src/tools/apply_patch.rs:497-523 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (26 lines × 3) · ×1
  • Duplicated block (26 lines × 3) crates/tui/src/pricing.rs:960 — crates/tui/src/pricing.rs:960-985 | crates/tui/src/pricing.rs:1004-1029 | crates/tui/src/pricing.rs:1041-1066 — 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 (26 lines × 2) · ×1
  • Duplicated block (26 lines × 2) crates/tui/src/tools/web_run.rs:532 — crates/tui/src/tools/web_run.rs:532-557 | crates/tui/src/tools/web_run.rs:604-629 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (24–26 lines × 2) · ×1
  • Duplicated block (24–26 lines × 2) crates/tui/src/tui/widgets/approval_band_legacy.rs:706 — crates/tui/src/tui/widgets/approval_band_legacy.rs:706-729 | crates/tui/src/tui/widgets/mod.rs:1892-1917 — before extracting anything, compare `crates/tui/src/tui/widgets/approval_band_legacy.rs` and `crates/tui/src/tui/widgets/mod.rs` as WHOLE FILES: this scan already matched 23 separate duplicated blocks between them, totalling at least 524 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (19–25 lines × 2) · ×1
  • Duplicated block (19–25 lines × 2) crates/tui/src/client/chat.rs:1627 — crates/tui/src/client/chat.rs:1627-1651 | crates/tui/src/client/chat.rs:1726-1744 — both copies are in the same file, so extract the 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 lines × 2) · ×1
  • Duplicated block (25 lines × 2) crates/tui/src/tui/widgets/mod.rs:759 — crates/tui/src/tui/widgets/mod.rs:759-783 | crates/tui/src/tui/widgets/transcript_legacy.rs:650-674 — before extracting anything, compare `crates/tui/src/tui/widgets/mod.rs` and `crates/tui/src/tui/widgets/transcript_legacy.rs` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 778 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (22–24 lines × 2) · ×1
  • Duplicated block (22–24 lines × 2) crates/config/src/lib.rs:4281 — crates/config/src/lib.rs:4281-4304 | crates/tui/src/config.rs:7691-7712 — before extracting anything, compare `crates/config/src/lib.rs` and `crates/tui/src/config.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 171 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 (20–23 lines × 2) · ×1
  • Duplicated block (20–23 lines × 2) crates/tui/src/plugins/marketplace/parsers/claude.rs:535 — crates/tui/src/plugins/marketplace/parsers/claude.rs:535-554 | crates/tui/src/plugins/marketplace/parsers/codex.rs:378-400 — before extracting anything, compare `crates/tui/src/plugins/marketplace/parsers/claude.rs` and `crates/tui/src/plugins/marketplace/parsers/codex.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 93 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (17–23 lines × 2) · ×1
  • Duplicated block (17–23 lines × 2) crates/tui/src/tui/ui/event_loop.rs:1587 — crates/tui/src/tui/ui/event_loop.rs:1587-1603 | crates/tui/src/tui/ui/event_loop.rs:1740-1762 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×1
  • Duplicated block (22 lines × 2) crates/tui/src/plugins/install/tarball.rs:205 — crates/tui/src/plugins/install/tarball.rs:205-226 | crates/tui/src/skills/install.rs:1590-1611 — before extracting anything, compare `crates/tui/src/plugins/install/tarball.rs` and `crates/tui/src/skills/install.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 60 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 (19–22 lines × 2) · ×1
  • Duplicated block (19–22 lines × 2) crates/tui/src/runtime_threads.rs:18010 — crates/tui/src/runtime_threads.rs:18010-18031 | crates/tui/src/runtime_threads.rs:18088-18106 — both copies are in the same file, so extract the 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 (19–20 lines × 3) · ×1
  • Duplicated block (19–20 lines × 3) crates/tui/src/runtime_threads.rs:6624 — crates/tui/src/runtime_threads.rs:6624-6643 | crates/tui/src/runtime_threads.rs:6660-6678 | crates/tui/src/runtime_threads.rs:6705-6724 — 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 (17–20 lines × 2) · ×1
  • Duplicated block (17–20 lines × 2) crates/tui/src/tui/ui/activity_detail.rs:454 — crates/tui/src/tui/ui/activity_detail.rs:454-473 | crates/tui/src/tui/ui/activity_detail.rs:490-506 — both copies are in the same file, so extract the 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–19 lines × 3) · ×1
  • Duplicated block (18–19 lines × 3) crates/config/src/private_directory.rs:1160 — crates/config/src/private_directory.rs:1160-1177 | crates/runtime/src/external_credentials.rs:434-452 | crates/tui/src/tools/github/report.rs:1221-1238 — before extracting anything, compare `crates/config/src/private_directory.rs` and `crates/runtime/src/external_credentials.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (19 lines × 3) · ×1
  • Duplicated block (19 lines × 3) crates/tui/src/client.rs:6281 — crates/tui/src/client.rs:6281-6307 | crates/tui/src/client.rs:6387-6405 | crates/tui/src/client.rs:6515-6533 — 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 (17–19 lines × 2) · ×1
  • Duplicated block (17–19 lines × 2) crates/tui/src/tui/ui/dispatch.rs:578 — crates/tui/src/tui/ui/dispatch.rs:578-596 | crates/tui/src/tui/ui/dispatch.rs:1283-1299 — both copies are in the same file, so extract the 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 (15–18 lines × 3) · ×1
  • Duplicated block (15–18 lines × 3) crates/tui/src/tui/feedback_picker.rs:145 — crates/tui/src/tui/feedback_picker.rs:145-159 | crates/tui/src/tui/live_transcript.rs:656-673 | crates/tui/src/tui/views/mode_picker.rs:152-166 — before extracting anything, compare `crates/tui/src/tui/feedback_picker.rs` and `crates/tui/src/tui/views/mode_picker.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (16 lines × 3) · ×1
  • Duplicated block (16 lines × 3) crates/tui/src/runtime_api.rs:9990 — crates/tui/src/runtime_api.rs:9990-10005 | crates/tui/src/runtime_api.rs:10011-10026 | crates/tui/src/runtime_api.rs:10067-10082 — 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–16 lines × 2) · ×1
  • Duplicated block (13–16 lines × 2) crates/config/src/private_directory.rs:778 — crates/config/src/private_directory.rs:778-793 | crates/tui/src/tools/github/report.rs:1128-1140 — before extracting anything, compare `crates/config/src/private_directory.rs` and `crates/tui/src/tools/github/report.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 65 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 (15–16 lines × 2) · ×1
  • Duplicated block (15–16 lines × 2) crates/tui/src/commands/contract.rs:4219 — crates/tui/src/commands/contract.rs:4219-4233 | crates/tui/src/commands/contract.rs:4467-4482 — both copies are in the same file, so extract the 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–16 lines × 2) · ×1
  • Duplicated block (11–16 lines × 2) REDACTED:3300 — REDACTED:3300-3315 | REDACTED:3374-3384 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (14–16 lines × 2) · ×1
  • Duplicated block (14–16 lines × 2) crates/tui/src/tui/ui/dispatch.rs:452 — crates/tui/src/tui/ui/dispatch.rs:452-467 | crates/tui/src/tui/ui/dispatch.rs:1249-1262 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (14–15 lines × 4) · ×1
  • Duplicated block (14–15 lines × 4) crates/tui/src/core/engine/turn_loop.rs:3100 — crates/tui/src/core/engine/turn_loop.rs:3100-3113 | crates/tui/src/core/engine/turn_loop.rs:3124-3137 | crates/tui/src/core/engine/turn_loop.rs:3201-3215 | crates/tui/src/core/engine/turn_loop.rs:3258-3272 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (15 lines × 4) · ×1
  • Duplicated block (15 lines × 4) crates/tui/src/fleet/ledger.rs:822 — crates/tui/src/fleet/ledger.rs:822-836 | crates/tui/src/fleet/ledger.rs:881-895 | crates/tui/src/fleet/ledger.rs:928-942 | crates/tui/src/fleet/ledger.rs:1055-1069 — 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 (13–15 lines × 3) · ×1
  • Duplicated block (13–15 lines × 3) crates/runtime/src/process_tree.rs:576 — crates/runtime/src/process_tree.rs:576-589 | REDACTED:1505-1517 | crates/tui/src/tools/shell.rs:696-710 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
D4 · Code Duplication · Duplicated block (9–15 lines × 3) · ×1
  • Duplicated block (9–15 lines × 3) crates/tui/src/tui/ui/event_loop.rs:4416 — crates/tui/src/tui/ui/event_loop.rs:4416-4424 | crates/tui/src/tui/ui/event_loop.rs:4493-4503 | crates/tui/src/tui/ui/event_loop.rs:8733-8747 — 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–15 lines × 2) · ×1
  • Duplicated block (12–15 lines × 2) crates/sanitize/src/sanitize.rs:195 — crates/sanitize/src/sanitize.rs:195-209 | crates/tui/src/tui/osc8.rs:296-307 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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 (12–13 lines × 3) · ×1
  • Duplicated block (12–13 lines × 3) crates/tui/src/extension_host/mcp_http.rs:650 — crates/tui/src/extension_host/mcp_http.rs:650-661 | crates/tui/src/mcp/sse.rs:157-169 | crates/tui/src/mcp/wire.rs:85-97 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
D4 · Code Duplication · Duplicated block (11–12 lines × 3) · ×1
  • Duplicated block (11–12 lines × 3) crates/tui/src/tui/views/fleet_detail.rs:972 — crates/tui/src/tui/views/fleet_detail.rs:972-982 | crates/tui/src/tui/views/fleet_list.rs:381-392 | crates/tui/src/tui/views/workflows_manager.rs:552-563 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (8–11 lines × 3) · ×1
  • Duplicated block (8–11 lines × 3) crates/cloud-facts/src/lib.rs:314 — crates/cloud-facts/src/lib.rs:314-323 | crates/tui/src/plugins/registry.rs:1165-1175 | crates/tui/src/provider_catalog_live.rs:786-793 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
D4 · Code Duplication · Duplicated block (10–11 lines × 3) · ×1
  • Duplicated block (10–11 lines × 3) crates/tui/src/tools/subagent/mod.rs:5478 — crates/tui/src/tools/subagent/mod.rs:5478-5487 | crates/tui/src/tools/subagent/mod.rs:5523-5533 | crates/tui/src/tools/subagent/mod.rs:6666-6676 — 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–11 lines × 2) · ×1
  • Duplicated block (6–11 lines × 2) crates/tui/src/exec_agent.rs:687 — crates/tui/src/exec_agent.rs:687-697 | crates/tui/src/tui/ui/frame.rs:1063-1068 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, 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 (9–11 lines × 2) · ×1
  • Duplicated block (9–11 lines × 2) crates/tui/src/tools/web_search.rs:1191 — crates/tui/src/tools/web_search.rs:1191-1199 | crates/tui/src/tools/web_search.rs:1354-1364 — both copies are in the same file, so extract the 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–10 lines × 3) · ×1
  • Duplicated block (8–10 lines × 3) crates/tui/src/tui/provider_picker.rs:2168 — crates/tui/src/tui/provider_picker.rs:2168-2177 | crates/tui/src/tui/provider_picker.rs:2552-2559 | crates/tui/src/tui/provider_picker.rs:2576-2583 — 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–9 lines × 11) · ×1
  • Duplicated block (8–9 lines × 11) crates/tui/src/tui/hotbar/setup.rs:945 — crates/tui/src/tui/hotbar/setup.rs:945-953 | crates/tui/src/tui/provider_picker.rs:3579-3586 | crates/tui/src/tui/provider_picker.rs:3609-3616 | crates/tui/src/tui/provider_picker.rs:3832-3839 | crates/tui/src/tui/provider_picker.rs:3932-3939 | crates/tui/src/tui/provider_picker.rs:4016-4023 | crates/tui/src/tui/provider_picker.rs:4056-4064 | crates/tui/src/tui/provider_picker.rs:4174-4181 | crates/tui/src/tui/provider_picker.rs:4213-4220 | crates/tui/src/tui/provider_picker.rs:4321-4329 | crates/tui/src/tui/provider_picker.rs:4392-4400 — before extracting anything, compare `crates/tui/src/tui/hotbar/setup.rs` and `crates/tui/src/tui/provider_picker.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (9 lines × 5) · ×1
  • Duplicated block (9 lines × 5) crates/tui/src/runtime_threads.rs:3673 — crates/tui/src/runtime_threads.rs:3673-3681 | crates/tui/src/runtime_threads.rs:3719-3727 | crates/tui/src/runtime_threads.rs:3745-3753 | crates/tui/src/runtime_threads.rs:3904-3912 | crates/tui/src/runtime_threads.rs:4155-4163 — 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.
D4 · Code Duplication · Duplicated block (8 lines × 15) · ×1
  • Duplicated block (8 lines × 15) crates/tui/src/tui/hotbar/setup.rs:941 — crates/tui/src/tui/hotbar/setup.rs:941-948 | crates/tui/src/tui/provider_picker.rs:2956-2963 | crates/tui/src/tui/provider_picker.rs:3529-3536 | crates/tui/src/tui/provider_picker.rs:3575-3582 | crates/tui/src/tui/provider_picker.rs:3605-3612 | crates/tui/src/tui/provider_picker.rs:3658-3665 | crates/tui/src/tui/provider_picker.rs:3828-3835 | crates/tui/src/tui/provider_picker.rs:3928-3935 | crates/tui/src/tui/provider_picker.rs:4012-4019 | crates/tui/src/tui/provider_picker.rs:4052-4059 | crates/tui/src/tui/provider_picker.rs:4170-4177 | crates/tui/src/tui/provider_picker.rs:4209-4216 | crates/tui/src/tui/provider_picker.rs:4317-4324 | crates/tui/src/tui/provider_picker.rs:4388-4395 | crates/tui/src/tui/views/skills_manager.rs:418-425 — before extracting anything, compare `crates/tui/src/tui/hotbar/setup.rs` and `crates/tui/src/tui/provider_picker.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (8 lines × 6) · ×1
  • Duplicated block (8 lines × 6) crates/tui/src/automation_manager.rs:1683 — crates/tui/src/automation_manager.rs:1683-1690 | crates/tui/src/runtime_threads.rs:3674-3681 | crates/tui/src/runtime_threads.rs:3720-3727 | crates/tui/src/runtime_threads.rs:3746-3753 | crates/tui/src/runtime_threads.rs:3905-3912 | crates/tui/src/runtime_threads.rs:4156-4163 — 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 (4–8 lines × 4) · ×1
  • Duplicated block (4–8 lines × 4) REDACTED:3215 — REDACTED:3215-3222 | REDACTED:4201-4204 | crates/tui/src/commands/config_main_host.rs:2866-2873 | crates/tui/src/commands/contract/config_main.rs:342-345 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (6 lines × 9) · ×1
  • Duplicated block (6 lines × 9) crates/tui/src/tools/web_search.rs:761 — crates/tui/src/tools/web_search.rs:761-766 | crates/tui/src/tools/web_search.rs:864-871 | crates/tui/src/tools/web_search.rs:960-966 | crates/tui/src/tools/web_search.rs:1053-1059 | crates/tui/src/tools/web_search.rs:1141-1147 | crates/tui/src/tools/web_search.rs:1213-1218 | crates/tui/src/tools/web_search.rs:1293-1299 | crates/tui/src/tools/web_search.rs:1393-1399 | crates/tui/src/tools/web_search.rs:1500-1506 — all 9 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (5–6 lines × 2) · ×1
  • Duplicated block (5–6 lines × 2) crates/tui/src/plugins/install/mod.rs:412 — crates/tui/src/plugins/install/mod.rs:412-417 | crates/tui/src/plugins/install/mod.rs:507-511 — both copies are in the same file, so extract the 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 × 7) · ×1
  • Duplicated block (9 lines × 7) crates/tui/src/commands/groups/session/branch.rs:42 — crates/tui/src/commands/groups/session/branch.rs:42-50 | crates/tui/src/commands/groups/session/fork.rs:44-52 | crates/tui/src/commands/groups/session/load.rs:44-52 | crates/tui/src/commands/groups/session/new.rs:40-48 | crates/tui/src/commands/groups/session/save.rs:40-48 | crates/tui/src/commands/groups/session/sessions.rs:40-48 | crates/tui/src/commands/groups/session/tree.rs:40-48 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 7 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (6 lines × 19) · ×1
  • Duplicated block (6 lines × 19) crates/tui/src/config.rs:8141 — crates/tui/src/config.rs:8141-8146 | crates/tui/src/config.rs:8148-8153 | crates/tui/src/config.rs:8155-8160 | crates/tui/src/config.rs:8195-8200 | crates/tui/src/config.rs:8202-8209 | crates/tui/src/config.rs:8211-8216 | crates/tui/src/config.rs:8218-8223 | crates/tui/src/config.rs:8233-8238 | crates/tui/src/config.rs:8248-8253 | crates/tui/src/config.rs:8255-8260 | crates/tui/src/config.rs:8270-8275 | crates/tui/src/config.rs:8277-8282 | crates/tui/src/config.rs:8284-8289 | crates/tui/src/config.rs:8291-8296 | crates/tui/src/config.rs:8298-8303 | crates/tui/src/config.rs:8305-8315 | crates/tui/src/config.rs:8317-8324 | crates/tui/src/config.rs:8349-8354 | crates/tui/src/config.rs:8358-8363 — all 19 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7 lines × 17) · ×1
  • Duplicated block (7 lines × 17) crates/tui/src/config.rs:8441 — crates/tui/src/config.rs:8441-8447 | crates/tui/src/config.rs:8460-8466 | crates/tui/src/config.rs:8469-8475 | crates/tui/src/config.rs:8491-8497 | crates/tui/src/config.rs:8500-8506 | crates/tui/src/config.rs:8518-8524 | crates/tui/src/config.rs:8537-8543 | crates/tui/src/config.rs:8546-8552 | crates/tui/src/config.rs:8555-8561 | crates/tui/src/config.rs:8564-8570 | crates/tui/src/config.rs:8573-8579 | crates/tui/src/config.rs:8582-8588 | crates/tui/src/config.rs:8591-8597 | crates/tui/src/config.rs:8600-8608 | crates/tui/src/config.rs:8611-8619 | crates/tui/src/config.rs:8622-8628 | crates/tui/src/config.rs:8631-8637 — all 17 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7 lines × 6) · ×1
  • Duplicated block (7 lines × 6) crates/config/src/lib.rs:7738 — crates/config/src/lib.rs:7738-7744 | crates/config/src/lib.rs:7746-7752 | crates/config/src/lib.rs:7836-7842 | crates/config/src/lib.rs:7844-7850 | crates/config/src/lib.rs:7858-7864 | crates/config/src/lib.rs:7866-7872 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (5 lines × 6) · ×1
  • Duplicated block (5 lines × 6) crates/tui/src/config.rs:8164 — crates/tui/src/config.rs:8164-8168 | crates/tui/src/config.rs:8179-8184 | crates/tui/src/config.rs:8188-8193 | crates/tui/src/config.rs:8227-8231 | crates/tui/src/config.rs:8242-8246 | crates/tui/src/config.rs:8263-8268 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (23–24 lines × 2) · ×1
  • Duplicated block (23–24 lines × 2) scripts/check-command-migration-manifest.py:844 — scripts/check-command-migration-manifest.py:844-867 | scripts/check-command-migration-manifest.py:915-937 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/check-command-migration-manifest.py:844` it begins part-way through the construct above it, so those exact 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 × 2) · ×1
  • Duplicated block (8–11 lines × 2) scripts/check-command-migration-manifest.py:492 — scripts/check-command-migration-manifest.py:492-502 | scripts/split/module_graph.py:625-632 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/check-command-migration-manifest.py:492` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13–17 lines × 2) · ×1
  • Duplicated block (13–17 lines × 2) crates/tui/src/client/test_cases_01.rs:905 — crates/tui/src/client/test_cases_01.rs:905-921 | crates/tui/src/client/test_cases_05.rs:82-94 — before extracting anything, compare `crates/tui/src/client/test_cases_01.rs` and `crates/tui/src/client/test_cases_05.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D5 · Coupling · Unstable project codewhale-runtime · ×1
  • Unstable project codewhale-runtime — codewhale-runtime has instability 0.90 with 1 dependents.
D5 · Coupling · Unstable project codewhale-tui · ×1
  • Unstable project codewhale-tui — codewhale-tui has instability 0.97 with 1 dependents.
P12 · CI test-gate honesty · Tests run only outside the merge gate · ×1
  • Tests run only outside the merge gate REDACTED:34 — `npm test` is the only CI command that runs 105 test(s) in 6 file(s) (e.g. `telemetry-ingest/test/ingest.test.ts`, `telemetry-ingest/test/no-ip.test.ts`), and the workflow runs only on workflow_dispatch — a failure there is found after the change merged, when the only remedy is a revert. Run them on pull requests (or in the merge queue).
P12 · CI test-gate honesty · Coverage collected but not gated · ×1
  • Coverage collected but not gated — CI collects a coverage report but no step enforces a minimum — coverage could halve and CI stays green. Add a step that fails the build when coverage drops below a floor (your coverage tool's minimum-threshold flag, or a coverage-gate action) so the number guards something. What was searched, so you can tell an absence from a miss: this repository's CI files AND its coverage configuration — the well-known coverage and test-runner config files, read at the repository root and inside workspace package directories two levels down, so a floor declared beside the tests rather than in the pipeline is credited — matched against the threshold settings this check knows by name. A floor set in your coverage service's web UI rather than in a committed file, or under a setting whose name is not one of those, is not seen here.
R10 · Code Duplication · Duplication concentrated across 8 sibling directories (61 clone groups) · ×1
  • Duplication concentrated across 8 sibling directories (61 clone groups) crates/tui/src/tui/pet_watch/pet-native.js:830 — 61 duplicated blocks under the repository root have copies in at least two of the sibling directories crates, extensions, integrations, npm, pet, scripts (+2 more sibling(s) not listed) — 58 of them are reported below, and 3 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 61 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 61 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 61 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 18 sibling directories (21 clone groups) · ×1
  • Duplication concentrated across 18 sibling directories (21 clone groups) web/app/[locale]/community/page.tsx:99 — 21 duplicated blocks under web/app/[locale]/ have copies in at least two of the sibling directories changelog, community, computer-use, constitution, contribute, digest (+12 more sibling(s) not listed) — 15 of them are reported below, and 6 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 21 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 21 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 21 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 4 sibling directories (11 clone groups) · ×1
  • Duplication concentrated across 4 sibling directories (11 clone groups) integrations/feishu-bridge/src/index.mjs:82 — 11 duplicated blocks under integrations/ have copies in at least two of the sibling directories feishu-bridge, telegram-bridge, wecom-bridge, weixin-bridge — 10 of them are reported below, and 1 is 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 11 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 11 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 11 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 4 sibling directories (7 clone groups) · ×1
  • Duplication concentrated across 4 sibling directories (7 clone groups) REDACTED:91 — 7 of the duplicated blocks reported below have copies in at least two of the sibling directories app, components, lib, scripts under web/. That concentration is one structural fact, not 7 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 7 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 (344 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (344 matched lines × 2 locations) integrations/feishu-bridge/src/index.mjs:82 — integrations/feishu-bridge/src/index.mjs:82 · integrations/wecom-bridge/src/index.mjs:88 — the two spans are one implementation copied and then locally edited — 2127 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 (144 lines × 2 locations) · ×1
  • Duplicated block (144 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:830 — crates/tui/src/tui/pet_watch/pet-native.js:830 · pet/ios/Resources/pet-native.js:830 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
R10 · Code Duplication · Duplicated block (135 lines × 2 locations) · ×1
  • Duplicated block (135 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:1956 — crates/tui/src/tui/pet_watch/pet-native.js:1956 · pet/ios/Resources/pet-native.js:1956 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
R10 · Code Duplication · Duplicated block (120 lines × 2 locations) · ×1
  • Duplicated block (120 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:1691 — crates/tui/src/tui/pet_watch/pet-native.js:1691 · pet/ios/Resources/pet-native.js:1691 — 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 (110 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (110 matched lines × 2 locations) REDACTED:125 — REDACTED:125 · REDACTED:479 — the two spans are one implementation copied and then locally edited — 991 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 (107 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (107 matched lines × 2 locations) integrations/feishu-bridge/src/lib.mjs:91 — integrations/feishu-bridge/src/lib.mjs:91 · REDACTED:434 — the two spans are one implementation copied and then locally edited — 757 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 (92 lines × 2 locations) · ×1
  • Duplicated block (92 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:182 — crates/tui/src/tui/pet_watch/pet-native.js:182 · pet/ios/Resources/pet-native.js:182 — 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 (91 lines × 2 locations) · ×1
  • Duplicated block (91 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:470 — crates/tui/src/tui/pet_watch/pet-native.js:470 · pet/ios/Resources/pet-native.js:470 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
R10 · Code Duplication · Wholesale file copy (86 identical lines × 2 files) · ×1
  • Wholesale file copy (86 identical lines × 2 files) integrations/feishu-bridge/scripts/validate-config.mjs:2 — integrations/feishu-bridge/scripts/validate-config.mjs:2 · integrations/telegram-bridge/scripts/validate-config.mjs:2 — these 2 files are line-for-line copies of one another — 86 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Duplicated block (76 lines × 3 locations) · ×1
  • Duplicated block (76 lines × 3 locations) crates/tui/src/tui/pet_watch/pet-native.js:2008 — crates/tui/src/tui/pet_watch/pet-native.js:2008 · pet/ios/Resources/pet-native.js:2008 · pet/src/core/pet-engine.ts:327 — the 3 copies are spread across 3 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. There is one copy in each of 3 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete.
R10 · Code Duplication · Duplicated block (73 lines × 2 locations) · ×1
  • Duplicated block (73 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:1162 — crates/tui/src/tui/pet_watch/pet-native.js:1162 · pet/ios/Resources/pet-native.js:1162 — 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 (70 lines × 2 locations) · ×1
  • Duplicated block (70 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:653 — crates/tui/src/tui/pet_watch/pet-native.js:653 · pet/ios/Resources/pet-native.js:653 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
R10 · Code Duplication · Duplicated block (64 lines × 2 locations) · ×1
  • Duplicated block (64 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:1324 — crates/tui/src/tui/pet_watch/pet-native.js:1324 · pet/ios/Resources/pet-native.js:1324 — 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 (63 lines × 2 locations) · ×1
  • Duplicated block (63 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:105 — crates/tui/src/tui/pet_watch/pet-native.js:105 · pet/ios/Resources/pet-native.js:105 — 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 (53 lines × 2 locations) · ×1
  • Duplicated block (53 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:1429 — crates/tui/src/tui/pet_watch/pet-native.js:1429 · pet/ios/Resources/pet-native.js:1429 — 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 (52 lines × 2 locations) · ×1
  • Duplicated block (52 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:1504 — crates/tui/src/tui/pet_watch/pet-native.js:1504 · pet/ios/Resources/pet-native.js:1504 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
R10 · Code Duplication · Duplicated block with local edits (47 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (47 matched lines × 2 locations) web/app/[locale]/community/page.tsx:99 — web/app/[locale]/community/page.tsx:99 · web/app/[locale]/contribute/page.tsx:148 — the two spans are one implementation copied and then locally edited — 266 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (35 lines × 2 locations) · ×1
  • Duplicated block (35 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:2241 — crates/tui/src/tui/pet_watch/pet-native.js:2241 · pet/ios/Resources/pet-native.js:2241 — 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 (35 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (35 matched lines × 2 locations) web/app/[locale]/legal/privacy/page.tsx:11 — web/app/[locale]/legal/privacy/page.tsx:11 · web/app/[locale]/legal/terms/page.tsx:8 — the two spans are one implementation copied and then locally edited — 277 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 (34 lines × 3 locations) · ×1
  • Duplicated block (34 lines × 3 locations) web/lib/community-agent-tasks.ts:119 — web/lib/community-agent-tasks.ts:119 · web/lib/community-agent-tasks.ts:204 · web/lib/community-agent-tasks.ts:272 — all 3 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 × 2 locations) · ×1
  • Duplicated block (30 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:1395 — crates/tui/src/tui/pet_watch/pet-native.js:1395 · pet/ios/Resources/pet-native.js:1395 — 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 (30 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (30 matched lines × 2 locations) integrations/feishu-bridge/src/lib.mjs:60 — integrations/feishu-bridge/src/lib.mjs:60 · integrations/wecom-bridge/src/lib.mjs:60 — the two spans are one implementation copied and then locally edited — 203 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (29 lines × 3 locations) · ×1
  • Duplicated block (29 lines × 3 locations) crates/tui/src/tui/pet_watch/pet-native.js:2195 — crates/tui/src/tui/pet_watch/pet-native.js:2195 · pet/ios/Resources/pet-native.js:2195 · pet/src/core/dot-field.ts:88 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (28 lines × 2 locations) · ×1
  • Duplicated block (28 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:2 — crates/tui/src/tui/pet_watch/pet-native.js:2 · pet/ios/Resources/pet-native.js:2 — 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 (26 lines × 2 locations) · ×1
  • Duplicated block (26 lines × 2 locations) crates/tui/src/tui/pet_watch/pet-native.js:2124 — crates/tui/src/tui/pet_watch/pet-native.js:2124 · pet/ios/Resources/pet-native.js:2124 — 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 (25 lines × 3 locations) · ×1
  • Duplicated block (25 lines × 3 locations) crates/tui/src/tui/pet_watch/pet-native.js:1395 — crates/tui/src/tui/pet_watch/pet-native.js:1395 · pet/ios/Resources/pet-native.js:1395 · pet/src/core/signal.ts:31 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R2 · Cyclomatic Complexity · Complex function callTool (cyclomatic 258, cognitive 376) · ×1
  • Complex function callTool (cyclomatic 258, cognitive 376) crates/tui/plugins/computer-use/mcp/server.mjs:1011 — callTool has cyclomatic complexity 258 and cognitive complexity 376; 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 analyzeEvidence (cyclomatic 107, cognitive 206) · ×1
  • Complex function analyzeEvidence (cyclomatic 107, cognitive 206) pet/src/core/evidence.ts:153 — analyzeEvidence has cyclomatic complexity 107 and cognitive complexity 206; 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 POST (cyclomatic 97, cognitive 186) · ×1
  • Complex function POST (cyclomatic 97, cognitive 186) web/app/api/admin/post/route.ts:87 — POST has cyclomatic complexity 97 and cognitive complexity 186; 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 append (cyclomatic 78, cognitive 151) · ×1
  • Complex function append (cyclomatic 78, cognitive 151) pet/src/core/codewhale.ts:365 — append has cyclomatic complexity 78 and cognitive complexity 151; 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 resolveTool (cyclomatic 76, cognitive 96) · ×1
  • Complex function resolveTool (cyclomatic 76, cognitive 96) crates/tui/plugins/computer-use/src/tools.mjs:783 — resolveTool has cyclomatic complexity 76 and cognitive complexity 96; 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 applyRuntimeEvent (cyclomatic 65, cognitive 66) · ×1
  • Complex function applyRuntimeEvent (cyclomatic 65, cognitive 66) crates/tui/src/runtime_web/app.mjs:94 — applyRuntimeEvent has cyclomatic complexity 65 and cognitive complexity 66; 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 buildCorpus (cyclomatic 61, cognitive 146) · ×1
  • Complex function buildCorpus (cyclomatic 61, cognitive 146) scripts/review-eval.mjs:255 — buildCorpus has cyclomatic complexity 61 and cognitive complexity 146; 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 fromCodewhaleSession (cyclomatic 55, cognitive 102) · ×1
  • Complex function fromCodewhaleSession (cyclomatic 55, cognitive 102) pet/src/core/codewhale.ts:130 — fromCodewhaleSession has cyclomatic complexity 55 and cognitive complexity 102; 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 · crates/tui/src/tui/pet_watch/pet-native.js · ×1
  • crates/tui/src/tui/pet_watch/pet-native.js: 7107 lines of code crates/tui/src/tui/pet_watch/pet-native.js:1 — crates/tui/src/tui/pet_watch/pet-native.js has 7107 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 · pet/ios/Resources/pet-native.js · ×1
  • pet/ios/Resources/pet-native.js: 7107 lines of code pet/ios/Resources/pet-native.js:1 — pet/ios/Resources/pet-native.js has 7107 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 · crates/tui/src/runtime_web/app.mjs · ×1
  • crates/tui/src/runtime_web/app.mjs: 2283 lines of code crates/tui/src/runtime_web/app.mjs:1 — crates/tui/src/runtime_web/app.mjs has 2283 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 · crates/tui/plugins/computer-use/mcp/server.mjs · ×1
  • crates/tui/plugins/computer-use/mcp/server.mjs: 1852 lines of code crates/tui/plugins/computer-use/mcp/server.mjs:1 — crates/tui/plugins/computer-use/mcp/server.mjs has 1852 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 · integrations/weixin-bridge/src/index.mjs · ×1
  • integrations/weixin-bridge/src/index.mjs: 1412 lines of code integrations/weixin-bridge/src/index.mjs:1 — integrations/weixin-bridge/src/index.mjs has 1412 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 · extensions/vscode/src/chat.ts · ×1
  • extensions/vscode/src/chat.ts: 1359 lines of code extensions/vscode/src/chat.ts:1 — extensions/vscode/src/chat.ts has 1359 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 · crates/tui/plugins/computer-use/src/backends/linux.mjs · ×1
  • crates/tui/plugins/computer-use/src/backends/linux.mjs: 1267 lines of code crates/tui/plugins/computer-use/src/backends/linux.mjs:1 — crates/tui/plugins/computer-use/src/backends/linux.mjs has 1267 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 · crates/tui/plugins/computer-use/src/backends/darwin.mjs · ×1
  • crates/tui/plugins/computer-use/src/backends/darwin.mjs: 1132 lines of code crates/tui/plugins/computer-use/src/backends/darwin.mjs:1 — crates/tui/plugins/computer-use/src/backends/darwin.mjs 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 · integrations/telegram-bridge/src/index.mjs · ×1
  • integrations/telegram-bridge/src/index.mjs: 960 lines of code integrations/telegram-bridge/src/index.mjs:1 — integrations/telegram-bridge/src/index.mjs has 960 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 · crates/tui/plugins/computer-use/src/tools.mjs · ×1
  • crates/tui/plugins/computer-use/src/tools.mjs: 885 lines of code crates/tui/plugins/computer-use/src/tools.mjs:1 — crates/tui/plugins/computer-use/src/tools.mjs has 885 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 · web/lib/community-agent.ts · ×1
  • web/lib/community-agent.ts: 808 lines of code web/lib/community-agent.ts:1 — web/lib/community-agent.ts has 808 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: 743 lines of code REDACTED:1 — REDACTED has 743 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 · integrations/bridge-core/src/lib.mjs · ×1
  • integrations/bridge-core/src/lib.mjs: 632 lines of code integrations/bridge-core/src/lib.mjs:1 — integrations/bridge-core/src/lib.mjs has 632 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 · crates/tui/plugins/computer-use/src/browser-cdp.mjs · ×1
  • crates/tui/plugins/computer-use/src/browser-cdp.mjs: 629 lines of code crates/tui/plugins/computer-use/src/browser-cdp.mjs:1 — crates/tui/plugins/computer-use/src/browser-cdp.mjs has 629 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 · extensions/vscode/src/api.ts · ×1
  • extensions/vscode/src/api.ts: 627 lines of code extensions/vscode/src/api.ts:1 — extensions/vscode/src/api.ts has 627 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 · crates/tui/plugins/computer-use/src/backends/win32.mjs · ×1
  • crates/tui/plugins/computer-use/src/backends/win32.mjs: 608 lines of code crates/tui/plugins/computer-use/src/backends/win32.mjs:1 — crates/tui/plugins/computer-use/src/backends/win32.mjs has 608 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 · web/lib/i18n/dictionaries/index.ts · ×1
  • web/lib/i18n/dictionaries/index.ts: 567 lines of code web/lib/i18n/dictionaries/index.ts:1 — web/lib/i18n/dictionaries/index.ts has 567 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: 558 lines of code REDACTED:1 — REDACTED has 558 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 · integrations/feishu-bridge/src/index.mjs · ×1
  • integrations/feishu-bridge/src/index.mjs: 553 lines of code integrations/feishu-bridge/src/index.mjs:1 — integrations/feishu-bridge/src/index.mjs has 553 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 · pet/src/core/codewhale.ts · ×1
  • pet/src/core/codewhale.ts: 549 lines of code pet/src/core/codewhale.ts:1 — pet/src/core/codewhale.ts has 549 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: 526 lines of code REDACTED:1 — REDACTED has 526 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 · integrations/wecom-bridge/src/index.mjs · ×1
  • integrations/wecom-bridge/src/index.mjs: 504 lines of code integrations/wecom-bridge/src/index.mjs:1 — integrations/wecom-bridge/src/index.mjs has 504 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 · web/lib/community-agent-tasks.ts · ×1
  • web/lib/community-agent-tasks.ts: 467 lines of code web/lib/community-agent-tasks.ts:1 — web/lib/community-agent-tasks.ts has 467 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 · crates/tui/src/integrations/dsh/scene.js · ×1
  • crates/tui/src/integrations/dsh/scene.js: 458 lines of code crates/tui/src/integrations/dsh/scene.js:1 — crates/tui/src/integrations/dsh/scene.js has 458 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 · integrations/weixin-bridge/src/lib.mjs · ×1
  • integrations/weixin-bridge/src/lib.mjs: 453 lines of code integrations/weixin-bridge/src/lib.mjs:1 — integrations/weixin-bridge/src/lib.mjs has 453 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 · integrations/weixin-bridge/src/qr.mjs · ×1
  • integrations/weixin-bridge/src/qr.mjs: 453 lines of code integrations/weixin-bridge/src/qr.mjs:1 — integrations/weixin-bridge/src/qr.mjs has 453 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 · web/app/api/admin/post/route.ts · ×1
  • web/app/api/admin/post/route.ts: 425 lines of code web/app/api/admin/post/route.ts:1 — web/app/api/admin/post/route.ts has 425 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 · web/lib/telemetry/product-usage.ts · ×1
  • web/lib/telemetry/product-usage.ts: 423 lines of code web/lib/telemetry/product-usage.ts:1 — web/lib/telemetry/product-usage.ts has 423 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 · pet/src/core/pet-sim.ts · ×1
  • pet/src/core/pet-sim.ts: 411 lines of code pet/src/core/pet-sim.ts:1 — pet/src/core/pet-sim.ts has 411 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 (~7119 LoC) · ×1
  • Dead file (~7119 LoC) pet/ios/Resources/pet-native.js — no import path from any entry point (267 application, 57 tooling, 233 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 · Unused dependency 'sharp' · ×1
  • Unused dependency 'sharp' — Declared in crates/tui/plugins/computer-use/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.
R8 · Dependency Hygiene · Unused dependency 'gt' · ×1
  • Unused dependency 'gt' — Declared in web/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.
Minor — 170 finding(s)
X4 · Structured logging · Interpolated log message defeats structured logging · ×40
  • Interpolated log message defeats structured logging crates/tui/src/automation_manager.rs:1854 — `warn!` at line 1854 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/automation_manager.rs:1883 — `warn!` at line 1883 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/automation_manager.rs:1905 — `warn!` at line 1905 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/automation_manager.rs:2084 — `warn!` at line 2084 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/automation_manager.rs:2210 — `warn!` at line 2210 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/automation_manager.rs:2571 — `warn!` at line 2571 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/automation_manager.rs:2584 — `warn!` at line 2584 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/automation_manager.rs:2613 — `warn!` at line 2613 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/automation_manager.rs:2630 — `warn!` at line 2630 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/automation_manager.rs:2778 — `warn!` at line 2778 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/automation_manager.rs:2791 — `warn!` at line 2791 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/automation_manager.rs:2804 — `warn!` at line 2804 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/automation_manager.rs:2969 — `warn!` at line 2969 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/automation_manager.rs:2984 — `warn!` at line 2984 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/automation_manager.rs:3040 — `warn!` at line 3040 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/automation_manager.rs:3206 — `warn!` at line 3206 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/automation_manager.rs:3209 — `warn!` at line 3209 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/automation_manager.rs:3212 — `warn!` at line 3212 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/composer_history.rs:93 — `warn!` at line 93 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/composer_history.rs:265 — `warn!` at line 265 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/composer_history.rs:277 — `warn!` at line 277 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/composer_history.rs:305 — `warn!` at line 305 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/composer_history.rs:332 — `debug!` at line 332 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/composer_stash.rs:296 — `warn!` at line 296 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/tui/src/composer_stash.rs:367 — `warn!` at line 367 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • + 15 more in this group — see findings.md.
X7 · Silent fallback defaults · Silent fallback default on Err · ×37
  • Silent fallback default on Err crates/commands/src/debug/cache.rs:156 — `json_or_fallback` turns every `Err` into `"{\"error\":\"cache inspection serialization failed\"}".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/commands/src/diagnostics_reports/receipts.rs:486 — `render_json` turns every `Err` into `"{}".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/commands/src/diagnostics_reports/tool_snapshot.rs:260 — `json_string` turns every `Err` into `"\"unavailable\"".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/config/src/notifications.rs:349 — `display` turns every `Err` into `"<invalid notification edit>".into()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/config/src/pricing.rs:563 — `unpriced_used_classes` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/config/src/cloud_facts/overlay.rs:175 — `snapshot_at` turns every `Err` into `OverlaySnapshot::default()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/execpolicy/src/command_safety.rs:999 — `readonly_network_reads` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/palette/src/user_theme.rs:157 — `list_user_theme_options` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/runtime/src/lane_control.rs:217 — `drain_completed` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/telemetry/src/buffer.rs:338 — `read_lines` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/tui/src/approval_log.rs:560 — `sessions_with_logs` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/tui/src/config.rs:5196 — `http_headers` turns every `Err` into `HashMap::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/tui/src/config.rs:5309 — `default_model` turns every `Err` into `String::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/tui/src/core/engine.rs:7398 — `running_background_shell_survivors` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/tui/src/fleet/profile.rs:1086 — `render_toml` turns every `Err` into `String::from("# failed to render profile")` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/tui/src/model_inventory.rs:655 — `router_context_json` turns every `Err` into `"{}".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/tui/src/tools/codemode.rs:690 — `begin` turns every `Err` into `0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/tui/src/tools/workflow/mod.rs:4114 — `terminal_gate_failure` turns every `Err` into `Some("workflow gate board was unavailable during terminal finalization".to_string())` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/tui/src/tui/app.rs:3402 — `current_locale_tag` turns every `Err` into `"auto".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/tui/src/tui/views/fleet_list.rs:576 — `entry_summary` turns every `Err` into `"unreadable".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/tui/src/client/provider_native_search.rs:692 — `fallback_title` turns every `Err` into `"Web source".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/tui/src/commands/groups/utility/mcp.rs:244 — `mcp_unknown_id` turns every `Err` into `"Unknown MCP suggestion. Run /mcp recommendations to see the list.".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/tui/src/commands/user_commands.rs:206 — `load_command_entries_from_component` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/tui/src/composer_stash.rs:265 — `load_stash_from` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/tui/src/doctor_fix.rs:116 — `stale_temp_files` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
  • + 12 more in this group — see findings.md.
X10 · Duplicated predicate · Duplicated predicate · ×25
  • Duplicated predicate crates/tui/src/tui/pet_watch/pet-native.js:145 — `!Array.isArray(events) || events.length > 64` appears character-identically in 3 files — crates/tui/src/tui/pet_watch/pet-native.js, pet/ios/Resources/pet-native.js, pet/src/core/pet-native.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 crates/tui/src/tui/pet_watch/pet-native.js:988 — `!Array.isArray(v) || v.length !== 3 || v[0] !== this.p[i].hx || v[1] !== this.p[i].hy || v[2] !== this.p[i].s` appears character-identically in 3 files — crates/tui/src/tui/pet_watch/pet-native.js, pet/ios/Resources/pet-native.js, pet/src/core/pet-sim.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 crates/tui/src/tui/pet_watch/pet-native.js:1910 — `!Number.isFinite(at) || at < this.lastTime || at > pet_sim_js_1.PET_MAX_SECONDS * 1000` appears character-identically in 2 files — crates/tui/src/tui/pet_watch/pet-native.js, pet/ios/Resources/pet-native.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/tui/src/tui/pet_watch/pet-native.js:515 — `!Number.isFinite(dt) || dt < 0 || dt > 10` appears character-identically in 3 files — crates/tui/src/tui/pet_watch/pet-native.js, pet/ios/Resources/pet-native.js, pet/src/core/pet-world.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 crates/tui/src/tui/pet_watch/pet-native.js:1369 — `!Number.isFinite(duration) || duration < 0` appears character-identically in 3 files — crates/tui/src/tui/pet_watch/pet-native.js, pet/ios/Resources/pet-native.js, pet/src/core/signal.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 crates/tui/src/tui/pet_watch/pet-native.js:1222 — `!Number.isFinite(durationMs) || durationMs < 0` appears character-identically in 3 files — crates/tui/src/tui/pet_watch/pet-native.js, pet/ios/Resources/pet-native.js, pet/src/core/pet-telemetry.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 crates/tui/src/tui/pet_watch/pet-native.js:1377 — `!Number.isFinite(e.startTime) || !Number.isFinite(e.endTime) || e.startTime < 0 || e.endTime < e.startTime` appears character-identically in 3 files — crates/tui/src/tui/pet_watch/pet-native.js, pet/ios/Resources/pet-native.js, pet/src/core/signal.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 crates/tui/src/tui/pet_watch/pet-native.js:266 — `!Number.isFinite(e.timeMs) || e.timeMs < 0 || i > 0 && e.timeMs < this.interactionLog[i - 1].timeMs || !['attention', 'food'].includes(e.kin…` appears character-identically in 3 files — crates/tui/src/tui/pet_watch/pet-native.js, pet/ios/Resources/pet-native.js, pet/src/core/pet-world.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 crates/tui/src/tui/pet_watch/pet-native.js:1162 — `!Number.isFinite(n) || n < 0 || n > 100_000_000` appears character-identically in 3 files — crates/tui/src/tui/pet_watch/pet-native.js, pet/ios/Resources/pet-native.js, pet/src/core/pet-telemetry.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 crates/tui/src/tui/pet_watch/pet-native.js:1493 — `!Number.isFinite(start) || !Number.isFinite(end) || end < start || limit <= 0` appears character-identically in 3 files — crates/tui/src/tui/pet_watch/pet-native.js, pet/ios/Resources/pet-native.js, pet/src/core/signal.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 crates/tui/src/tui/pet_watch/pet-native.js:155 — `!Number.isFinite(timeMs) || target < this.engineTick || target - this.engineTick > 300` appears character-identically in 3 files — crates/tui/src/tui/pet_watch/pet-native.js, pet/ios/Resources/pet-native.js, pet/src/core/pet-native.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 integrations/feishu-bridge/src/lib.mjs:180 — `!Number.isFinite(turnTimeoutMs) || turnTimeoutMs < 1000` appears character-identically in 2 files — integrations/feishu-bridge/src/lib.mjs, 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 crates/tui/src/tui/pet_watch/pet-native.js:1364 — `!Number.isInteger(maxBins) || maxBins < 16 || maxBins > 1_048_576` appears character-identically in 3 files — crates/tui/src/tui/pet_watch/pet-native.js, pet/ios/Resources/pet-native.js, pet/src/core/signal.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 integrations/feishu-bridge/src/lib.mjs:203 — `!Number.isInteger(runtimePort) || runtimePort <= 0 || runtimePort > 65535` appears character-identically in 2 files — integrations/feishu-bridge/src/lib.mjs, 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 crates/tui/src/tui/pet_watch/pet-native.js:1674 — `!Number.isInteger(sampleRate) || sampleRate < 8000 || sampleRate > 96000 || !Number.isSafeInteger(startSample) || startSample < 0 || !Number…` appears character-identically in 3 files — crates/tui/src/tui/pet_watch/pet-native.js, pet/ios/Resources/pet-native.js, pet/src/core/pet-audio.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 crates/tui/src/tui/pet_watch/pet-native.js:1935 — `!Number.isSafeInteger(event.index) || event.index < 0` appears character-identically in 2 files — crates/tui/src/tui/pet_watch/pet-native.js, pet/ios/Resources/pet-native.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/tui/src/tui/pet_watch/pet-native.js:1224 — `!Number.isSafeInteger(firstSequence) || firstSequence < 0` appears character-identically in 3 files — crates/tui/src/tui/pet_watch/pet-native.js, pet/ios/Resources/pet-native.js, pet/src/core/pet-telemetry.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 crates/tui/src/tui/pet_watch/pet-native.js:356 — `!Number.isSafeInteger(index) || index < 0` appears character-identically in 3 files — crates/tui/src/tui/pet_watch/pet-native.js, pet/ios/Resources/pet-native.js, pet/src/core/pet-world.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 crates/tui/src/tui/pet_watch/pet-native.js:1161 — `!Number.isSafeInteger(n) || n < 0 || n > 250_000` appears character-identically in 3 files — crates/tui/src/tui/pet_watch/pet-native.js, pet/ios/Resources/pet-native.js, pet/src/core/pet-telemetry.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 crates/tui/src/tui/pet_watch/pet-native.js:779 — `!Number.isSafeInteger(state) || state < 0 || state > 0xffffffff` appears character-identically in 3 files — crates/tui/src/tui/pet_watch/pet-native.js, pet/ios/Resources/pet-native.js, pet/src/core/pet-sim.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 crates/tui/src/tui/pet_watch/pet-native.js:479 — `!['attention', 'food'].includes(kind) || !Number.isFinite(x) || !Number.isFinite(y) || Math.abs(x) > 1 || Math.abs(y) > 1` appears character-identically in 3 files — crates/tui/src/tui/pet_watch/pet-native.js, pet/ios/Resources/pet-native.js, pet/src/core/pet-world.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 crates/tui/src/tui/pet_watch/pet-native.js:1679 — `![v.start, v.duration, v.frequency, v.gain, v.pan].every(Number.isFinite) || v.start < 0 || v.duration <= 0 || v.duration > 10 || v.frequenc…` appears character-identically in 3 files — crates/tui/src/tui/pet_watch/pet-native.js, pet/ios/Resources/pet-native.js, pet/src/core/pet-audio.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 crates/tui/src/tui/pet_watch/pet-native.js:571 — `!busy && !addressed && time - this.lastActivity >= 75` appears character-identically in 3 files — crates/tui/src/tui/pet_watch/pet-native.js, pet/ios/Resources/pet-native.js, pet/src/core/pet-world.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 crates/tui/src/tui/pet_watch/pet-native.js:413 — `!c.frame.food || !range(c.frame.food.x, -1, 1) || !range(c.frame.food.y, -1, 1.21) || !range(c.frame.food.life, 0, 1)` appears character-identically in 3 files — crates/tui/src/tui/pet_watch/pet-native.js, pet/ios/Resources/pet-native.js, pet/src/core/pet-world.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 integrations/feishu-bridge/src/index.mjs:87 — `!config.allowlist.length && !config.allowUnlisted` appears character-identically in 4 files — integrations/feishu-bridge/src/index.mjs, integrations/telegram-bridge/src/index.mjs, integrations/wecom-bridge/src/index.mjs, integrations/weixin-bridge/src/index.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.
D7 · Architectural Integrity · Classify ADR enforcement · ×10
  • Classify ADR enforcement: Fleet rebuild decisions (2026-08-04) docs/decisions/2026-08-04-fleet-rebuild.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: RFC: Hook Lifecycle Data Flow docs/rfcs/1364-hooks-lifecycle.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: RFC: Persistence SQLite Migration docs/rfcs/2189-persistence-sqlite.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: RFC: Codewhale Workrooms — Chat-native Threaded Agent Work docs/rfcs/3209-workrooms.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: RFC: Output presentation filters without receipt mutation docs/rfcs/4468-output-presentation-filters.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: RFC: File Decomposition for v0.9.0 docs/rfcs/FILE_DECOMPOSITION_0_9_0.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: Harness Profile Cutline docs/rfcs/HARNESS_PROFILE_CUTLINE.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: `codewhale remote-setup` - Tailscale-first design docs/rfcs/REMOTE_SETUP_DESIGN.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: RFC: Unified provider login (`codewhale auth login`) docs/rfcs/UNIFIED_PROVIDER_LOGIN.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: Workflow External Memory Cutline docs/rfcs/WORKFLOW_EXTERNAL_MEMORY.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.
X6 · Hand-rolled structured-format parsing · Hand-rolled JSON/XML parsing via regex · ×10
  • Hand-rolled JSON/XML parsing via regex crates/tui/src/tools/web_run.rs:1652 — 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 Rust code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex crates/tui/src/tools/web_run.rs:1669 — 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 Rust code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex crates/tui/src/tools/web_run.rs:1673 — 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 Rust code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex crates/tui/src/tools/web_run.rs:1677 — 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 Rust code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex crates/tui/src/tools/web/scrape.rs:33 — 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 Rust code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex crates/tui/src/tools/web/scrape.rs:41 — 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 Rust code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex crates/tui/src/tools/web/scrape.rs:53 — 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 Rust code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex crates/tui/src/tools/web/scrape.rs:60 — 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 Rust code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex crates/tui/src/tools/web/scrape.rs:67 — 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 Rust code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex crates/tui/plugins/computer-use/src/spawn.mjs:104 — 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 JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
X9 · Subsumed condition operand · Subsumed condition operand · ×10
  • Subsumed condition operand crates/tui/src/error_taxonomy.rs:418 — `lower.contains("step budget exhausted")` can never decide this `||` — every value satisfying `lower.contains("step budget exhausted")` also satisfies `lower.contains("budget exhausted")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/tui/src/error_taxonomy.rs:427 — `lower.contains("maximum context length")` can never decide this `||` — every value satisfying `lower.contains("maximum context length")` also satisfies `lower.contains("context length")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/tui/src/local_ollama.rs:71 — `lower.contains("coder")` can never decide this `||` — every value satisfying `lower.contains("coder")` also satisfies `lower.contains("code")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/tui/src/runtime_threads.rs:386 — `lower.contains("proxy-authorization:")` can never decide this `||` — every value satisfying `lower.contains("proxy-authorization:")` also satisfies `lower.contains("authorization:")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/tui/src/tui/widgets/workflow_panel.rs:3453 — `joined.contains("failed")` can never decide this `||` — every value satisfying `joined.contains("failed")` also satisfies `joined.contains("fail")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/tui/src/tui/widgets/workflow_panel.rs:3546 — `joined.contains("3s")` can never decide this `||` — every value satisfying `joined.contains("3s")` also satisfies `joined.contains("s")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/tui/src/tui/widgets/workflow_panel.rs:3922 — `joined.contains("scout-b-fail")` can never decide this `||` — every value satisfying `joined.contains("scout-b-fail")` also satisfies `joined.contains("fail")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/tui/src/tui/widgets/workflow_panel.rs:3996 — `header.contains("cancelled")` can never decide this `||` — every value satisfying `header.contains("cancelled")` also satisfies `header.contains("cancel")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/tui/src/tui/history/tool_output.rs:726 — `lower.contains("warning")` can never decide this `||` — every value satisfying `lower.contains("warning")` also satisfies `lower.contains("warn")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/tui/src/mcp/oauth.rs:396 — `text.contains("/mcp login")` can never decide this `||` — every value satisfying `text.contains("/mcp login")` also satisfies `text.contains("mcp login")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
D20 · ADR Quality · ADR declares no status · ×4
  • ADR declares no status docs/rfcs/2189-persistence-sqlite.md:1 — `docs/rfcs/2189-persistence-sqlite.md` declares no status, while 5 of the 8 other records in `docs/rfcs` do, so a reader cannot tell whether this decision is in force. Add a `Status:` line.
  • ADR declares no status docs/rfcs/FILE_DECOMPOSITION_0_9_0.md:1 — `docs/rfcs/FILE_DECOMPOSITION_0_9_0.md` declares no status, while 5 of the 8 other records in `docs/rfcs` do, so a reader cannot tell whether this decision is in force. Add a `Status:` line.
  • ADR declares no status docs/rfcs/HARNESS_PROFILE_CUTLINE.md:1 — `docs/rfcs/HARNESS_PROFILE_CUTLINE.md` declares no status, while 5 of the 8 other records in `docs/rfcs` do, so a reader cannot tell whether this decision is in force. Add a `Status:` line.
  • ADR declares no status docs/rfcs/WORKFLOW_EXTERNAL_MEMORY.md:1 — `docs/rfcs/WORKFLOW_EXTERNAL_MEMORY.md` declares no status, while 5 of the 8 other records in `docs/rfcs` do, so a reader cannot tell whether this decision is in force. Add a `Status:` line.
X7 · Silent fallback defaults · Silent fallback default on parse failure · ×3
  • Silent fallback default on parse failure scripts/catalog_models_dev.py:273 — `created_key` (in `refresh_openrouter`) returns `0.0` when `(TypeError, 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 scripts/check-reqwest-builders.py:47 — `file_violations` 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 scripts/measure-build-cache.py:61 — `disk_usage_bytes` returns `0` when `(ValueError, 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.
D20 · ADR Quality · ADR has no Context section · ×2
  • ADR has no Context section docs/rfcs/4468-output-presentation-filters.md:1 — docs/rfcs/4468-output-presentation-filters.md has no Context section (a heading such as `## Context`, or the MADR equivalent). A decision record states the context that forced it, the decision and its consequences, so a reader can tell later whether it still holds.
  • ADR has no Context section docs/rfcs/UNIFIED_PROVIDER_LOGIN.md:1 — docs/rfcs/UNIFIED_PROVIDER_LOGIN.md has no Context section (a heading such as `## Context`, or the MADR equivalent). A decision record states the context that forced it, the decision and its consequences, so a reader can tell later whether it still holds.
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 8 of 50 project(s) overshoot their size bounds, lowering Project Cohesion to 6.9/10. The most over is `crates/tui` (1122829 LoC, 2548 module-visible types across 93 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.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D31 · IaC & Container Security · Low IaC · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
P2 · Observability · Logging is not universal · ×1
  • Logging is not universal — Only 13/21 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `.`, `crates/memory`, `crates/tui/plugins/computer-use`, `npm/codewhale` and 3 more.
R7 · Dead Code · Unused export 'EMPTY_FILTERS' · ×1
  • Unused export 'EMPTY_FILTERS' pet/src/core/model.ts:66 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'eventMatches' · ×1
  • Unused export 'eventMatches' pet/src/core/model.ts:67 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'durationOf' · ×1
  • Unused export 'durationOf' pet/src/core/model.ts:81 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'formatTime' · ×1
  • Unused export 'formatTime' pet/src/core/model.ts:102 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'intensity' · ×1
  • Unused export 'intensity' pet/src/core/signal.ts:89 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'totals' · ×1
  • Unused export 'totals' pet/src/core/signal.ts:93 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'onsetSeries' · ×1
  • Unused export 'onsetSeries' pet/src/core/signal.ts:130 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'autocorrelation' · ×1
  • Unused export 'autocorrelation' pet/src/core/signal.ts:138 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'periodogram' · ×1
  • Unused export 'periodogram' pet/src/core/signal.ts:152 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'unionDuration' · ×1
  • Unused export 'unionDuration' pet/src/core/signal.ts:169 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'MAX_PANIC_SITE_LEN' · ×1
  • Unused export 'MAX_PANIC_SITE_LEN' REDACTED:74 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'MAX_PROVIDERS' · ×1
  • Unused export 'MAX_PROVIDERS' REDACTED:80 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'getDispatch' · ×1
  • Unused export 'getDispatch' web/lib/kv.ts:72 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'putDispatch' · ×1
  • Unused export 'putDispatch' web/lib/kv.ts:83 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'RECIPE_SOURCE' · ×1
  • Unused export 'RECIPE_SOURCE' web/lib/ratatui/recipes.ts:20 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused private field 'extensionContext' · ×1
  • Unused private field 'extensionContext' extensions/vscode/src/chat.ts:107 — Nothing in its class reads or assigns this private field (for a constructor parameter property: it is stored and never read), and no string key or test reaches it by name. Remove it, or use it where it was meant to take effect.
R7 · Dead Code · Unused module-local declaration 'requiredEnv' · ×1
  • Unused module-local declaration 'requiredEnv' integrations/weixin-bridge/src/index.mjs:68 — This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code · Unused module-local declaration 'loadChecksums' · ×1
  • Unused module-local declaration 'loadChecksums' REDACTED:1456 — This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code · Unused module-local declaration 'gitBuffer' · ×1
  • Unused module-local declaration 'gitBuffer' scripts/review-eval.mjs:66 — This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code · Unused module-local declaration 'nullSeparated' · ×1
  • Unused module-local declaration 'nullSeparated' scripts/review-eval.mjs:70 — This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
S1 · Web-Security Posture · No app-layer HTTPS enforcement detected · ×1
  • No app-layer HTTPS enforcement detected — This repository starts an HTTP server and nothing in its Rust source or committed `Rocket.toml` secures the transport: no TLS served (actix-web `bind_rustls`/`bind_openssl`, axum-server `bind_rustls` with a `RustlsConfig`, tonic `ServerTlsConfig`, a `TlsAcceptor`, Rocket's `[default.tls]`), no `Strict-Transport-Security` header, no `X-Forwarded-Proto` read from a TLS-terminating proxy — so its traffic may cross the network in clear text. (−2.0 on this card.) The server: `axum::serve(` (crates/tui/src/runtime_api.rs:508).
S1 · Web-Security Posture · Security headers incomplete · ×1
  • Security headers incomplete — Set: Content-Security-Policy, Permissions-Policy, Referrer-Policy, X-Content-Type-Options. Missing: Strict-Transport-Security, X-Frame-Options — the four headers that carry the points of this card's security-headers term (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options), 0.5 each.(−1.0 on this card.) The server: `axum::serve(` (crates/tui/src/runtime_api.rs:508).
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 30/33 async functions that make a cancellable request (fetch, axios, ky, ofetch) 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 · Null assertions (`!`) reduce the strict null checking score · ×1
  • Null assertions (`!`) reduce the strict null checking score — ~1.1 `!` null assertions per 1k TypeScript source lines — 49 assertion(s) across the 45754 source line(s) of the 402 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: pet/src/core/codewhale.ts (5), web/lib/community-agent-tasks.ts (5), pet/src/core/evidence.ts (3). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
Minor — 2 finding(s)
D10 · Test Quality · Skipped (documented) · ×2
  • Skipped (documented): (unnamed test) web/lib/public-installer-contract.test.ts:205 — Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
  • Skipped (documented): macOS raster dimensions are read from both PNG and JPEG headers crates/tui/plugins/computer-use/tests/darwin.test.mjs:1104 — Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call

Appendix B — Reproduction & audit trail

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

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-99e8288274f54b3d9f13bf49c5385eb2/history.json --exit-code 0 --source .0—
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/watchdog-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt --exclude crates/tui/extension-host --exclude vendor/codewhale-ratatui/vendor .150artifacts/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-update5artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy config --format json --quiet .6artifacts/raw/trivy-config.json
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 15 file(s) — `pet/android/PetSim.kt`, `pet/android/src/main/kotlin/codewhale/pet/PetViewModel.kt`, `pet/src/core/model.ts`, `web/components/icon.tsx`, `web/lib/content/account-entry.ts`, … (+10 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 01a17630-2d15-73c9-acd1-e4a45851dcf5 · 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